meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
3.51k stars 865 forks source link

Implement PowerMon #4136

Closed geeksville closed 2 months ago

geeksville commented 4 months ago

PowerMon

(eventually I'll move this someplace better - but placing it here for feedback from other meshtastic devs)

On device API

PowerMon class

Users should try to call setState/clearState just before/after and significant power consuming device changes. It is assumed that the python code will slightly delay after receiving the log message (100ms?) before capturing the power meter measurement.

PowerStress class

PowerMon states

Use protobuf enums to define these states, so that python and device code can share definitions. Any eng can add new states by just adding a new enum value.

etc...

Runtime report collection

CSV report format

A row heading will be emitted based on the protobuf defs (so spreadsheet will have nice names)

Data rows

CSV summary report

Summary report (generated afterwards from that csv)

Graph results

Possibly use excel, but probably plottly-express (i.e. python) to make a nice graph showing stacked bars for states and the total height of the bars be based on the measured power. Each state segment in the bar will be sized based on average power consumption attributed to that state alone.

Structured log messages

We have defined a mini standard for log messages that are intended for machine parsing. We do this in the hopes that these messages will remain mostly stable for use over a long time (i.e. old logs can be compared to new for regression testing).

The standard designed to be short and easily machine parsable. The format for these messages must be:

S:SUBSYS:arg1,arg2,arg3,...

Where "S:" is a string constant prefix always used on such messages. Current defined subsystems:

Current notes-to-self TODO: