From f6864b19731e240e83c8532323293e46f5e1a1e6 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Tue, 17 Apr 2018 19:28:58 +0200 Subject: [PATCH] state machine (part 4) --- src/main.cpp | 11 ++++------- src/main.h | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 788ee74b..1da702c7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -385,7 +385,7 @@ uint64_t uptime() { } void updateDisplay() { - // timed display refresh according to frames per second setting + // timed display refresh according to refresh cycle setting if (currentMillis - previousDisplaymillis >= DISPLAYREFRESH_MS) { refreshDisplay(); previousDisplaymillis += DISPLAYREFRESH_MS; @@ -580,10 +580,9 @@ do_send(&sendjob); void loop() { uptimecounter = uptime() / 1000; // counts uptime in seconds (64bit) - - // state machine for central control of all timimg based features - currentMillis = millis(); // timebase for state machine in milliseconds (32bit) + + // simple state machine for controlling display, LED, button, etc. #ifdef HAS_BUTTON readButton(); @@ -598,9 +597,7 @@ void loop() { refreshLED(); #endif - //sendPayload(); - - + //sendPayload(); } diff --git a/src/main.h b/src/main.h index f077f9e0..cd606adb 100644 --- a/src/main.h +++ b/src/main.h @@ -35,8 +35,8 @@ #define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec. // LoRa payload send cycle -#define SEND_SECS 120 // [seconds/2] -> 240 sec. -//#define SEND_SECS 30 // [seconds/2] -> 60 sec. +//#define SEND_SECS 120 // [seconds/2] -> 240 sec. +#define SEND_SECS 30 // [seconds/2] -> 60 sec. // Default LoRa Spreadfactor #define LORASFDEFAULT 9 // 7 ... 12 SF, according to LoRaWAN specs