Skip to content

attaching an InterruptWakeup before and after deepSleep breaks RTCZero::getEpoch #58

Open
@usbpc

Description

@usbpc

I tested the following code on an MKR 1310:

#include <RTCZero.h>
#include <ArduinoLowPower.h>

void noop() {}

void setup() {
    Serial1.begin(115200);
    RTCZero rtc;
    rtc.begin();
    LowPower.attachInterruptWakeup(LORA_IRQ, noop, RISING);
    LowPower.deepSleep(1000);
    LowPower.attachInterruptWakeup(LORA_IRQ, noop, RISING);
    Serial1.println("This gets printed!");
    Serial1.println(rtc.getEpoch());
    Serial1.println("This never gets printed!");
}

void loop() {}

The first Serial1.println works and I get the message. But then reading the Epoch just results in an Endless Loop right here: https://github.com/arduino-libraries/RTCZero/blob/master/src/RTCZero.cpp#L488

So neither the Epoch nor the last Serial1.println get transmitted over Serial.

The code is just a minimal example of something that works around another problem where another library is overwriting the wakeup interrupt handler with a wrong one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions