IF482 minor fixes

This commit is contained in:
Klaus K Wilting 2019-01-27 21:02:37 +01:00
parent ddc7abe90d
commit e6aba4fe63
2 changed files with 5 additions and 4 deletions

View File

@ -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()

View File

@ -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()