modem: hl7800: Make RSSI rate configurable
Improve ability to sleep. Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
This commit is contained in:
parent
05e818c51c
commit
8c1387ef1a
3 changed files with 28 additions and 5 deletions
|
@ -357,4 +357,9 @@ config MODEM_HL7800_ALLOW_SLEEP_DELAY_MS
|
||||||
int "Milliseconds to delay before allowing modem to sleep"
|
int "Milliseconds to delay before allowing modem to sleep"
|
||||||
default 5000
|
default 5000
|
||||||
|
|
||||||
|
config MODEM_HL7800_RSSI_RATE_SECONDS
|
||||||
|
int "Rate to automatically query RSSI"
|
||||||
|
default 0 if MODEM_HL7800_LOW_POWER_MODE
|
||||||
|
default 30
|
||||||
|
|
||||||
endif # MODEM_HL7800
|
endif # MODEM_HL7800
|
||||||
|
|
|
@ -294,7 +294,6 @@ static const struct mdm_control_pinconfig pinconfig[] = {
|
||||||
#define MDM_RESET_HIGH_TIME K_MSEC(10)
|
#define MDM_RESET_HIGH_TIME K_MSEC(10)
|
||||||
#define MDM_WAIT_FOR_DATA_RETRIES 3
|
#define MDM_WAIT_FOR_DATA_RETRIES 3
|
||||||
|
|
||||||
#define RSSI_TIMEOUT_SECS 30
|
|
||||||
#define RSSI_UNKNOWN -999
|
#define RSSI_UNKNOWN -999
|
||||||
|
|
||||||
#define DNS_WORK_DELAY_SECS 1
|
#define DNS_WORK_DELAY_SECS 1
|
||||||
|
@ -596,6 +595,7 @@ static int write_apn(char *access_point_name);
|
||||||
static void mark_sockets_for_reconfig(void);
|
static void mark_sockets_for_reconfig(void);
|
||||||
#endif
|
#endif
|
||||||
static void hl7800_build_mac(struct hl7800_iface_ctx *ictx);
|
static void hl7800_build_mac(struct hl7800_iface_ctx *ictx);
|
||||||
|
static void rssi_query(void);
|
||||||
|
|
||||||
#ifdef CONFIG_MODEM_HL7800_LOW_POWER_MODE
|
#ifdef CONFIG_MODEM_HL7800_LOW_POWER_MODE
|
||||||
static void initialize_sleep_level(void);
|
static void initialize_sleep_level(void);
|
||||||
|
@ -965,6 +965,10 @@ static void event_handler(enum mdm_hl7800_event event, void *event_data)
|
||||||
|
|
||||||
void mdm_hl7800_get_signal_quality(int *rsrp, int *sinr)
|
void mdm_hl7800_get_signal_quality(int *rsrp, int *sinr)
|
||||||
{
|
{
|
||||||
|
if (CONFIG_MODEM_HL7800_RSSI_RATE_SECONDS == 0) {
|
||||||
|
rssi_query();
|
||||||
|
}
|
||||||
|
|
||||||
*rsrp = ictx.mdm_rssi;
|
*rsrp = ictx.mdm_rssi;
|
||||||
*sinr = ictx.mdm_sinr;
|
*sinr = ictx.mdm_sinr;
|
||||||
}
|
}
|
||||||
|
@ -2716,6 +2720,9 @@ static int hl7800_query_rssi(void)
|
||||||
|
|
||||||
static void hl7800_start_rssi_work(void)
|
static void hl7800_start_rssi_work(void)
|
||||||
{
|
{
|
||||||
|
/* Rate is not checked here to allow one reading
|
||||||
|
* when going from network down->up
|
||||||
|
*/
|
||||||
k_work_reschedule_for_queue(&hl7800_workq, &ictx.rssi_query_work,
|
k_work_reschedule_for_queue(&hl7800_workq, &ictx.rssi_query_work,
|
||||||
K_NO_WAIT);
|
K_NO_WAIT);
|
||||||
}
|
}
|
||||||
|
@ -2730,17 +2737,24 @@ static void hl7800_stop_rssi_work(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hl7800_rssi_query_work(struct k_work *work)
|
static void rssi_query(void)
|
||||||
{
|
{
|
||||||
hl7800_lock();
|
hl7800_lock();
|
||||||
wakeup_hl7800();
|
wakeup_hl7800();
|
||||||
hl7800_query_rssi();
|
hl7800_query_rssi();
|
||||||
allow_sleep(true);
|
allow_sleep(true);
|
||||||
hl7800_unlock();
|
hl7800_unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hl7800_rssi_query_work(struct k_work *work)
|
||||||
|
{
|
||||||
|
rssi_query();
|
||||||
|
|
||||||
/* re-start RSSI query work */
|
/* re-start RSSI query work */
|
||||||
|
if (CONFIG_MODEM_HL7800_RSSI_RATE_SECONDS > 0) {
|
||||||
k_work_reschedule_for_queue(&hl7800_workq, &ictx.rssi_query_work,
|
k_work_reschedule_for_queue(&hl7800_workq, &ictx.rssi_query_work,
|
||||||
K_SECONDS(RSSI_TIMEOUT_SECS));
|
K_SECONDS(CONFIG_MODEM_HL7800_RSSI_RATE_SECONDS));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MODEM_HL7800_GPS
|
#ifdef CONFIG_MODEM_HL7800_GPS
|
||||||
|
|
|
@ -282,7 +282,11 @@ void mdm_hl7800_wakeup(bool awake);
|
||||||
int32_t mdm_hl7800_send_at_cmd(const uint8_t *data);
|
int32_t mdm_hl7800_send_at_cmd(const uint8_t *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the signal quality of the HL7800
|
* @brief Get the signal quality of the HL7800.
|
||||||
|
* If CONFIG_MODEM_HL7800_RSSI_RATE_SECONDS is non-zero, then
|
||||||
|
* this function returns the value from the last periodic read.
|
||||||
|
* If CONFIG_MODEM_HL7800_RSSI_RATE_SECONDS is 0, then this
|
||||||
|
* may cause the modem to be woken so that the values can be queried.
|
||||||
*
|
*
|
||||||
* @param rsrp Reference Signals Received Power (dBm)
|
* @param rsrp Reference Signals Received Power (dBm)
|
||||||
* Range = -140 dBm to -44 dBm
|
* Range = -140 dBm to -44 dBm
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue