Badger 2350: Flag to know if the app has been freshly started from the OS/menu?

This is the app I’m currently developing. It gets temperature/humidity values from a backend service via bluetooth and display it on the badger screen.

It goes like this in pseudo code:

  • load state
  • fetch new data from bluetooth → takes a few secs
  • if the new data is very different from what’s in the state
    • store it in the state
    • refresh the display
  • store the state
  • set the alarm in 5 mins
  • sleep waiting for the alarm or a button

It works fine when running. But when I start the app from the OS/menu. If the new data doesn’t trigger a refresh, one can think the app didn’t start at all, which is super annoying.

When starting, I’d like the display to be refreshed only, no bluetooth connection, no fetching data. I looked into the API, but I couldn’t find anything that would tell me the app was just freshly started from the OS/menu.

Any idea?

I still don’t know how to do it. But I’ve found a workaround. I can know if the badger was woken up by an alarm (what I do in the last step) with:

woken_by_alarm = badge.wake_reason() == powman.WAKE_RTC

This is not in the official documentation yet. Hope this info can be helpful for other people too!