The primary motivation is to only render the screen when needed (needed to port to Watchy / E-Ink displays). Turns out, when we start providing more features in the app-class (like callbacks, metadata, "events") we can even add more unified features (button-handling, animations, overlay-menus)!
Here a simple draft of the new app-class:
class OswHal;
class OswAppV2 {
public:
virtual const char* getAppId() = 0;
virtual const char* getAppName() = 0;
virtual ???& getAppIcon() = 0;
// TODO all those ↓ must update hal-reference
virtual void onStart();
virtual void onLoop();
virtual void onDraw();
virtual void onStop();
virtual void onButton(void id, bool down, bool shortPress, bool longPress);
#ifdef OSW_EMULATOR
virtual void onLoopDebug() {}; // By default no debug loop (GUI) is implemented
#endif
protected:
OswHal* hal = nullptr; // You guys are needing that anyways (but you often cache incorrectly), so it is now given to you <3
bool needsRedraw = false;
};
More stuff:
[x] implement base class
[x] flags (keep-awake, no overlay / force-overlay)
[x] compatibility for app v2 to wrap app v1
[x] think about @RuffaloLavoisier idea for multi-button menus (and their integration here) -> they should be part of the tutorial anyways
[x] port / wrap legacy (v1) apps
[x] design icons? code-based icons vs PROGMEM icons?
[x] setting the default watchface does not seem to work on the real hardware -> the event Button event for app osw.wf.fit: id? 2 up? 1 state? 2 is missing - only Button event for app osw.wf.fit: id? 2 up? 0 state? 2 is being reported.
[x] OswAppV2Compat allow for keeping the screen on (by default?) -> set that also properly inside the main.cpp for the old apps
The primary motivation is to only render the screen when needed (needed to port to Watchy / E-Ink displays). Turns out, when we start providing more features in the app-class (like callbacks, metadata, "events") we can even add more unified features (button-handling, animations, overlay-menus)!
Here a simple draft of the new app-class:
More stuff:
PROGMEM
icons?Button event for app osw.wf.fit: id? 2 up? 1 state? 2
is missing - onlyButton event for app osw.wf.fit: id? 2 up? 0 state? 2
is being reported.OswAppV2Compat
allow for keeping the screen on (by default?) -> set that also properly inside themain.cpp
for the old apps