Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hl7802 signal function #84

Merged
merged 24 commits into from
Mar 21, 2022
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
210a55c
Update cellular library to MIT license
chinglee-iot Mar 29, 2021
298ae4c
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jun 30, 2021
21ea9bc
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jul 16, 2021
6690f3b
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jul 23, 2021
4a58d89
Merge branch 'FreeRTOS:main' into main
chinglee-iot Aug 24, 2021
955ebc0
Merge branch 'FreeRTOS:main' into main
chinglee-iot Oct 25, 2021
bba8adf
Merge branch 'FreeRTOS:main' into main
chinglee-iot Nov 4, 2021
440bec9
Merge branch 'FreeRTOS:main' into main
chinglee-iot Nov 9, 2021
a0fb7c7
Merge branch 'FreeRTOS:main' into main
chinglee-iot Nov 16, 2021
b28ed63
Merge branch 'FreeRTOS:main' into main
chinglee-iot Nov 24, 2021
b40cb10
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 1, 2021
ca024c6
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 1, 2021
277d8b7
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 15, 2021
06402e9
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 21, 2021
a993410
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 21, 2021
45b9bcd
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 27, 2021
cacbf87
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jan 6, 2022
128407c
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jan 7, 2022
b1e3e46
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jan 10, 2022
70e76c4
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jan 11, 2022
107896c
Merge branch 'FreeRTOS:main' into main
chinglee-iot Feb 7, 2022
b3f4fab
Merge branch 'FreeRTOS:main' into main
chinglee-iot Mar 15, 2022
42cb694
Update HL7802 Cellular_GetSignalInfo
chinglee-iot Mar 17, 2022
887eedd
Fix rxlev value range
chinglee-iot Mar 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions modules/hl7802/cellular_hl7802_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ static CellularPktStatus_t _Cellular_RecvFuncGetRatPriority( CellularContext_t *
const CellularATCommandResponse_t * pAtResp,
void * pData,
uint16_t dataLen );
static int16_t convertCesqSignalRxlev( int32_t rxlevValue );
static int16_t convertCesqSignalRsrq( int32_t rsrqValue );
static int16_t convertCesqSignalRsrp( int32_t rsrpValue );
static bool _parseSignalQuality( char * pQcsqPayload,
Expand Down Expand Up @@ -998,6 +999,33 @@ static CellularPktStatus_t _Cellular_RecvFuncGetRatPriority( CellularContext_t *

/*-----------------------------------------------------------*/

/* Received signal strength level (see 3GPP TS 45.008 [20] subclause 8.1.4)
* 0 rssi < -110 dBm : assume -111 dBm to indicate the signal is detectable but fairly week.
* 1 -110 dBm <= rssi < -109 dBm
* 2 -109 dBm <= rssi < -108 dBm
* ...
* 61 -50 dBm <= rssi < -49 dBm
* 62 -49 dBm <= rssi < -48 dBm
* 63 -48 dBm <= rssi
* 99 not known or not detectable */
static int16_t convertCesqSignalRxlev( int32_t rxlevValue )
{
int16_t rssidBm = 0;

if( ( rxlevValue >= 0 ) && ( rxlevValue <= 63 ) )
{
rssidBm = ( int16_t ) ( ( -111 ) + ( rxlevValue ) );
}
else
{
rssidBm = CELLULAR_INVALID_SIGNAL_VALUE;
}

return rssidBm;
}

/*-----------------------------------------------------------*/

/* 0 rsrq < -19.5 dB
* 1 -19.5 dB <= rsrq < -19 dB
* 2 -19 dB <= rsrq < -18.5 dB
Expand Down Expand Up @@ -1062,9 +1090,24 @@ static bool _parseSignalQuality( char * pQcsqPayload,

/* The cesq payload format is <rxlev>,<ber>,<rscp>,<ecno>,<rsrq>,<rsrp>. */

/* Skip rxlev. */
/* rxlev. */
atCoreStatus = Cellular_ATGetNextTok( &pTmpQcsqPayload, &pToken );

if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );

if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
pSignalInfo->rssi = convertCesqSignalRxlev( tempValue );
}
else
{
LogError( ( "_parseSignalQuality: Error in processing RXLEV. Token %s", pToken ) );
parseStatus = false;
}
}

/* ber. */
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
Expand All @@ -1077,7 +1120,9 @@ static bool _parseSignalQuality( char * pQcsqPayload,

if( ( atCoreStatus == CELLULAR_AT_SUCCESS ) && ( tempValue <= INT16_MAX ) && ( tempValue >= INT16_MIN ) )
{
cellularStatus = _Cellular_ConvertCsqSignalRssi( ( int16_t ) tempValue, &berValue );
/* As RXQUAL values in the table in 3GPP TS 45.008 [20] subclause 8.2.4.
* The CESQ ber signal value has the same scale with the AT+CSQ ber signal value. */
cellularStatus = _Cellular_ConvertCsqSignalBer( ( int16_t ) tempValue, &berValue );

if( cellularStatus == CELLULAR_SUCCESS )
{
Expand Down Expand Up @@ -1123,7 +1168,7 @@ static bool _parseSignalQuality( char * pQcsqPayload,
}
else
{
LogError( ( "_parseSignalQuality: Error in processing RSRP. Token %s", pToken ) );
LogError( ( "_parseSignalQuality: Error in processing RSRQ. Token %s", pToken ) );
parseStatus = false;
}
}
Expand Down