From c7e014fb387ee91ce0950224593972c817f15955 Mon Sep 17 00:00:00 2001 From: Kyle Gabriel Date: Wed, 28 Aug 2019 20:10:32 -0400 Subject: [PATCH] Add CLOCK_ERROR option to enable/disable feature (#4) --- main/configuration.h | 4 ++++ main/ttn.ino | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/main/configuration.h b/main/configuration.h index 67c46bd..e02a60f 100644 --- a/main/configuration.h +++ b/main/configuration.h @@ -50,6 +50,10 @@ 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 +// 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 + #define DEBUG_PORT Serial // Serial debug port #define SERIAL_BAUD 115200 // Serial debug baud rate #define SLEEP_BETWEEN_MESSAGES 0 // Do sleep between messages diff --git a/main/ttn.ino b/main/ttn.ino index 7d02b34..47f302d 100644 --- a/main/ttn.ino +++ b/main/ttn.ino @@ -143,7 +143,10 @@ bool ttn_setup() { void ttn_join() { // Reset the MAC state. Session and pending data transfers will be discarded. LMIC_reset(); - LMIC_setClockError(MAX_CLOCK_ERROR * 5 / 100); + + #ifdef CLOCK_ERROR + LMIC_setClockError(MAX_CLOCK_ERROR * CLOCK_ERROR / 100); + #endif #if defined(USE_ABP)