From e6aba4fe6373de1190a223caba6c803b14acdb35 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sun, 27 Jan 2019 21:02:37 +0100 Subject: [PATCH] IF482 minor fixes --- src/if482.cpp | 6 +++--- src/main.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/if482.cpp b/src/if482.cpp index b1bc7efb..76e59755 100644 --- a/src/if482.cpp +++ b/src/if482.cpp @@ -130,7 +130,7 @@ void if482_loop(void *pvParameters) { tt = now(); } while (t == tt); - const TickType_t startTime = xTaskGetTickCount(); + const TickType_t startOffset = xTaskGetTickCount(); // task remains in blocked state until it is notified by isr for (;;) { @@ -141,12 +141,12 @@ void if482_loop(void *pvParameters) { portMAX_DELAY); // wait forever (missing error handling here...) t = now(); - wakeTime -= startTime; + wakeTime -= startOffset; // now we're synced to start of second t and wait // until it's time to start transmit telegram for t+1 vTaskDelayUntil(&wakeTime, shotTime); - IF482.print(if482Telegram(t + 1)); + IF482.print(if482Telegram(t+1)); } vTaskDelete(IF482Task); // shoud never be reached } // if482_loop() diff --git a/src/main.cpp b/src/main.cpp index 34940bf8..5c6cf814 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -414,7 +414,8 @@ void setup() { // start RTC interrupt #if defined HAS_IF482 && defined HAS_RTC // setup external interupt for active low RTC INT pin - attachInterrupt(digitalPinToInterrupt(RTC_INT), IF482IRQ, FALLING); + if (IF482IRQ != NULL) // has if482loop task started? + attachInterrupt(digitalPinToInterrupt(RTC_INT), IF482IRQ, FALLING); #endif } // setup()