Improve the compatibility layer

When the V1 plugin API is enabled, we need to override `onSetup`, to not call
`setup()` twice: once via the v2 default `onSetup`, and once via the legacy API.
Take special attention to call `LEDControl.mode_add`, so that the effect does
register as a LED mode.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/365/head
Gergely Nagy 6 years ago
parent 30bbd49058
commit f2bca33a7c

@ -29,6 +29,15 @@ class AlphaSquareEffect : public LEDMode {
static uint16_t length;
EventHandlerResult onKeyswitchEvent(Key &mappedKey, byte row, byte col, uint8_t keyState);
#if KALEIDOSCOPE_ENABLE_V1_PLUGIN_API
kaleidoscope::EventHandlerResult onSetup() {
::LEDControl.mode_add(this);
return kaleidoscope::EventHandlerResult::OK;
}
#endif
protected:
void update(void) final;

Loading…
Cancel
Save