From f00397929baf15083a1aba2846e9ce03c32b4c64 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Wed, 26 Feb 2020 00:40:09 +0100 Subject: [PATCH] enhanced Lora runtime parameter display --- src/display.cpp | 31 ++++++++++++++++++++++++++++--- src/lorawan.cpp | 2 +- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 9c986f99..10ea61d1 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -39,7 +39,7 @@ FONT_STRETCHED: 16x32px = 8 chars / line // local Tag for logging static const char TAG[] = __FILE__; -#define DISPLAY_PAGES (6) // number of paxcounter display pages +#define DISPLAY_PAGES (7) // number of paxcounter display pages // settings for oled display library #define USE_BACKBUFFER @@ -224,7 +224,8 @@ start: // page 2: GPS // page 3: BME280/680 // page 4: time - // page 5: blank screen + // page 5: lorawan parameters + // page 6: blank screen // page 0: parameters overview case 0: @@ -362,8 +363,32 @@ start: second(t)); break; - // page 5: blank screen + // page 5: lorawan parameters case 5: + +#if (HAS_LORA) + // 3|NtwkID:000000 TXpw:aa + // 4|DevAdd:00000000 DR:0 + // 5|CHMsk:0000 Nonce:0000 + // 6|CUp:000000 CDn:000000 + // 7|SNR:-0000 RSSI:-0000 + dp_printf(0, 3, FONT_SMALL, 0, "NetwID:%06X TXpw:%-2d", + LMIC.netid & 0x001FFFFF, LMIC.radio_txpow); + dp_printf(0, 4, FONT_SMALL, 0, "DevAdd:%08X DR:%1d", LMIC.devaddr, + LMIC.datarate); + dp_printf(0, 5, FONT_SMALL, 0, "ChMsk:%04X Nonce:%04X", LMIC.channelMap, + LMIC.devNonce); + dp_printf(0, 6, FONT_SMALL, 0, "CUp:%-6d CDn:%-6d", LMIC.seqnoUp, + LMIC.seqnoDn); + dp_printf(0, 7, FONT_SMALL, 0, "SNR:%-5d RSSI:%-5d", LMIC.snr / 4, + LMIC.rssi); + break; // page5 +#else // don't show blank page if we are unattended + DisplayPage++; // next page +#endif // HAS_LORA + + // page 6: blank screen + case 6: #ifdef HAS_BUTTON oledFill(0, 1); break; diff --git a/src/lorawan.cpp b/src/lorawan.cpp index 0523152a..e07abacb 100644 --- a/src/lorawan.cpp +++ b/src/lorawan.cpp @@ -98,7 +98,7 @@ void lora_setupForNetwork(bool preJoin) { if (!cfg.adrmode) LMIC_setDrTxpow(assertDR(cfg.loradr), cfg.txpower); // show current devaddr - ESP_LOGI(TAG, "DEVaddr: 0x%08X | Network ID: 0x%03X | Network Type: %d", + ESP_LOGI(TAG, "DEVaddr: 0x%08X | Network ID: 0x%06X | Network Type: %d", LMIC.devaddr, LMIC.netid & 0x001FFFFF, LMIC.netid & 0x00E00000); ESP_LOGI(TAG, "RSSI: %d | SNR: %d", LMIC.rssi, LMIC.snr / 4); ESP_LOGI(TAG, "Radio parameters: %s | %s | %s",