From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Thu, 26 Sep 2019 22:22:05 +0000 (+0000) Subject: Fix RSSI offset for pre-msg RSSI notification X-Git-Url: https://git.tnoah.ca/?a=commitdiff_plain;h=30a07a32cecd324c03c04896a63b560cb29d93ca;p=lora-radio.git Fix RSSI offset for pre-msg RSSI notification last_rssi is a large negative number, with rssi_offset being +292, intended to be added to put the value inside the range of a single byte uint. Before sending the data message, a RSSI message is automatically sent, which is quite nice, but the value ends up overflowing the 8-bit uint, giving a bogus value. --- diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index 4928529..6bf3bfb 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -144,7 +144,7 @@ void receiveCallback(int packet_size) { // recieved packet to the host. Serial.write(FEND); Serial.write(CMD_STAT_RSSI); - Serial.write((uint8_t)(last_rssi-rssi_offset)); + Serial.write((uint8_t)(last_rssi+rssi_offset)); Serial.write(FEND); // And then write the entire packet @@ -170,7 +170,7 @@ void receiveCallback(int packet_size) { // recieved packet to the host. Serial.write(FEND); Serial.write(CMD_STAT_RSSI); - Serial.write((uint8_t)(last_rssi-rssi_offset)); + Serial.write((uint8_t)(last_rssi+rssi_offset)); Serial.write(FEND); // And then write the entire packet