mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2024-07-02 14:34:13 +02:00
Merge pull request #62 from jacobeva/master
Fix RSSI miscalculation and TX power cap
This commit is contained in:
commit
55b0f3103f
4
LoRa.cpp
4
LoRa.cpp
@ -775,7 +775,7 @@ int ISR_VECT LoRaClass::packetRssi() {
|
|||||||
// may need more calculations here
|
// may need more calculations here
|
||||||
uint8_t buf[3] = {0};
|
uint8_t buf[3] = {0};
|
||||||
executeOpcodeRead(OP_PACKET_STATUS, buf, 3);
|
executeOpcodeRead(OP_PACKET_STATUS, buf, 3);
|
||||||
int pkt_rssi = -(int(buf[2])) / 2;
|
int pkt_rssi = -buf[0] / 2;
|
||||||
return pkt_rssi;
|
return pkt_rssi;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -796,7 +796,7 @@ float ISR_VECT LoRaClass::packetSnr() {
|
|||||||
#elif MODEM == SX1262
|
#elif MODEM == SX1262
|
||||||
uint8_t buf[3] = {0};
|
uint8_t buf[3] = {0};
|
||||||
executeOpcodeRead(OP_PACKET_STATUS, buf, 3);
|
executeOpcodeRead(OP_PACKET_STATUS, buf, 3);
|
||||||
return float(buf[1]) / 4.0;
|
return float(buf[1]) * 0.25;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ void serialCallback(uint8_t sbyte) {
|
|||||||
kiss_indicate_txpower();
|
kiss_indicate_txpower();
|
||||||
} else {
|
} else {
|
||||||
int txp = sbyte;
|
int txp = sbyte;
|
||||||
if (txp > 17) txp = 17;
|
if (txp > 22) txp = 22;
|
||||||
|
|
||||||
lora_txp = txp;
|
lora_txp = txp;
|
||||||
if (op_mode == MODE_HOST) setTXPower();
|
if (op_mode == MODE_HOST) setTXPower();
|
||||||
|
@ -658,7 +658,7 @@ void kiss_indicate_stat_rssi() {
|
|||||||
#if MODEM == SX1276 || MODEM == SX1278
|
#if MODEM == SX1276 || MODEM == SX1278
|
||||||
uint8_t packet_rssi_val = (uint8_t)(last_rssi+rssi_offset);
|
uint8_t packet_rssi_val = (uint8_t)(last_rssi+rssi_offset);
|
||||||
#elif MODEM == SX1262
|
#elif MODEM == SX1262
|
||||||
uint8_t packet_rssi_val = (uint8_t)(last_rssi);
|
int8_t packet_rssi_val = (int8_t)(last_rssi+rssi_offset);
|
||||||
#endif
|
#endif
|
||||||
serial_write(FEND);
|
serial_write(FEND);
|
||||||
serial_write(CMD_STAT_RSSI);
|
serial_write(CMD_STAT_RSSI);
|
||||||
|
Loading…
Reference in New Issue
Block a user