state machine (part 4)

This commit is contained in:
Klaus K Wilting 2018-04-17 19:28:58 +02:00
parent cbca740792
commit f6864b1973
2 changed files with 6 additions and 9 deletions

View File

@ -385,7 +385,7 @@ uint64_t uptime() {
} }
void updateDisplay() { void updateDisplay() {
// timed display refresh according to frames per second setting // timed display refresh according to refresh cycle setting
if (currentMillis - previousDisplaymillis >= DISPLAYREFRESH_MS) { if (currentMillis - previousDisplaymillis >= DISPLAYREFRESH_MS) {
refreshDisplay(); refreshDisplay();
previousDisplaymillis += DISPLAYREFRESH_MS; previousDisplaymillis += DISPLAYREFRESH_MS;
@ -580,11 +580,10 @@ do_send(&sendjob);
void loop() { void loop() {
uptimecounter = uptime() / 1000; // counts uptime in seconds (64bit) 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) currentMillis = millis(); // timebase for state machine in milliseconds (32bit)
// simple state machine for controlling display, LED, button, etc.
#ifdef HAS_BUTTON #ifdef HAS_BUTTON
readButton(); readButton();
#endif #endif
@ -600,8 +599,6 @@ void loop() {
//sendPayload(); //sendPayload();
} }
/* end Aruino LOOP ------------------------------------------------------------ */ /* end Aruino LOOP ------------------------------------------------------------ */

View File

@ -35,8 +35,8 @@
#define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec. #define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec.
// LoRa payload send cycle // LoRa payload send cycle
#define SEND_SECS 120 // [seconds/2] -> 240 sec. //#define SEND_SECS 120 // [seconds/2] -> 240 sec.
//#define SEND_SECS 30 // [seconds/2] -> 60 sec. #define SEND_SECS 30 // [seconds/2] -> 60 sec.
// Default LoRa Spreadfactor // Default LoRa Spreadfactor
#define LORASFDEFAULT 9 // 7 ... 12 SF, according to LoRaWAN specs #define LORASFDEFAULT 9 // 7 ... 12 SF, according to LoRaWAN specs