fix SNR display bug

This commit is contained in:
Klaus K Wilting 2020-03-07 13:00:22 +01:00
parent 3bc5d5a13f
commit cf29505c84
2 changed files with 5 additions and 5 deletions

View File

@ -381,7 +381,7 @@ start:
dp_printf(0, 6, FONT_SMALL, 0, "fUp:%-6d fDn:%-6d", dp_printf(0, 6, FONT_SMALL, 0, "fUp:%-6d fDn:%-6d",
LMIC.seqnoUp ? LMIC.seqnoUp - 1 : 0, LMIC.seqnoUp ? LMIC.seqnoUp - 1 : 0,
LMIC.seqnoDn ? LMIC.seqnoDn - 1 : 0); LMIC.seqnoDn ? LMIC.seqnoDn - 1 : 0);
dp_printf(0, 7, FONT_SMALL, 0, "SNR:%-5d RSSI:%-5d", LMIC.snr / 4, dp_printf(0, 7, FONT_SMALL, 0, "SNR:%-5d RSSI:%-5d", (LMIC.snr + 2) / 4,
LMIC.rssi); LMIC.rssi);
break; // page5 break; // page5
#else // don't show blank page if we are unattended #else // don't show blank page if we are unattended

View File

@ -77,7 +77,7 @@ void lora_setupForNetwork(bool preJoin) {
// show current devaddr // show current devaddr
ESP_LOGI(TAG, "DEVaddr: 0x%08X | Network ID: 0x%06X | Network Type: %d", ESP_LOGI(TAG, "DEVaddr: 0x%08X | Network ID: 0x%06X | Network Type: %d",
LMIC.devaddr, LMIC.netid & 0x001FFFFF, LMIC.netid & 0x00E00000); LMIC.devaddr, LMIC.netid & 0x001FFFFF, LMIC.netid & 0x00E00000);
ESP_LOGI(TAG, "RSSI: %d | SNR: %d", LMIC.rssi, LMIC.snr / 4); ESP_LOGI(TAG, "RSSI: %d | SNR: %d", LMIC.rssi, (LMIC.snr + 2) / 4);
ESP_LOGI(TAG, "Radio parameters: %s | %s | %s", ESP_LOGI(TAG, "Radio parameters: %s | %s | %s",
getSfName(updr2rps(LMIC.datarate)), getSfName(updr2rps(LMIC.datarate)),
getBwName(updr2rps(LMIC.datarate)), getBwName(updr2rps(LMIC.datarate)),
@ -560,7 +560,7 @@ void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, bool is_down) {
const mac_t *p; const mac_t *p;
p = is_down ? MACdn_table : MACup_table; p = is_down ? MACdn_table : MACup_table;
const int tablesize = is_down ? MACdn_tSize : MACup_tSize; const int tablesize = is_down ? MACdn_tSize : MACup_tSize;
const String MACdir = is_down ? "DN" : "UP"; const String MACdir = is_down ? "-->" : "<--";
while (cursor < cmdlen) { while (cursor < cmdlen) {
@ -577,8 +577,8 @@ void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, bool is_down) {
cursor += (p + i)->params; cursor += (p + i)->params;
ESP_LOGD(TAG, "%s MAC command %s", MACdir, (p + i)->cmdname); ESP_LOGD(TAG, "%s MAC command %s", MACdir, (p + i)->cmdname);
} else } else
ESP_LOGD(TAG, "%s MAC command 0x%02X with missing parameter(s)", MACdir, ESP_LOGD(TAG, "%s MAC command 0x%02X with missing parameter(s)",
(p + i)->cid); MACdir, (p + i)->cid);
break; // command found -> exit table lookup loop break; // command found -> exit table lookup loop
} // end of command validation } // end of command validation
} // end of command table lookup loop } // end of command table lookup loop