-
Notifications
You must be signed in to change notification settings - Fork 510
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
"sys.uptime" diagnostic data #1393
Conversation
Any reason to not use a 64-bit type and keep the precision to milliseconds? |
I just decided not to use any types which are non-native for the target platforms. We also don't seem to have a good use case for such extended milliseconds counter. |
Updated the milliseconds counter to use |
@@ -36,18 +36,23 @@ | |||
|
|||
/* Exported macros -----------------------------------------------------------*/ | |||
|
|||
#define HAL_Timer_Microseconds HAL_Timer_Get_Micro_Seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unsure about moving the #define since it will change the actual exported function name. I realize the chances are small, but someone could be using the HAL_Timer_Get_Micro_Seconds function. What is the value gained to moving the #define - if it's minimal, I'd prefer not to change it unless there is a known gain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, but these macros do the opposite: they define aliases for already exported functions, rather than define their exported names. I don't see a possibility to break anything with this change, but, for sure, it doesn't bring any value either :)
*/ | ||
system_tick_t GetSystem1MsTick(); | ||
uint64_t GetSystem1MsTick(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an open question - do we break compatibility of these low-level functions? My instinct is to say no and move the 64-bit version to GetSystem1MsTick64
or similar, but happy to hear arguments to the contrary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Problem
The system should report its uptime in seconds.
Solution
AddHAL_Timer_Get_Seconds()
function returning the number of seconds passed since the device was powered on or woken up from sleep.hal_timer_millis()
function returning the number of milliseconds passed since the device was last reset as a 64-bit value.System.uptime()
andSystem.millis()
methods returning the system uptime in seconds and milliseconds respectively.sys.uptime
diagnostic data source.Steps to Test
Run
wiring/no_fixture_long_running
test.Example App
References
Completeness