-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add PowerMon support #4155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add PowerMon support #4155
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
f33bf01
Turn off vscode cmake prompt - we don't use cmake on meshtastic
geeksville ce2047a
Add rak4631_dap variant for debugging with NanoDAP debug probe device.
geeksville 22212b2
The rak device can also run freertos (which is underneath nrf52 arduino)
geeksville 8d65e03
Add semihosting support for nrf52840 devices
geeksville 03033ec
Merge remote-tracking branch 'root/master' into dev
geeksville f435851
powermon WIP (for https://github.com/meshtastic/firmware/issues/4136 )
geeksville 8c46a7e
oops - mean't to mark the _dbg variant as an 'extra' board.
geeksville a8c265a
Merge remote-tracking branch 'root/master' into dev
geeksville dc5c5bf
powermon wip
geeksville 2705fe6
Merge branch 'dev' into powermon
geeksville f872cf1
Make serial port on wio-sdk-wm1110 board work
geeksville 33a929c
Instrument (radiolib only for now) lora for powermon
geeksville 809e06b
Merge remote-tracking branch 'root/master' into powermon
geeksville b2a388b
powermon gps support
geeksville febe747
Add CPU deep and light sleep powermon states
geeksville c830942
Change the board/swversion bootstring so it is a new "structured" log…
geeksville c328e6a
powermon wip
geeksville 0acfeae
add example script for getting esp S3 debugging working
geeksville 039de45
Add PowerMon reporting for screen and bluetooth pwr.
geeksville c05f2e3
make power.powermon_enables config setting work.
geeksville 948bc4b
update to latest protobufs
geeksville c67a9df
Merge remote-tracking branch 'root/master' into powermon
geeksville 1eff321
Merge remote-tracking branch 'root/master' into powermon
geeksville 232e9d9
fix bogus shellcheck warning
geeksville 76c9fb3
Merge remote-tracking branch 'root/master' into powermon
geeksville d266484
make powermon optional (but default enabled because tiny and no runti…
geeksville 6c753ce
tell vscode, if formatting, use whatever our trunk formatter wants
geeksville 6929a14
Merge branch 'pr-trunkish' into powermon
geeksville 669afac
add PowerStress module
geeksville b0de20f
nrf52 arduino is built upon freertos, so let platformio debug it
geeksville 1382ac6
don't accidentally try to Segger ICE if we are using another ICE
geeksville 1d65dae
clean up RedirectablePrint::log so it doesn't have three very differe…
geeksville 5464310
remove NoopPrint - it is no longer needed
geeksville a94a5e6
when talking to API clients via serial, don't turn off log msgs inste…
geeksville c0482f5
fix the build - would loop forever if there were no files to send
geeksville 5fd18a0
Merge branch 'master' into pr-fixbuild
geeksville c8a4b99
Merge branch 'pr-fixbuild' into pr-protolog
geeksville 4301544
don't use Segger code if not talking to a Segger debugger
geeksville b69956e
when encapsulating logs, make sure the strings always has nul termina…
geeksville ca53564
nrf52 soft device will watchdog if you use ICE while BT on...
geeksville 359fe6a
Merge branch 'pr-fixdebug2' into pr-protolog
geeksville f37bed4
Important to not print debug messages while writing to the toPhone sc…
geeksville d5bcfc6
don't include newlines if encapsulating log records as protobufs
geeksville fcb7f13
Merge remote-tracking branch 'root/master' into pr-protolog
geeksville a5a2a7d
Merge branch 'pr-protolog' into powermon
geeksville d885d59
update to latest protobufs (needed for powermon goo)
geeksville baa258c
PowerStress WIP
geeksville 95885a1
Merge remote-tracking branch 'root/master' into pr-protolog
geeksville 7cd3c0c
Merge branch 'pr-protolog' into powermon
geeksville 25ebf4c
Merge remote-tracking branch 'root/master' into powermon
geeksville c0a7796
fix linter warning
geeksville File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # shellcheck shell=bash | ||
| # (this minor script is actually shell agnostic, and is intended to be sourced rather than run in a subshell) | ||
|
|
||
| # This is a little script you can source if you want to make ESP debugging work on a modern (24.04) ubuntu machine | ||
| # It assumes you have built and installed python 2.7 from source with: | ||
| # ./configure --enable-optimizations --enable-shared --enable-unicode=ucs4 | ||
| # sudo make clean | ||
| # make | ||
| # sudo make altinstall | ||
|
|
||
| export LD_LIBRARY_PATH=$HOME/packages/python-2.7.18/ | ||
| export PYTHON_HOME=/usr/local/lib/python2.7/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #include "PowerMon.h" | ||
| #include "NodeDB.h" | ||
|
|
||
| // Use the 'live' config flag to figure out if we should be showing this message | ||
| static bool is_power_enabled(uint64_t m) | ||
| { | ||
| 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\n", (uint32_t)states, reason); | ||
| #endif | ||
| } | ||
|
|
||
| PowerMon *powerMon; | ||
|
|
||
| void powerMonInit() | ||
| { | ||
| powerMon = new PowerMon(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.