Repository navigation
Feat: Add decaf zero-timeout value #10570
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
Closed
Closed
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e47ce10
Allow max timeout values to request zero delay
h3lix1 12df559
Use decaf zero timeout sentinel
h3lix1 bf229c6
Document decaf zero timeout value
h3lix1 4534112
Merge branch 'develop' into power-timeout-zero-sentinel
h3lix1 780e395
Merge remote-tracking branch 'upstream/develop' into power-timeout-ze…
h3lix1 a60092c
Merge remote-tracking branch 'refs/remotes/upstream/develop' into pow…
h3lix1 898f3ab
Merge remote-tracking branch 'upstream/develop' into pr-10570-power-t…
h3lix1 7058a59
Merge branch 'develop' into power-timeout-zero-sentinel
h3lix1 1481a0f
fix(PowerFSM): keep the DARK re-check period non-zero under the timeo…
h3lix1 9170fe9
Merge branch 'develop' into power-timeout-zero-sentinel
h3lix1 abf3d2e
Merge branch 'develop' into power-timeout-zero-sentinel
h3lix1 66cd49a
fix(PowerFSM): honour the timeout sentinel in the remaining screen paths
h3lix1 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
Some comments aren't visible on the classic Files Changed page.
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
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
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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| 24 | ||
| 25 |
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,54 @@ | ||
| // Unit tests for PowerFSM timeout helpers | ||
| #include "Default.h" | ||
| #include "PowerFSM.h" | ||
| #include "TestUtil.h" | ||
| #include <unity.h> | ||
|
|
||
| void test_dark_recheck_uses_configured_screen_on() | ||
| { | ||
| config.device.role = meshtastic_Config_DeviceConfig_Role_CLIENT; | ||
| config.display.screen_on_secs = 30; | ||
|
|
||
| TEST_ASSERT_EQUAL_UINT32(30000U, getDarkRecheckMs()); | ||
| } | ||
|
|
||
| void test_dark_recheck_uses_default_when_unset() | ||
| { | ||
| config.device.role = meshtastic_Config_DeviceConfig_Role_CLIENT; | ||
| config.display.screen_on_secs = 0; | ||
|
|
||
| TEST_ASSERT_EQUAL_UINT32(600000U, getDarkRecheckMs()); | ||
| } | ||
|
|
||
| void test_dark_recheck_never_zero_and_never_sentinel() | ||
| { | ||
| config.device.role = meshtastic_Config_DeviceConfig_Role_CLIENT; | ||
| config.display.screen_on_secs = DECAF_ZERO_TIMEOUT_SECS; | ||
|
|
||
| // The sentinel means "no screen-on time", but it is not a usable poll period: the | ||
| // re-check must be neither zero nor the sentinel interpreted as a seconds count. | ||
| TEST_ASSERT_EQUAL_UINT32(0U, Default::getTimeoutMs(config.display.screen_on_secs, default_screen_on_secs)); | ||
| TEST_ASSERT_EQUAL_UINT32(600000U, getDarkRecheckMs()); | ||
| } | ||
|
|
||
| void test_dark_recheck_sentinel_uses_router_default() | ||
| { | ||
| config.device.role = meshtastic_Config_DeviceConfig_Role_ROUTER; | ||
| config.display.screen_on_secs = DECAF_ZERO_TIMEOUT_SECS; | ||
|
|
||
| TEST_ASSERT_EQUAL_UINT32(1000U, getDarkRecheckMs()); | ||
| } | ||
|
|
||
| void setup() | ||
| { | ||
| delay(10); | ||
| initializeTestEnvironment(); | ||
| UNITY_BEGIN(); | ||
| RUN_TEST(test_dark_recheck_uses_configured_screen_on); | ||
| RUN_TEST(test_dark_recheck_uses_default_when_unset); | ||
| RUN_TEST(test_dark_recheck_never_zero_and_never_sentinel); | ||
| RUN_TEST(test_dark_recheck_sentinel_uses_router_default); | ||
| exit(UNITY_END()); | ||
| } | ||
|
|
||
| void loop() {} |
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.