Skip to content
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

Fix datatype issue for intervals #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1617,11 +1617,11 @@ uint8_t tracker_parse_cmd( uint8_t stack_id, uint8_t* payload, uint8_t* buffer_o

case SET_APP_MOBILE_SCAN_INTERVAL_CMD:
{
uint16_t mobile_scan_interval = 0;
uint32_t mobile_scan_interval = 0;

tracker_ctx.new_value_to_set = true;

mobile_scan_interval = ( uint16_t ) payload[payload_index] << 8;
mobile_scan_interval = ( uint32_t ) payload[payload_index] << 8;
mobile_scan_interval += payload[payload_index + 1];

if( ( mobile_scan_interval >= MOBILE_SCAN_INTERVAL_MIN ) &&
Expand All @@ -1632,7 +1632,7 @@ uint8_t tracker_parse_cmd( uint8_t stack_id, uint8_t* payload, uint8_t* buffer_o
else
{
/* Clip the value */
if( payload[payload_index] < MOBILE_SCAN_INTERVAL_MIN )
if( mobile_scan_interval < MOBILE_SCAN_INTERVAL_MIN )
{
tracker_ctx.mobile_scan_interval = MOBILE_SCAN_INTERVAL_MIN;
}
Expand Down Expand Up @@ -1666,11 +1666,11 @@ uint8_t tracker_parse_cmd( uint8_t stack_id, uint8_t* payload, uint8_t* buffer_o

case SET_APP_STATIC_SCAN_INTERVAL_CMD:
{
uint16_t static_scan_interval = 0;
uint32_t static_scan_interval = 0;

tracker_ctx.new_value_to_set = true;

static_scan_interval = ( uint16_t ) payload[payload_index] << 8;
static_scan_interval = ( uint32_t ) payload[payload_index] << 8;
static_scan_interval += payload[payload_index + 1];
static_scan_interval *= 60;

Expand All @@ -1682,7 +1682,7 @@ uint8_t tracker_parse_cmd( uint8_t stack_id, uint8_t* payload, uint8_t* buffer_o
else
{
/* Clip the value */
if( payload[payload_index] < STATIC_SCAN_INTERVAL_MIN )
if( static_scan_interval < STATIC_SCAN_INTERVAL_MIN )
{
tracker_ctx.static_scan_interval = STATIC_SCAN_INTERVAL_MIN;
}
Expand Down