stm32duino / STM32LowPower

Arduino Low Power library for STM32
179 stars 53 forks source link

Serial wakeup with time #111

Closed geologic closed 3 weeks ago

geologic commented 3 weeks ago

Hi

I have a project on a custom STM32L0 board where i want to deepsleep and be able to wake up by serial. I uploaded the SerialDeepSleep example and it works as expected.

Since i want a led hartbeat i just changed this line to

LowPower.deepSleep(3000);

I was expecting the same behavior as before, but now i see every 3 seconds:

Start deep sleep wakeup from Serial
1 wake up

2 wake up

3 wake up

4 wake up

5 wake up

So, it seems with timed deepsleep, when timeout occurs, the SerialWakeup() is called even i don´t send anything on serial. Is this normal or a bug?

Thanks

fpistm commented 3 weeks ago

This is normal, you ask to wake up each 3 second. So the sketch do the print each wakeup. The serial callback is called unconditionally, up to you to check the wakeup source. Example check if Serial data is available before incrementing the counter. Anyway couter value is correct as a wakup is occured.

Please next time avoid t open an issue as stated when you click "New issue": image