meshtastic / firmware

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

Add PowerMon support #4155

Closed geeksville closed 2 months ago

geeksville commented 2 months ago

This is currently a draft just so I can have a ptr to my WIP branch. You can ignore it for now unless curious. Once I have things kinda working I'll rebase the various commits into a small number of more logical commits and then change the PR to not be draft.

I'll also move a few commits into other unrelated prs.

Fixes #4136

geeksville commented 2 months ago

and (ugh) there's a few places where my ide (or the trunk plugin for vscode?) reformatted lines I hadn't changed. I'll fix that.

geeksville commented 2 months ago

Hi hi,

Does this change look okay for ya'll to go in? I'd kinda like for this to to in now even though I still have a few more changes coming (just localized to the new PowerStress class). The runtime impact of powermon & powerstress is a small amount of CODE size and a tiny about of RAM. If the corresponding config variable is not set, the code change at runtime is minimal.

If modules are being excluded it is completely removed from the build.

I'm submitting for review now because I had to touch a fair # of files and I've got too many open WIP branches ;-).

For early docs see #4136. However after I'm finished with this feature (a weekish?) I'll move much of that text to become a new doc page and tutorial about how to do power measurements on boards. The main remaining work is not on the firmware or python client side but rather the analysis reporting chain (which in in a new meshtastic.analysis submodule in the python code).