The function int blecm_ReadRSSI(void) returns a signed integer value. You can directly print the RSSI value using this function.
rssi_val = blecm_ReadRSSI();
ble_trace1("RSSI = %d", rssi_val);
Note that 127 is an error code, i.e. if you receive 127, then print error.
I ask this question because I use RSSI filter:
For exemple, If I fix rssiLevelLimit to -50 dBm. this valu is a INT8 (-50dBm = 0xCE)
UINT8 valrssiRx = (blecm_ReadRSSI() & 0x000000ff);
I check if ( valrssiRx >rssiLevelLimit && valrssiRx >= 0x80). // valrssiRx <0 and not far of the limit
If true I accept notification (for example)
In my application, the valu rssiLevelLimit can be change by the user and I would like to now if blecm_ReadRSSI() return valu beetween [0;127]. If is the case I nedd to change my condition to accept positive valu.
I undestand that 127 is an error code.
Is it possible to have reception <-128 dBm ? In this case I need to use INT16 in my application.
I hope I have been understandable
1 of 1 people found this helpful
In practical scenario, you can get RSSI between -90 to 0. Device cannot detect the signal beyond these values.
However you can give a try and check for the positive values.