From 9d2483d831183f2601722a6cfacbfdcabdbc3185 Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 30 Sep 2022 18:42:17 +0100 Subject: make color-picker compile with latest Kaleidoscope --- color-picker.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/color-picker.h b/color-picker.h index 2f44af3..87ddaae 100644 --- a/color-picker.h +++ b/color-picker.h @@ -42,27 +42,27 @@ public: } } - kaleidoscope::EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t key_state) { + kaleidoscope::EventHandlerResult onKeyswitchEvent(KeyEvent &event) { if (!Kaleidoscope.has_leds || !is_active()) return kaleidoscope::EventHandlerResult::OK; // only care at press time - if (!keyToggledOn(key_state)) + if (!keyToggledOn(event.state)) return kaleidoscope::EventHandlerResult::EVENT_CONSUMED; // uh? - if (row >= ROWS || col >= COLS) + if (event.addr.row() >= kaleidoscope_internal::device.matrix_rows || event.addr.col() >= kaleidoscope_internal::device.matrix_columns) return kaleidoscope::EventHandlerResult::EVENT_CONSUMED; // pressing a Fn makes that half the "editing" half; pressing it // again disables editing - picker_key key = whichKey(row,col); + picker_key key = whichKey(event.addr.row(),event.addr.col()); switch (key) { case OFF: break; case SHOW: - map[row][col] = current_index; break; + map[event.addr.row()][event.addr.col()] = current_index; break; case SWITCH_LEFT: which_half = which_half == RIGHT_HALF ? BOTH_HALVES : RIGHT_HALF; break; case SWITCH_RIGHT: @@ -112,8 +112,8 @@ public: Focus.send(F("color"),i,colors[i],Focus.NEWLINE); } Focus.send(F("map\n")); - for (uint8_t r=0;r