mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-16 06:47:52 +00:00
I thought git would be smart enough to understand all the whitespace changes but even with all the flags I know to make it ignore theses it still blows up if there are identical changes on both sides.
I have a solution but it require creating a new commit at the merge base for each conflicting PR and merging it into develop.
I don't think blowing up all PRs is worth for now, maybe if we can coordinate this for V3 let's say.
This reverts commit 0d11331d18.
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#include "PowerMon.h"
|
|
#include "NodeDB.h"
|
|
|
|
// Use the 'live' config flag to figure out if we should be showing this message
|
|
bool PowerMon::is_power_enabled(uint64_t m)
|
|
{
|
|
// FIXME: VERY STRANGE BUG: if I or in "force_enabled || " the flashed image on a rak4631 is not accepted by the bootloader as
|
|
// valid!!! Possibly a linker/gcc/bootloader bug somewhere?
|
|
return ((m & config.power.powermon_enables) ? true : false);
|
|
}
|
|
|
|
void PowerMon::setState(_meshtastic_PowerMon_State state, const char *reason)
|
|
{
|
|
#ifdef USE_POWERMON
|
|
auto oldstates = states;
|
|
states |= state;
|
|
if (oldstates != states && is_power_enabled(state)) {
|
|
emitLog(reason);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void PowerMon::clearState(_meshtastic_PowerMon_State state, const char *reason)
|
|
{
|
|
#ifdef USE_POWERMON
|
|
auto oldstates = states;
|
|
states &= ~state;
|
|
if (oldstates != states && is_power_enabled(state)) {
|
|
emitLog(reason);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void PowerMon::emitLog(const char *reason)
|
|
{
|
|
#ifdef USE_POWERMON
|
|
// The nrf52 printf doesn't understand 64 bit ints, so if we ever reach that point this function will need to change.
|
|
LOG_INFO("S:PM:0x%08lx,%s", (uint32_t)states, reason);
|
|
#endif
|
|
}
|
|
|
|
PowerMon *powerMon;
|
|
|
|
void powerMonInit()
|
|
{
|
|
powerMon = new PowerMon();
|
|
} |