Skip to content

Commit

Permalink
ubgps: fix power-management threshold comparisons
Browse files Browse the repository at this point in the history
Signed-off-by: Jussi Kivilinna <[email protected]>
  • Loading branch information
Jussi Kivilinna committed Sep 25, 2015
1 parent 21df1ef commit 987ea5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/system/ubgps/ubgps.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ int ubgps_config(gps_config_t const config, void const * const value)
gps->state.current_state == GPS_STATE_FIX_ACQUIRED)
{
#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 */

Expand Down
8 changes: 4 additions & 4 deletions apps/system/ubgps/ubgps_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static int ubgps_sm_global(struct ubgps_s * const gps, struct sm_event_s const *

/* 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;

Expand Down Expand Up @@ -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). */

if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD)
if (gps->state.navigation_rate >= CONFIG_UBGPS_PSM_MODE_THRESHOLD * 1000)
{
struct timespec 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,
ubgps_psm_timer_cb, gps);

Expand Down Expand Up @@ -999,7 +999,7 @@ static int ubgps_init_process_phase(struct ubgps_s * const gps, bool next)
/* Set GPS navigation rate */

#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 */

Expand Down

0 comments on commit 987ea5b

Please sign in to comment.