Skip to content

Commit

Permalink
modules: memfault: Add cell ID and TAC metrics
Browse files Browse the repository at this point in the history
Add collection of cell ID and tracking area code metrics when
a cell update event is received.

Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
  • Loading branch information
jtguggedal authored and rlubos committed Oct 10, 2024
1 parent da81a34 commit b266253
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ MEMFAULT_METRICS_KEY_DEFINE(ncs_lte_edrx_ptw_ms, kMemfaultMetricType_Unsigned)
MEMFAULT_METRICS_KEY_DEFINE(ncs_lte_mode, kMemfaultMetricType_Unsigned)
MEMFAULT_METRICS_KEY_DEFINE(ncs_lte_on_time_ms, kMemfaultMetricType_Timer)
MEMFAULT_METRICS_KEY_DEFINE(ncs_lte_reset_loop_detected_count, kMemfaultMetricType_Unsigned)
MEMFAULT_METRICS_KEY_DEFINE(ncs_lte_cell_id, kMemfaultMetricType_Signed)
MEMFAULT_METRICS_KEY_DEFINE(ncs_lte_tracking_area_code, kMemfaultMetricType_Signed)
#endif /* CONFIG_MEMFAULT_NCS_LTE_METRICS */

#ifdef CONFIG_MEMFAULT_NCS_BT_METRICS
Expand Down
13 changes: 12 additions & 1 deletion modules/memfault-firmware-sdk/memfault_lte_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static void modem_params_get(void)

err = modem_info_get_snr(&snr);
if (err) {
LOG_DBG("Failed to get SNR")
LOG_DBG("Failed to get SNR");
return;
}

Expand All @@ -120,6 +120,17 @@ static void lte_handler(const struct lte_lc_evt *const evt)
}

switch (evt->type) {
case LTE_LC_EVT_CELL_UPDATE:
err = MEMFAULT_METRIC_SET_SIGNED(ncs_lte_cell_id, evt->cell.id);
if (err) {
LOG_ERR("Failed to set ncs_lte_cell_id");
}

err = MEMFAULT_METRIC_SET_SIGNED(ncs_lte_tracking_area_code, evt->cell.tac);
if (err) {
LOG_ERR("Failed to set ncs_lte_tracking_area_code");
}
break;
case LTE_LC_EVT_NW_REG_STATUS:
switch (evt->nw_reg_status) {

Expand Down

0 comments on commit b266253

Please sign in to comment.