Commit 987ea5b7 authored by Jussi Kivilinna's avatar Jussi Kivilinna
Browse files

ubgps: fix power-management threshold comparisons


Signed-off-by: default avatarJussi Kivilinna <jussi.kivilinna@haltian.com>
parent 21df1ef8
...@@ -464,7 +464,7 @@ int ubgps_config(gps_config_t const config, void const * const value) ...@@ -464,7 +464,7 @@ int ubgps_config(gps_config_t const config, void const * const value)
gps->state.current_state == GPS_STATE_FIX_ACQUIRED) gps->state.current_state == GPS_STATE_FIX_ACQUIRED)
{ {
#ifdef CONFIG_UBGPS_PSM_MODE #ifdef CONFIG_UBGPS_PSM_MODE
if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD) if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD * 1000)
{ {
/* Use default navigation rate for SW controlled PSM */ /* Use default navigation rate for SW controlled PSM */
......
...@@ -450,7 +450,7 @@ static int ubgps_sm_global(struct ubgps_s * const gps, struct sm_event_s const * ...@@ -450,7 +450,7 @@ static int ubgps_sm_global(struct ubgps_s * const gps, struct sm_event_s const *
/* Construct power save mode event */ /* Construct power save mode event */
if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD) if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD * 1000)
{ {
struct sm_event_psm_event_s psm; struct sm_event_psm_event_s psm;
...@@ -577,12 +577,12 @@ static int ubgps_sm_global(struct ubgps_s * const gps, struct sm_event_s const * ...@@ -577,12 +577,12 @@ static int ubgps_sm_global(struct ubgps_s * const gps, struct sm_event_s const *
{ {
/* Start SW controlled power save mode (PSM). */ /* Start SW controlled power save mode (PSM). */
if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD) if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD * 1000)
{ {
struct timespec ts = {}; struct timespec ts = {};
clock_gettime(CLOCK_MONOTONIC, &ts); clock_gettime(CLOCK_MONOTONIC, &ts);
ts.tv_sec += gps->state.navigation_rate/1000; ts.tv_sec += gps->state.navigation_rate / 1000;
gps->state.psm_timer_id = ts_core_timer_setup_date(&ts, gps->state.psm_timer_id = ts_core_timer_setup_date(&ts,
ubgps_psm_timer_cb, gps); ubgps_psm_timer_cb, gps);
...@@ -999,7 +999,7 @@ static int ubgps_init_process_phase(struct ubgps_s * const gps, bool next) ...@@ -999,7 +999,7 @@ static int ubgps_init_process_phase(struct ubgps_s * const gps, bool next)
/* Set GPS navigation rate */ /* Set GPS navigation rate */
#ifdef CONFIG_UBGPS_PSM_MODE #ifdef CONFIG_UBGPS_PSM_MODE
if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD*1000) if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD * 1000)
{ {
/* Use default navigation rate for SW controlled PSM */ /* Use default navigation rate for SW controlled PSM */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment