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.
Issue
Using the LoRa Edge Config mobile application.
When trying to set static_scan_interval to 1440 minutes, the value was incorrectly clipped to 347.
Root causes
In tracker_utility.h, in the handling of BLE commands.
Incorrect data type
In
SET_APP_STATIC_SCAN_INTERVAL_CMD
, the values are extracted from a buffer ofuint8_t
to a tempuint16_t
, which is too small for internal computation.Thus, the computed value in seconds is clipped, leading to an incorrect setting.
The values stored in
tracker_ctx
are correctly of typeuint32_t
, but the clipping happens before.Example and compiler output:
Logic error
Additionnaly, the comparison with
STATIC_SCAN_INTERVAL_MIN
andSTATIC_SCAN_INTERVAL_MAX
is directly done on the high byte of the raw payload buffer, instead of the final computed value (in seconds). See tracker_utility.c line 1685.Fixes
This pull request fixes these two issues:
Use an
uint32_t
for the intermediate value used in computations.Use the computed value instead of the raw payload buffer.