-
Notifications
You must be signed in to change notification settings - Fork 3k
Cellular: Convert to Chrono #12430
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
Cellular: Convert to Chrono #12430
Conversation
@kjbracey-arm, thank you for your changes. |
// so that not every device don't start at the exact same time (for example after power outage) | ||
_start_time = rand() % (MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY); | ||
_start_time(rand() % (MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY)), |
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.
Is else _start_time(0)
needed here?
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.
No, because Chrono durations and time_points are initialised to zero by default. Still, could have it explicit. That would be more consistent with the existing code.
I guess I was pushing back a bit on the long C++98-style initialiser lists on constructors. Since C++11, member initialisation that doesn't depend on constructor parameters shouldn't be there. They should be in default member initialisers (if even necessary).
uint64_t start_time = rtos::Kernel::get_ms_count(); | ||
while (!ready_to_send && start_time < rtos::Kernel::get_ms_count() + SOCKET_SEND_READY_TIMEOUT) { | ||
auto start_time = rtos::Kernel::Clock::now() ; | ||
while (!ready_to_send && rtos::Kernel::Clock::now() < start_time + SOCKET_SEND_READY_TIMEOUT) { |
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.
Good catch 👍
@@ -10,7 +10,7 @@ | |||
"value": false | |||
}, | |||
"random_max_start_delay": { | |||
"help": "Maximum random delay value used in start-up sequence in milliseconds", | |||
"help": "Maximum random delay value used in start-up sequence in 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.
Another good catch 👍
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.
That's kind of the point of the Chrono stuff - it catches it for you :)
04993b5
to
98664d9
Compare
Re-looking at code after review comments, noticed this print needed fixing:
|
This PR cannot be merged due to conflicts. Please rebase to resolve them. |
98664d9
to
7ae283d
Compare
Rebased. |
7ae283d
to
9e90f80
Compare
CI started |
Test run: FAILEDSummary: 1 of 3 test jobs failed Failed test jobs:
|
Unittests failed, please review |
One actual code fix - legacy Cellular unit tests updated. |
CI started |
Test run: FAILEDSummary: 1 of 3 test jobs failed Failed test jobs:
|
Note that documentation for random_max_start_delay config setting has been changed to indicate that the setting is in seconds, and always has been. No functional change.
Correction - |
CI started |
Test run: SUCCESSSummary: 6 of 6 test jobs passed |
Summary of changes
Covert cellular code to use new Chrono APIs from #12142
Note that documentation for random_max_start_delay config setting has
been changed to indicate that the setting is in seconds, and always has
been. No functional change.
Impact of changes
Eliminate use of deprecated core APIs.
Some public cellular APIs now have dual Chrono and non-Chrono forms - non-Chrono not yet deprecated.
Migration actions required
Documentation
None
Pull request type
Test results
Reviewers