]> git.tnoah.ca Git - lora-radio.git/commitdiff
Fix RSSI offset for pre-msg RSSI notification
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Thu, 26 Sep 2019 22:22:05 +0000 (22:22 +0000)
committerGitHub <noreply@github.com>
Thu, 26 Sep 2019 22:22:05 +0000 (22:22 +0000)
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.

RNode_Firmware.ino

index 4928529049dcd4ab2d7150e6a36a6223d1051ff8..6bf3bfbf97ec7cece835fb35760518a1577ffb77 100644 (file)
@@ -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