Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Commit

Permalink
fix: add rsrp
Browse files Browse the repository at this point in the history
  • Loading branch information
simensrostad committed Nov 12, 2019
1 parent 57809c0 commit fbddcbb
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions applications/cat_tracker/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ static int num_queued_entries;
static struct k_work cloud_send_cfg_work;
static struct k_work cloud_pairing_routine_work;
static struct k_work cloud_update_routine_work;
static struct k_work fetch_modem_data_work;

K_SEM_DEFINE(accel_trig_sem, 0, 1);
K_SEM_DEFINE(gps_timeout_sem, 0, 1);
Expand Down Expand Up @@ -415,11 +416,17 @@ static void cloud_update_routine_work_fn(struct k_work *work)
cloud_update_routine();
}

static void fetch_modem_data_work_fn(struct k_work *work)
{
modem_info_params_get(&modem_param);
}

static void work_init(void)
{
k_work_init(&cloud_send_cfg_work, cloud_send_cfg_work_fn);
k_work_init(&cloud_pairing_routine_work, cloud_pairing_routine_work_fn);
k_work_init(&cloud_update_routine_work, cloud_update_routine_work_fn);
k_work_init(&fetch_modem_data_work, fetch_modem_data_work_fn);
}

static void adxl362_trigger_handler(struct device *dev,
Expand Down Expand Up @@ -477,7 +484,7 @@ static void gps_trigger_handler(struct device *dev, struct gps_trigger *trigger)
gps_channel_get(dev, GPS_CHAN_PVT, &gps_data);
set_current_time(gps_data);
populate_gps_buffer(gps_data);
gps_control_stop(1);
gps_control_stop(K_NO_WAIT);
}

static void adxl362_init(void)
Expand Down Expand Up @@ -696,6 +703,17 @@ static void lte_connect(enum lte_conn_actions action)
}

#if defined(CONFIG_MODEM_INFO)
static void modem_rsrp_handler(char rsrp_value)
{
if (rsrp_value == 255) {
return;
}

rsrp = rsrp_value;

printk("rsrp value is %d\n", rsrp);
}

static int modem_data_init(void)
{
int err;
Expand All @@ -710,6 +728,11 @@ static int modem_data_init(void)
return err;
}

err = modem_info_rsrp_register(modem_rsrp_handler);
if (err != 0) {
return err;
}

return 0;
}
#endif
Expand Down Expand Up @@ -751,9 +774,9 @@ void main(void)
}
}

gps_control_start(1);
gps_control_start(K_NO_WAIT);
if (k_sem_take(&gps_timeout_sem, K_SECONDS(cloud_data.gps_timeout))) {
gps_control_stop(1);
gps_control_stop(K_NO_WAIT);
}

k_sleep(K_SECONDS(check_active_wait()));
Expand Down

0 comments on commit fbddcbb

Please sign in to comment.