main.cpp: moved LED control to loop()

This commit is contained in:
Klaus K Wilting 2018-09-22 13:43:12 +02:00
parent e553dc70a2
commit 8e2ace3adf

View File

@ -300,9 +300,9 @@ void setup() {
==================================================================== ====================================================================
IDLE 0 0 ESP32 arduino scheduler IDLE 0 0 ESP32 arduino scheduler
gpsloop 0 2 read data from GPS over serial or i2c gpsloop 0 2 read data from GPS over serial or i2c
IDLE 1 0 Arduino loop() -> unused IDLE 1 0 Arduino loop() -> used for LED switching
loraloop 1 1 runs the LMIC stack loraloop 1 1 runs the LMIC stack
statemachine 1 3 switches process logic statemachine 1 3 switches application process logic
*/ */
@ -352,10 +352,6 @@ void stateMachine(void *pvParameters) {
while (1) { while (1) {
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
led_loop();
#endif
#ifdef HAS_BUTTON #ifdef HAS_BUTTON
readButton(); readButton();
#endif #endif
@ -375,9 +371,19 @@ void stateMachine(void *pvParameters) {
// check send cycle and if due enqueue payload to send // check send cycle and if due enqueue payload to send
if (SendCycleTimerIRQ) if (SendCycleTimerIRQ)
sendPayload(); sendPayload();
// yield to CPU
// give yield to CPU
vTaskDelay(2 / portTICK_PERIOD_MS); vTaskDelay(2 / portTICK_PERIOD_MS);
} }
} }
void loop() { vTaskDelay(2 / portTICK_PERIOD_MS); } void loop() {
// switch LED states if device has a LED
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
led_loop();
#endif
// give yield to CPU
vTaskDelay(2 / portTICK_PERIOD_MS);
}