mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-21 12:01:29 +00:00
34 lines
749 B
C
34 lines
749 B
C
![]() |
#pragma once
|
||
|
#include "configuration.h"
|
||
|
|
||
|
#include "meshtastic/powermon.pb.h"
|
||
|
|
||
|
#ifndef MESHTASTIC_EXCLUDE_POWERMON
|
||
|
#define USE_POWERMON // FIXME turn this only for certain builds
|
||
|
#endif
|
||
|
|
||
|
/**
|
||
|
* The singleton class for monitoring power consumption of device
|
||
|
* subsystems/modes.
|
||
|
*
|
||
|
* For more information see the PowerMon docs.
|
||
|
*/
|
||
|
class PowerMon
|
||
|
{
|
||
|
uint64_t states = 0UL;
|
||
|
|
||
|
public:
|
||
|
PowerMon() {}
|
||
|
|
||
|
// Mark entry/exit of a power consuming state
|
||
|
void setState(_meshtastic_PowerMon_State state, const char *reason = "");
|
||
|
void clearState(_meshtastic_PowerMon_State state, const char *reason = "");
|
||
|
|
||
|
private:
|
||
|
// Emit the coded log message
|
||
|
void emitLog(const char *reason);
|
||
|
};
|
||
|
|
||
|
extern PowerMon *powerMon;
|
||
|
|
||
|
void powerMonInit();
|