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.
This commit is contained in:
Matt Corallo 2019-09-26 22:22:05 +00:00 committed by GitHub
parent 1275c5876d
commit 30a07a32ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,7 +144,7 @@ void receiveCallback(int packet_size) {
// recieved packet to the host. // recieved packet to the host.
Serial.write(FEND); Serial.write(FEND);
Serial.write(CMD_STAT_RSSI); Serial.write(CMD_STAT_RSSI);
Serial.write((uint8_t)(last_rssi-rssi_offset)); Serial.write((uint8_t)(last_rssi+rssi_offset));
Serial.write(FEND); Serial.write(FEND);
// And then write the entire packet // And then write the entire packet
@ -170,7 +170,7 @@ void receiveCallback(int packet_size) {
// recieved packet to the host. // recieved packet to the host.
Serial.write(FEND); Serial.write(FEND);
Serial.write(CMD_STAT_RSSI); Serial.write(CMD_STAT_RSSI);
Serial.write((uint8_t)(last_rssi-rssi_offset)); Serial.write((uint8_t)(last_rssi+rssi_offset));
Serial.write(FEND); Serial.write(FEND);
// And then write the entire packet // And then write the entire packet