From f411d4d446fab95b4e0030c3af8598857cccfd6f Mon Sep 17 00:00:00 2001 From: Pieter de Rijk Date: Thu, 14 Jan 2021 15:08:37 +0100 Subject: [PATCH 1/4] Generic User Experience improvements - Avoid conflicting messages on joining versus joined TTN - Enabled boot logo if ALWAYS_SHOW_LOGO is set - Avoid accidentally pressing second button too long to discard network prefs. Set PREFS_DISCARD to enable --- main/configuration.h | 12 +++++++++--- main/main.ino | 25 +++++++++++++++++++++---- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/main/configuration.h b/main/configuration.h index e15177a..921373c 100644 --- a/main/configuration.h +++ b/main/configuration.h @@ -33,15 +33,15 @@ void ttn_register(void (*callback)(uint8_t message)); // ----------------------------------------------------------------------------- #define APP_NAME "TTN MAP-TRACK" -#define APP_VERSION "1.2.0" +#define APP_VERSION "1.2.1" // ----------------------------------------------------------------------------- // Configuration // ----------------------------------------------------------------------------- // Select which T-Beam board is being used. Only uncomment one. -// #define T_BEAM_V07 // AKA Rev0 (first board released) -#define T_BEAM_V10 // AKA Rev1 (second board released) +#define T_BEAM_V07 // AKA Rev0 (first board released) +// #define T_BEAM_V10 // AKA Rev1 (second board released) // Select the payload format. Change on TTN as well. Only uncomment one. #define PAYLOAD_USE_FULL @@ -50,6 +50,12 @@ void ttn_register(void (*callback)(uint8_t message)); // If using a single-channel gateway, uncomment this next option and set to your gateway's channel //#define SINGLE_CHANNEL_GATEWAY 0 +//Uncomment if you always want to see the boot logo at boot time +#define ALWAYS_SHOW_LOGO + +//Uncomment to enable discarding network settings by long pressing second button +//#define PREFS_DISCARD + // If you are having difficulty sending messages to TTN after the first successful send, // uncomment the next option and experiment with values (~ 1 - 5) //#define CLOCK_ERROR 5 diff --git a/main/main.ino b/main/main.ino index 03a8166..72cb728 100644 --- a/main/main.ino +++ b/main/main.ino @@ -152,9 +152,16 @@ void sleep() { void callback(uint8_t message) { - if (EV_JOINING == message) screen_print("Joining TTN...\n"); + bool ttn_joined = false; if (EV_JOINED == message) { - screen_print("TTN joined!\n"); + ttn_joined = true; + } + if (EV_JOINING == message) { + if (ttn_joined) { + screen_print("TTN joining...\n"); + } else { + screen_print("Joined TTN!\n"); + } } if (EV_JOIN_FAILED == message) screen_print("TTN join failed\n"); if (EV_REJOIN_FAILED == message) screen_print("TTN rejoin failed\n"); @@ -334,12 +341,17 @@ void setup() { gps_setup(); // Show logo on first boot after removing battery + +#ifndef ALWAYS_SHOW_LOGO if (bootCount == 0) { +#endif screen_print(APP_NAME " " APP_VERSION, 0, 0); screen_show_logo(); screen_update(); delay(LOGO_DELAY); - } + #ifndef ALWAYS_SHOW_LOGO + } +#endif // TTN setup if (!ttn_setup()) { @@ -382,10 +394,15 @@ void loop() { wasPressed = false; if(millis() > minPressMs) { // held long enough - screen_print("Erasing prefs"); +#ifndef PREFS_DISCARD + screen_print("Discarding prefs disabled\n"); +#endif +#ifdef PREFS_DISCARD + screen_print("Discarding prefs!\n"); ttn_erase_prefs(); delay(5000); // Give some time to read the screen ESP.restart(); +#endif } } From 2677322c98eef99d5a72298207a0a8b7256a41f8 Mon Sep 17 00:00:00 2001 From: Pieter de Rijk Date: Wed, 20 Jan 2021 11:37:25 +0100 Subject: [PATCH 2/4] Added guidance lsb in the description for new users --- main/credentials.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/credentials.h b/main/credentials.h index b8ddc7d..92270b9 100644 --- a/main/credentials.h +++ b/main/credentials.h @@ -24,17 +24,17 @@ Credentials file #ifdef USE_OTAA - // This EUI must be in little-endian format, so least-significant-byte + // This EUI must be in little-endian format, so least-significant-byte (lsb) // first. When copying an EUI from ttnctl output, this means to reverse // the bytes. For TTN issued EUIs the last bytes should be 0x00, 0x00, // 0x00. static const u1_t PROGMEM APPEUI[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - // This should also be in little endian format, see above. + // This should also be in little endian format (lsb), see above. // Note: You do not need to set this field, if unset it will be generated automatically based on the device macaddr static u1_t DEVEUI[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - // This key should be in big endian format (or, since it is not really a + // This key should be in big endian format (msb) (or, since it is not really a // number but a block of memory, endianness does not really apply). In // practice, a key taken from ttnctl can be copied as-is. // The key shown here is the semtech default key. From be9181102223530c7bc5defa6905fac2cd8d4f01 Mon Sep 17 00:00:00 2001 From: Pieter de Rijk Date: Sat, 23 Jan 2021 12:27:32 +0100 Subject: [PATCH 3/4] Update main.ino The variable 'count' doesn't exist, should use ttn_get_count() instead. --- main/main.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/main.ino b/main/main.ino index 72cb728..4da1d08 100644 --- a/main/main.ino +++ b/main/main.ino @@ -74,7 +74,8 @@ bool trySend() { buildPacket(txBuffer); #if LORAWAN_CONFIRMED_EVERY > 0 - bool confirmed = (count % LORAWAN_CONFIRMED_EVERY == 0); + bool confirmed = (ttn_get_count() % LORAWAN_CONFIRMED_EVERY == 0); + if (confirmed){ Serial.println("confirmation enabled"); } #else bool confirmed = false; #endif From 1e1ccce95abb8d0408d578f063b104e386fc9f03 Mon Sep 17 00:00:00 2001 From: Pieter de Rijk Date: Sat, 23 Jan 2021 12:29:06 +0100 Subject: [PATCH 4/4] Update README.md Updated the version number --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 69274b1..fe793f5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## TTGO T-Beam Tracker for The Things Network -Current version: 1.2.0 +Current version: 1.2.1 Uploads GPS data from the TTGO T-Beam to [The Things Network](https://www.thethingsnetwork.org) (TTN) and [TTN Mapper](https://ttnmapper.org) for tracking and determining signal strength of LoRaWAN gateways and nodes.