From 47fd909c7cebe9bda2a60c9283477a90a837d07e Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 8 Apr 2022 10:07:45 +1000 Subject: [PATCH 1/2] Allow setTxIndicatorsOn to be used without USE_SERIAL defined. --- src/LMIC-node.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/LMIC-node.h b/src/LMIC-node.h index 2df13e0..1d6fee4 100644 --- a/src/LMIC-node.h +++ b/src/LMIC-node.h @@ -224,8 +224,11 @@ enum class ActivationMode {OTAA, ABP}; printer.println(); } } + +#endif // USE_SERIAL || USE_DISPLAY +#if defined(USE_LED) || defined(USE_DISPLAY) void setTxIndicatorsOn(bool on = true) { if (on) @@ -247,8 +250,7 @@ enum class ActivationMode {OTAA, ABP}; #endif } } - -#endif // USE_SERIAL || USE_DISPLAY +#endif // USE_LED || USE_DISPLAY #ifdef USE_DISPLAY From 2c2ec3576fcefadcdbd366957fe76d10a6ac50e0 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 12 Apr 2022 13:24:26 +1000 Subject: [PATCH 2/2] setup() only schedules doWorkCallback for ABP activation. --- src/LMIC-node.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/LMIC-node.cpp b/src/LMIC-node.cpp index b60d3a0..5056176 100644 --- a/src/LMIC-node.cpp +++ b/src/LMIC-node.cpp @@ -858,8 +858,16 @@ void setup() LMIC_startJoining(); } - // Schedule initial doWork job for immediate execution. - os_setCallback(&doWorkJob, doWorkCallback); + #ifdef ABP_ACTIVATION + // Schedule initial doWork job for immediate execution. + // + // This is not done for OTAA activation because the job + // will be run before the join completes, but can't send + // an uplink, assuming it takes less than about 6 seconds + // to run. The EV_JOINED event already schedules the job + // to run immediately after it. + os_setCallback(&doWorkJob, doWorkCallback); + #endif }