[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Cell change only: permit optimisation of uCellInfoRefreshRadioParamet…
Browse files Browse the repository at this point in the history
…ers(). (#1165)

The function uCellInfoRefreshRadioParameters() includes a 500 ms delay, added because in the past there were occasions where some module types didn't like being bombarded with the AT commands associated with reading radio parameters.  However, if the application is power/time sensitive this may present an unnecessary overhead, hence the delay is now controlled via a #define, U_CELL_INFO_RADIO_REFRESH_DELAY_MS, which a customer application may override to zero and then take on any required timing-management at application level.

Our thanks to eeFLis for pointing this out.
  • Loading branch information
RobMeades authored May 14, 2024
1 parent 8ace6a5 commit 87a0a2c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
26 changes: 21 additions & 5 deletions cell/api/u_cell_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ extern "C" {
*/
#define U_CELL_INFO_ICCID_BUFFER_SIZE 21

#ifndef U_CELL_INFO_RADIO_REFRESH_DELAY_MS
/** Some modules may not like the AT commands for a radio refresh
* being called repeatedly, hence by default we add a delay, however
* if your application is sensitive to power consumption/time you
* may wish to override this to zero and manage any delay from
* your application instead.
*/
# define U_CELL_INFO_RADIO_REFRESH_DELAY_MS 500
#endif

/* ----------------------------------------------------------------
* TYPES
* -------------------------------------------------------------- */
Expand All @@ -66,11 +76,17 @@ extern "C" {
* FUNCTIONS
* -------------------------------------------------------------- */

/** Refresh the RF status values. Call this to refresh
* RSSI, RSRP, RSRQ, Cell ID, EARFCN, etc. This way all of the
* values read are synchronised to a given point in time. The
* radio parameters stored by this function are cleared on
* disconnect and reboot.
/** Refresh the RF status values. Call this to refresh RSSI, RSRP,
* RSRQ, Cell ID, EARFCN, etc. This way all of the values read are
* synchronised to a given point in time. The radio parameters
* stored by this function are cleared on disconnect and reboot.
*
* Note: some modules do not like the AT commands for a radio refresh
* being called repeatedly, hence this function includes a delay of
* #U_CELL_INFO_RADIO_REFRESH_DELAY_MS. If your application is
* sensitive to power consumption/time you may wish to override the
* value of that delay to zero at compile time and manage timing
* from your application instead.
*
* @param cellHandle the handle of the cellular instance.
* @return zero on success, negative error code on
Expand Down
2 changes: 1 addition & 1 deletion cell/src/u_cell_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ int32_t uCellInfoRefreshRadioParameters(uDeviceHandle_t cellHandle)
// reporting answers.
// Allow a little sleepy-byes here, don't want to overtask
// the module if this is being called repeatedly
uPortTaskBlock(500);
uPortTaskBlock(U_CELL_INFO_RADIO_REFRESH_DELAY_MS);
if (U_CELL_PRIVATE_HAS(pInstance->pModule, U_CELL_PRIVATE_FEATURE_UCGED5)) {
// SARA-R4 (except 422) only supports UCGED=5, and it only
// supports it in EUTRAN mode
Expand Down

0 comments on commit 87a0a2c

Please sign in to comment.