diff --git a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.cpp b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.cpp index f627eb28..24278285 100644 --- a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.cpp +++ b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.cpp @@ -29,25 +29,6 @@ namespace kaleidoscope { namespace plugin { -// ============================================================================= -// AutoShift static class variables - -// Configuration settings that can be saved to persistent storage. -AutoShift::Settings AutoShift::settings_ = { - .enabled = true, - .timeout = 175, - .enabled_categories = AutoShift::Categories::printableKeys(), -}; - -// The event tracker ensures that the `onKeyswitchEvent()` handler will follow -// the rules in order to avoid interference with other plugins and prevent -// processing the same event more than once. -KeyEventTracker AutoShift::event_tracker_; - -// If there's a delayed keypress from AutoShift, this stored event will contain -// a valid `KeyAddr`. The default constructor produces an event addr of -// `KeyAddr::none()`, so the plugin will start in an inactive state. -KeyEvent pending_event_; // ============================================================================= // AutoShift functions diff --git a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.h b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.h index 76929725..7ea1c7bb 100644 --- a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.h +++ b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.h @@ -134,17 +134,17 @@ class AutoShift : public Plugin { // Configuration functions /// Returns `true` if AutoShift is active, `false` otherwise - static bool enabled() { + bool enabled() { return settings_.enabled; } /// Activates the AutoShift plugin (held keys will trigger auto-shift) - static void enable() { + void enable() { settings_.enabled = true; } /// Deactivates the AutoShift plugin (held keys will not trigger auto-shift) - static void disable(); + void disable(); /// Turns AutoShift on if it's off, and vice versa - static void toggle() { + void toggle() { if (settings_.enabled) { disable(); } else { @@ -153,16 +153,16 @@ class AutoShift : public Plugin { } /// Returns the hold time required to trigger auto-shift (in ms) - static uint16_t timeout() { + uint16_t timeout() { return settings_.timeout; } /// Sets the hold time required to trigger auto-shift (in ms) - static void setTimeout(uint16_t new_timeout) { + void setTimeout(uint16_t new_timeout) { settings_.timeout = new_timeout; } /// Returns the set of categories currently eligible for auto-shift - static Categories enabledCategories() { + Categories enabledCategories() { return settings_.enabled_categories; } /// Adds `category` to the set eligible for auto-shift @@ -175,19 +175,19 @@ class AutoShift : public Plugin { /// - `AutoShift::Categories::functionKeys()` /// - `AutoShift::Categories::printableKeys()` /// - `AutoShift::Categories::allKeys()` - static void enable(Categories category) { + void enable(Categories category) { settings_.enabled_categories.add(category); } /// Removes a `Key` category from the set eligible for auto-shift - static void disable(Categories category) { + void disable(Categories category) { settings_.enabled_categories.remove(category); } /// Replaces the list of `Key` categories eligible for auto-shift - static void setEnabled(Categories categories) { + void setEnabled(Categories categories) { settings_.enabled_categories = categories; } /// Returns `true` if the given category is eligible for auto-shift - static bool isEnabled(Categories category) { + bool isEnabled(Categories category) { return settings_.enabled_categories.contains(category); } @@ -225,7 +225,7 @@ class AutoShift : public Plugin { /// /// This function can be overridden by the user sketch to configure which keys /// can trigger auto-shift. - static bool isAutoShiftable(Key key); + bool isAutoShiftable(Key key); // --------------------------------------------------------------------------- // Event handlers @@ -237,19 +237,19 @@ class AutoShift : public Plugin { /// A container for AutoShift configuration settings struct Settings { /// The overall state of the plugin (on/off) - bool enabled; + bool enabled = true; /// The length of time (ms) a key must be held to trigger auto-shift - uint16_t timeout; + uint16_t timeout = 175; /// The set of `Key` categories eligible to be auto-shifted - Categories enabled_categories; + Categories enabled_categories = AutoShift::Categories::printableKeys(); }; - static Settings settings_; + Settings settings_; // --------------------------------------------------------------------------- // Key event queue state variables // A device for processing only new events - static KeyEventTracker event_tracker_; + KeyEventTracker event_tracker_; // The maximum number of events in the queue at a time. static constexpr uint8_t queue_capacity_{4}; @@ -257,12 +257,17 @@ class AutoShift : public Plugin { // The event queue stores a series of press and release events. KeyAddrEventQueue queue_; + // If there's a delayed keypress from AutoShift, this stored event will + // contain a valid `KeyAddr`. The default constructor produces an event addr + // of `KeyAddr::none()`, so the plugin will start in an inactive state. + KeyEvent pending_event_; + void flushQueue(); void flushEvent(bool is_long_press = false); bool checkForRelease() const; /// The default function for `isAutoShiftable()` - static bool enabledForKey(Key key); + bool enabledForKey(Key key); }; // ============================================================================= @@ -274,7 +279,7 @@ class AutoShiftConfig : public Plugin { private: // The base address in persistent storage for configuration data - static uint16_t settings_base_; + uint16_t settings_base_; }; } // namespace plugin diff --git a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp index ebf50aad..bf115317 100644 --- a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp +++ b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp @@ -32,20 +32,18 @@ namespace plugin { // ============================================================================= // AutoShift configurator -uint16_t AutoShiftConfig::settings_base_; - EventHandlerResult AutoShiftConfig::onSetup() { - settings_base_ = ::EEPROMSettings.requestSlice(sizeof(AutoShift::settings_)); + settings_base_ = ::EEPROMSettings.requestSlice(sizeof(AutoShift::Settings)); if (Runtime.storage().isSliceUninitialized( settings_base_, - sizeof(AutoShift::settings_))) { + sizeof(AutoShift::Settings))) { // If our slice is uninitialized, set sensible defaults. - Runtime.storage().put(settings_base_, AutoShift::settings_); + Runtime.storage().put(settings_base_, ::AutoShift.settings_); Runtime.storage().commit(); } - Runtime.storage().get(settings_base_, AutoShift::settings_); + Runtime.storage().get(settings_base_, ::AutoShift.settings_); return EventHandlerResult::OK; } @@ -112,7 +110,7 @@ EventHandlerResult AutoShiftConfig::onFocusEvent(const char *command) { break; } - Runtime.storage().put(settings_base_, AutoShift::settings_); + Runtime.storage().put(settings_base_, ::AutoShift.settings_); Runtime.storage().commit(); return EventHandlerResult::EVENT_CONSUMED; } diff --git a/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.cpp b/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.cpp index 1a20ce09..78176d46 100644 --- a/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.cpp +++ b/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.cpp @@ -35,14 +35,6 @@ namespace kaleidoscope { namespace plugin { -// ============================================================================= -// CharShift class variables -CharShift::KeyPair const *CharShift::progmem_keypairs_{nullptr}; -uint8_t CharShift::num_keypairs_{0}; - -bool CharShift::reverse_shift_state_{false}; - - // ============================================================================= // Event handlers diff --git a/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.h b/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.h index 01601d76..d407c2c5 100644 --- a/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.h +++ b/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.h @@ -77,42 +77,42 @@ class CharShift : public Plugin { /// Generally, it will be called via the `KEYPAIRS()` preprocessor macro, not /// directly by user code. template - static void setProgmemKeyPairs(KeyPair const (&keypairs)[_num_keypairs]) { + void setProgmemKeyPairs(KeyPair const (&keypairs)[_num_keypairs]) { progmem_keypairs_ = keypairs; num_keypairs_ = _num_keypairs; } private: // A pointer to an array of `KeyPair` objects in PROGMEM - static KeyPair const *progmem_keypairs_; + KeyPair const *progmem_keypairs_ = nullptr; // The size of the PROGMEM array of `KeyPair` objects - static uint8_t num_keypairs_; + uint8_t num_keypairs_ = 0; // If a `shift` key needs to be suppressed in `beforeReportingState()` - static bool reverse_shift_state_; + bool reverse_shift_state_ = false; /// Test for keys that should be handled by CharShift - static bool isCharShiftKey(Key key); + bool isCharShiftKey(Key key); /// Look up the `KeyPair` specified by the given keymap entry - static KeyPair decodeCharShiftKey(Key key); + KeyPair decodeCharShiftKey(Key key); /// Get the total number of KeyPairs defined /// /// This function can be overridden in order to store the `KeyPair` array in /// EEPROM instead of PROGMEM. - static uint8_t numKeyPairs(); + uint8_t numKeyPairs(); /// Get the `KeyPair` at the specified index from the defined `KeyPair` array /// /// This function can be overridden in order to store the `KeyPair` array in /// EEPROM instead of PROGMEM. - static KeyPair readKeyPair(uint8_t n); + KeyPair readKeyPair(uint8_t n); // Default for `keypairsCount()`: size of the PROGMEM array - static uint8_t numProgmemKeyPairs(); + uint8_t numProgmemKeyPairs(); // Default for `readKeypair(i)`: fetch the value from PROGMEM - static KeyPair readKeyPairFromProgmem(uint8_t n); + KeyPair readKeyPairFromProgmem(uint8_t n); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp index b8a04dc5..0c298f0c 100644 --- a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp +++ b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp @@ -31,11 +31,6 @@ namespace kaleidoscope { namespace plugin { -// --- state --- -Key Cycle::last_non_cycle_key_; -KeyAddr Cycle::cycle_key_addr_{KeyAddr::invalid_state}; -uint8_t Cycle::current_modifier_flags_; -uint8_t Cycle::cycle_count_; // --- helpers --- diff --git a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.h b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.h index 55924a33..f7ba39ab 100644 --- a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.h +++ b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.h @@ -38,18 +38,18 @@ namespace kaleidoscope { namespace plugin { class Cycle : public kaleidoscope::Plugin { public: - static void replace(Key key); - static void replace(uint8_t cycle_size, const Key cycle_steps[]); + void replace(Key key); + void replace(uint8_t cycle_size, const Key cycle_steps[]); EventHandlerResult onNameQuery(); EventHandlerResult onKeyEvent(KeyEvent &event); private: - static uint8_t toModFlag(uint8_t keyCode); - static Key last_non_cycle_key_; - static KeyAddr cycle_key_addr_; - static uint8_t cycle_count_; - static uint8_t current_modifier_flags_; + uint8_t toModFlag(uint8_t keyCode); + Key last_non_cycle_key_; + KeyAddr cycle_key_addr_{KeyAddr::invalid_state}; + uint8_t cycle_count_; + uint8_t current_modifier_flags_; }; } // namespace plugin diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp index 52f5b6d9..d06a56fd 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp @@ -34,12 +34,6 @@ namespace kaleidoscope { namespace plugin { -uint16_t DynamicMacros::storage_base_; -uint16_t DynamicMacros::storage_size_; -uint16_t DynamicMacros::map_[]; -uint8_t DynamicMacros::macro_count_; -Key DynamicMacros::active_macro_keys_[]; - // ============================================================================= // It might be possible to use Macros instead of reproducing it void DynamicMacros::press(Key key) { diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h index 90545294..29e01a9c 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h @@ -42,20 +42,20 @@ class DynamicMacros : public kaleidoscope::Plugin { EventHandlerResult beforeReportingState(const KeyEvent &event); EventHandlerResult onFocusEvent(const char *command); - static void reserve_storage(uint16_t size); + void reserve_storage(uint16_t size); void play(uint8_t seq_id); private: - static uint16_t storage_base_; - static uint16_t storage_size_; - static uint16_t map_[32]; - static uint8_t macro_count_; - static uint8_t updateDynamicMacroCache(); - static Key active_macro_keys_[MAX_CONCURRENT_DYNAMIC_MACRO_KEYS]; - static void press(Key key); - static void release(Key key); - static void tap(Key key); + uint16_t storage_base_; + uint16_t storage_size_; + uint16_t map_[32]; + uint8_t macro_count_; + uint8_t updateDynamicMacroCache(); + Key active_macro_keys_[MAX_CONCURRENT_DYNAMIC_MACRO_KEYS]; + void press(Key key); + void release(Key key); + void tap(Key key); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp index c445aec4..14bd719f 100644 --- a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp +++ b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp @@ -34,13 +34,6 @@ namespace kaleidoscope { namespace plugin { -uint16_t DynamicTapDance::storage_base_; -uint16_t DynamicTapDance::storage_size_; -uint16_t DynamicTapDance::map_[]; -uint8_t DynamicTapDance::offset_; -uint8_t DynamicTapDance::dance_count_; -constexpr uint8_t DynamicTapDance::reserved_tap_dance_key_count_; - void DynamicTapDance::updateDynamicTapDanceCache() { uint16_t pos = storage_base_; uint8_t current_id = 0; diff --git a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h index a4de8be3..86cc1f4c 100644 --- a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h +++ b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h @@ -33,18 +33,18 @@ class DynamicTapDance : public kaleidoscope::Plugin { EventHandlerResult onNameQuery(); EventHandlerResult onFocusEvent(const char *command); - static void setup(uint8_t dynamic_offset, uint16_t size); + void setup(uint8_t dynamic_offset, uint16_t size); - static bool dance(uint8_t tap_dance_index, KeyAddr key_addr, uint8_t tap_count, TapDance::ActionType tap_dance_action); + bool dance(uint8_t tap_dance_index, KeyAddr key_addr, uint8_t tap_count, TapDance::ActionType tap_dance_action); private: - static uint16_t storage_base_; - static uint16_t storage_size_; + uint16_t storage_base_; + uint16_t storage_size_; static constexpr uint8_t reserved_tap_dance_key_count_ = ranges::TD_LAST - ranges::TD_FIRST + 1; - static uint16_t map_[reserved_tap_dance_key_count_]; - static uint8_t dance_count_; - static uint8_t offset_; - static void updateDynamicTapDanceCache(); + uint16_t map_[reserved_tap_dance_key_count_]; + uint8_t dance_count_; + uint8_t offset_; + void updateDynamicTapDanceCache(); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp index 4dc7672f..67504976 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp +++ b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp @@ -33,10 +33,6 @@ namespace kaleidoscope { namespace plugin { -uint16_t EEPROMKeymapProgrammer::update_position_; -EEPROMKeymapProgrammer::state_t EEPROMKeymapProgrammer::state_; -EEPROMKeymapProgrammer::mode_t EEPROMKeymapProgrammer::mode; -Key EEPROMKeymapProgrammer::new_key_; void EEPROMKeymapProgrammer::nextState(void) { switch (state_) { diff --git a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h index 377c5d9a..7d7035ef 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h +++ b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h @@ -32,13 +32,13 @@ class EEPROMKeymapProgrammer : public kaleidoscope::Plugin { CODE, COPY, } mode_t; - static mode_t mode; + mode_t mode; - static void activate(void) { + void activate(void) { nextState(); } - static void nextState(void); - static void cancel(void); + void nextState(void); + void cancel(void); EventHandlerResult onKeyEvent(KeyEvent &event); EventHandlerResult onFocusEvent(const char *command); @@ -50,10 +50,10 @@ class EEPROMKeymapProgrammer : public kaleidoscope::Plugin { WAIT_FOR_CODE, WAIT_FOR_SOURCE_KEY, } state_t; - static state_t state_; + state_t state_; - static uint16_t update_position_; // layer, row, col - static Key new_key_; + uint16_t update_position_; // layer, row, col + Key new_key_; }; } // namespace plugin diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp index 4aed20ce..88684d96 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp @@ -30,11 +30,6 @@ namespace kaleidoscope { namespace plugin { -struct EEPROMSettings::settings EEPROMSettings::settings_; -bool EEPROMSettings::is_valid_; -bool EEPROMSettings::sealed_; -uint16_t EEPROMSettings::next_start_ = sizeof(EEPROMSettings::settings); - EventHandlerResult EEPROMSettings::onSetup() { Runtime.storage().get(0, settings_); diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h index 3c258a73..5c83940c 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h @@ -44,34 +44,34 @@ class EEPROMSettings : public kaleidoscope::Plugin { * fall back to not using it. */ static constexpr uint8_t VERSION_CURRENT = 0x01; - static void update(void); - static bool isValid(void); - static void invalidate(void); - static uint8_t version(void) { + void update(void); + bool isValid(void); + void invalidate(void); + uint8_t version(void) { return settings_.version; } - static uint16_t requestSlice(uint16_t size); - static void seal(void); - static uint16_t crc(void); - static uint16_t used(void); + uint16_t requestSlice(uint16_t size); + void seal(void); + uint16_t crc(void); + uint16_t used(void); - static uint8_t default_layer(uint8_t layer); - static uint8_t default_layer() { + uint8_t default_layer(uint8_t layer); + uint8_t default_layer() { return settings_.default_layer; } - static void ignoreHardcodedLayers(bool value); - static bool ignoreHardcodedLayers() { + void ignoreHardcodedLayers(bool value); + bool ignoreHardcodedLayers() { return settings_.ignore_hardcoded_layers; } private: static constexpr uint8_t IGNORE_HARDCODED_LAYER = 0x7e; - static uint16_t next_start_; - static bool is_valid_; - static bool sealed_; + uint16_t next_start_ = sizeof(EEPROMSettings::settings); + bool is_valid_; + bool sealed_; - static struct settings { + struct settings { uint8_t default_layer : 7; bool ignore_hardcoded_layers : 1; uint8_t version; @@ -81,15 +81,11 @@ class EEPROMSettings : public kaleidoscope::Plugin { class FocusSettingsCommand : public kaleidoscope::Plugin { public: - FocusSettingsCommand() {} - EventHandlerResult onFocusEvent(const char *command); }; class FocusEEPROMCommand : public kaleidoscope::Plugin { public: - FocusEEPROMCommand() {} - EventHandlerResult onFocusEvent(const char *command); }; diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp index 8b6aad0f..405c037a 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp @@ -30,20 +30,18 @@ namespace kaleidoscope { namespace plugin { -uint16_t EscapeOneShotConfig::settings_base_; - EventHandlerResult EscapeOneShotConfig::onSetup() { settings_base_ = ::EEPROMSettings.requestSlice(sizeof(EscapeOneShot::settings_)); if (Runtime.storage().isSliceUninitialized( settings_base_, - sizeof(EscapeOneShot::settings_))) { + sizeof(EscapeOneShot::Settings))) { // If our slice is uninitialized, set sensible defaults. - Runtime.storage().put(settings_base_, EscapeOneShot::settings_); + Runtime.storage().put(settings_base_, ::EscapeOneShot.settings_); Runtime.storage().commit(); } - Runtime.storage().get(settings_base_, EscapeOneShot::settings_); + Runtime.storage().get(settings_base_, ::EscapeOneShot.settings_); return EventHandlerResult::OK; } @@ -66,7 +64,7 @@ EventHandlerResult EscapeOneShotConfig::onFocusEvent(const char *command) { ::EscapeOneShot.setCancelKey(k); } - Runtime.storage().put(settings_base_, EscapeOneShot::settings_); + Runtime.storage().put(settings_base_, ::EscapeOneShot.settings_); Runtime.storage().commit(); return EventHandlerResult::EVENT_CONSUMED; } diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp index 1c7b9d96..d5cc1e41 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp @@ -27,9 +27,6 @@ namespace kaleidoscope { namespace plugin { -EscapeOneShot::Settings EscapeOneShot::settings_ = { - .cancel_oneshot_key = Key_Escape}; - EventHandlerResult EscapeOneShot::onKeyEvent(KeyEvent &event) { // We only act on an escape key (or `cancel_oneshot_key_`, if that has been // set) that has just been pressed, and not generated by some other diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h index 0b03b90c..8a2b4b35 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h @@ -37,10 +37,10 @@ class EscapeOneShot : public kaleidoscope::Plugin { public: EventHandlerResult onKeyEvent(KeyEvent &event); - static void setCancelKey(Key cancel_key) { + void setCancelKey(Key cancel_key) { settings_.cancel_oneshot_key = cancel_key; } - static Key getCancelKey() { + Key getCancelKey() { return settings_.cancel_oneshot_key; } @@ -50,7 +50,9 @@ class EscapeOneShot : public kaleidoscope::Plugin { struct Settings { Key cancel_oneshot_key; }; - static Settings settings_; + Settings settings_ = { + .cancel_oneshot_key = Key_Escape + }; }; class EscapeOneShotConfig : public Plugin { @@ -60,7 +62,7 @@ class EscapeOneShotConfig : public Plugin { EventHandlerResult onNameQuery(); private: - static uint16_t settings_base_; + uint16_t settings_base_; }; } // namespace plugin diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp index 07511754..b652872c 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp @@ -33,9 +33,6 @@ namespace kaleidoscope { namespace plugin { -uint16_t FingerPainter::color_base_; -bool FingerPainter::edit_mode_; - EventHandlerResult FingerPainter::onNameQuery() { return ::Focus.sendName(F("FingerPainter")); } diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index 5ac7d58e..65418544 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -33,7 +33,7 @@ namespace plugin { // class FingerPainter : public LEDMode { public: - static void toggle(void); + void toggle(void); EventHandlerResult onKeyEvent(KeyEvent &event); EventHandlerResult onFocusEvent(const char *command); @@ -45,8 +45,8 @@ class FingerPainter : public LEDMode { void refreshAt(KeyAddr key_addr) final; private: - static uint16_t color_base_; - static bool edit_mode_; + uint16_t color_base_; + bool edit_mode_; }; } // namespace plugin diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index 1c063297..db1ae9cd 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -33,9 +33,6 @@ namespace kaleidoscope { namespace plugin { -char FocusSerial::command_[32]; -uint8_t FocusSerial::buf_cursor_ = 0; - EventHandlerResult FocusSerial::afterEachCycle() { // GD32 doesn't currently autoflush the very last packet. So manually flush here Runtime.serialPort().flush(); diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h index fdb3dc2a..f9915d52 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h @@ -113,15 +113,15 @@ class FocusSerial : public kaleidoscope::Plugin { EventHandlerResult onFocusEvent(const char *command); private: - static char command_[32]; - static uint8_t buf_cursor_; - static void printBool(bool b); + char command_[32]; + uint8_t buf_cursor_ = 0; + void printBool(bool b); // This is a hacky workaround for the host seemingly dropping characters // when a client spams its serial port too quickly // Verified on GD32 and macOS 12.3 2022-03-29 static constexpr uint8_t focus_delay_us_after_character_ = 100; - static void delayAfterPrint() { delayMicroseconds(focus_delay_us_after_character_); } + void delayAfterPrint() { delayMicroseconds(focus_delay_us_after_character_); } }; } // namespace plugin diff --git a/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.cpp b/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.cpp index 9d3c0dcd..8b8d1cd8 100644 --- a/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.cpp +++ b/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.cpp @@ -28,10 +28,6 @@ namespace kaleidoscope { namespace plugin { -const GhostInTheFirmware::GhostKey *GhostInTheFirmware::ghost_keys; -bool GhostInTheFirmware::is_active_ = false; -uint16_t GhostInTheFirmware::current_pos_ = 0; -uint16_t GhostInTheFirmware::start_time_; void GhostInTheFirmware::activate(void) { is_active_ = true; diff --git a/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.h b/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.h index 6f26d333..f060933c 100644 --- a/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.h +++ b/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.h @@ -32,16 +32,16 @@ class GhostInTheFirmware : public kaleidoscope::Plugin { uint16_t press_time; uint16_t delay; }; - static const GhostKey *ghost_keys; + const GhostKey *ghost_keys; - static void activate(void); + void activate(void); EventHandlerResult afterEachCycle(); private: - static bool is_active_; - static uint16_t current_pos_; - static uint16_t start_time_; + bool is_active_ = false; + uint16_t current_pos_ = 0; + uint16_t start_time_; }; } // namespace plugin diff --git a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.cpp b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.cpp index f2974393..77c49e59 100644 --- a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.cpp +++ b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.cpp @@ -38,12 +38,6 @@ namespace kaleidoscope { namespace device { namespace ez { -ErgoDoxScanner ErgoDox::scanner_; -uint8_t ErgoDox::previousKeyState_[matrix_rows]; -uint8_t ErgoDox::keyState_[matrix_rows]; -uint8_t ErgoDox::debounce_matrix_[matrix_rows][matrix_columns]; -uint8_t ErgoDox::debounce = 5; - static bool do_scan_ = 1; void ErgoDox::setup(void) { diff --git a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.h b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.h index 3c76c610..6b2a64ae 100644 --- a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.h +++ b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.h @@ -78,17 +78,17 @@ class ErgoDox : public kaleidoscope::device::ATmega32U4Keyboard { void setStatusLED(uint8_t led, bool state = true); void setStatusLEDBrightness(uint8_t led, uint8_t brightness); - static uint8_t debounce; + uint8_t debounce = 5; private: - static ErgoDoxScanner scanner_; - static uint8_t previousKeyState_[matrix_rows]; - static uint8_t keyState_[matrix_rows]; - static uint8_t debounce_matrix_[matrix_rows][matrix_columns]; - - static uint8_t debounceMaskForRow(uint8_t row); - static void debounceRow(uint8_t change, uint8_t row); - static void readMatrixRow(uint8_t row); + ErgoDoxScanner scanner_; + uint8_t previousKeyState_[matrix_rows]; + uint8_t keyState_[matrix_rows]; + uint8_t debounce_matrix_[matrix_rows][matrix_columns]; + + uint8_t debounceMaskForRow(uint8_t row); + void debounceRow(uint8_t change, uint8_t row); + void readMatrixRow(uint8_t row); }; #else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD class ErgoDox; diff --git a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp index 1780c44c..7f885f69 100644 --- a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp +++ b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp @@ -34,15 +34,9 @@ namespace kaleidoscope { namespace plugin { // --- state --- -Key Leader::sequence_[LEADER_MAX_SEQUENCE_LENGTH + 1]; -KeyEventTracker Leader::event_tracker_; -uint8_t Leader::sequence_pos_; -uint16_t Leader::start_time_ = 0; #ifndef NDEPRECATED uint16_t Leader::time_out = 1000; #endif -uint16_t Leader::timeout_ = 1000; -const Leader::dictionary_t *Leader::dictionary; // --- helpers --- diff --git a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.h b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.h index 60cec12b..aad67353 100644 --- a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.h +++ b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.h @@ -67,9 +67,9 @@ class Leader : public kaleidoscope::Plugin { action_t action; } dictionary_t; - static const dictionary_t *dictionary; + const dictionary_t *dictionary; - static void reset(void); + void reset(void); #ifndef NDEPRECATED DEPRECATED(LEADER_TIME_OUT) @@ -79,7 +79,7 @@ class Leader : public kaleidoscope::Plugin { void inject(Key key, uint8_t key_state); #endif - static void setTimeout(uint16_t timeout) { + void setTimeout(uint16_t timeout) { #ifndef NDEPRECATED #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -94,13 +94,13 @@ class Leader : public kaleidoscope::Plugin { EventHandlerResult afterEachCycle(); private: - static Key sequence_[LEADER_MAX_SEQUENCE_LENGTH + 1]; - static KeyEventTracker event_tracker_; - static uint8_t sequence_pos_; - static uint16_t start_time_; - static uint16_t timeout_; + Key sequence_[LEADER_MAX_SEQUENCE_LENGTH + 1]; + KeyEventTracker event_tracker_; + uint8_t sequence_pos_; + uint16_t start_time_ = 0; + uint16_t timeout_ = 1000; - static int8_t lookup(void); + int8_t lookup(void); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.cpp b/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.cpp index 463fdeae..a54fea28 100644 --- a/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.cpp +++ b/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.cpp @@ -29,7 +29,6 @@ namespace kaleidoscope { namespace plugin { uint16_t MagicCombo::min_interval = 500; -uint16_t MagicCombo::start_time_ = 0; EventHandlerResult MagicCombo::onNameQuery() { return ::Focus.sendName(F("MagicCombo")); diff --git a/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.h b/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.h index 928a8dd2..5fb5463a 100644 --- a/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.h +++ b/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.h @@ -54,7 +54,7 @@ class MagicCombo : public kaleidoscope::Plugin { EventHandlerResult afterEachCycle(); private: - static uint16_t start_time_; + uint16_t start_time_ = 0; }; namespace magiccombo { diff --git a/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.cpp b/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.cpp index 62430969..e0377a4f 100644 --- a/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.cpp +++ b/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.cpp @@ -28,8 +28,6 @@ namespace kaleidoscope { namespace plugin { -Key Redial::last_key_; - EventHandlerResult Redial::onNameQuery() { return ::Focus.sendName(F("Redial")); } diff --git a/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.h b/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.h index 98508ce7..476620d5 100644 --- a/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.h +++ b/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.h @@ -37,7 +37,7 @@ class Redial : public kaleidoscope::Plugin { EventHandlerResult onKeyEvent(KeyEvent &event); private: - static Key last_key_; + Key last_key_; }; } // namespace plugin diff --git a/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.cpp b/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.cpp index 9e7d68dc..526ce71b 100644 --- a/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.cpp +++ b/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.cpp @@ -28,8 +28,6 @@ namespace kaleidoscope { namespace plugin { -const ShapeShifter::dictionary_t *ShapeShifter::dictionary = nullptr; - EventHandlerResult ShapeShifter::onKeyEvent(KeyEvent &event) { if (dictionary == nullptr) return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.h b/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.h index 7ee3df15..312f1b20 100644 --- a/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.h +++ b/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.h @@ -31,7 +31,7 @@ class ShapeShifter : public kaleidoscope::Plugin { Key original, replacement; } dictionary_t; - static const dictionary_t *dictionary; + const dictionary_t *dictionary = nullptr; EventHandlerResult onKeyEvent(KeyEvent &event); }; diff --git a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp index e01f3312..0608b6b5 100644 --- a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp +++ b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp @@ -51,19 +51,6 @@ SpaceCadet::KeyBinding::KeyBinding(Key input, Key output, uint16_t timeout) SpaceCadet::KeyBinding *SpaceCadet::map; uint16_t SpaceCadet::time_out = 200; -// ----------------------------------------------------------------------------- -// State variables - -uint8_t SpaceCadet::mode_ = SpaceCadet::Mode::ON; - -// These variables are used to keep track of any pending unresolved SpaceCadet -// key that has been pressed. If `pending_map_index_` is negative, it means -// there is no such pending keypress. Otherwise, it holds the value of the index -// of that key in the array. -int8_t SpaceCadet::pending_map_index_ = -1; - -KeyEventTracker SpaceCadet::event_tracker_; - // ============================================================================= // SpaceCadet functions diff --git a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h index 2f521419..3e98366c 100644 --- a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h +++ b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h @@ -66,16 +66,16 @@ class SpaceCadet : public kaleidoscope::Plugin { SpaceCadet(void); // Methods - static void enable() { + void enable() { mode_ = Mode::ON; } - static void disable() { + void disable() { mode_ = Mode::OFF; } - static void enableWithoutDelay() { + void enableWithoutDelay() { mode_ = Mode::NO_DELAY; } - static bool active() { + bool active() { return (mode_ == Mode::ON || mode_ == Mode::NO_DELAY); } @@ -93,7 +93,7 @@ class SpaceCadet : public kaleidoscope::Plugin { OFF, NO_DELAY, }; - static uint8_t mode_; + uint8_t mode_; static KeyEventTracker event_tracker_; @@ -103,7 +103,11 @@ class SpaceCadet : public kaleidoscope::Plugin { // The event queue stores a series of press and release events. KeyAddrEventQueue event_queue_; - static int8_t pending_map_index_; + // This variable is used to keep track of any pending unresolved SpaceCadet + // key that has been pressed. If `pending_map_index_` is negative, it means + // there is no such pending keypress. Otherwise, it holds the value of the + // index of that key in the array. + int8_t pending_map_index_ = -1; int8_t getSpaceCadetKeyIndex(Key key) const; diff --git a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp index 6fd52603..8b0bcdec 100644 --- a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp +++ b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp @@ -31,11 +31,6 @@ namespace kaleidoscope { namespace plugin { -// --- state --- -char Syster::symbol_[SYSTER_MAX_SYMBOL_LENGTH + 1]; -uint8_t Syster::symbol_pos_; -bool Syster::is_active_; - // --- api --- void Syster::reset(void) { symbol_pos_ = 0; diff --git a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.h b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.h index bdf9aaa2..c3b6487b 100644 --- a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.h +++ b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.h @@ -41,7 +41,7 @@ class Syster : public kaleidoscope::Plugin { SymbolAction } action_t; - static void reset(); + void reset(); bool is_active(); @@ -49,9 +49,9 @@ class Syster : public kaleidoscope::Plugin { EventHandlerResult onKeyEvent(KeyEvent &event); private: - static char symbol_[SYSTER_MAX_SYMBOL_LENGTH + 1]; - static uint8_t symbol_pos_; - static bool is_active_; + char symbol_[SYSTER_MAX_SYMBOL_LENGTH + 1]; + uint8_t symbol_pos_; + bool is_active_ = false; }; } // namespace plugin diff --git a/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.cpp b/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.cpp index c55b5b1b..cd787c20 100644 --- a/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.cpp +++ b/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.cpp @@ -38,9 +38,6 @@ namespace plugin { // --- config --- uint16_t TapDance::time_out = 200; -uint8_t TapDance::tap_count_ = 0; - -KeyEventTracker TapDance::event_tracker_; // --- api --- void TapDance::actionKeys(uint8_t tap_count, diff --git a/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.h b/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.h index 76a4f171..4b2c6153 100644 --- a/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.h +++ b/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.h @@ -73,10 +73,10 @@ class TapDance : public kaleidoscope::Plugin { // The event queue stores a series of press and release events. KeyAddrEventQueue event_queue_; - static KeyEventTracker event_tracker_; + KeyEventTracker event_tracker_; // The number of taps in the current TapDance sequence. - static uint8_t tap_count_; + uint8_t tap_count_ = 0; void flushQueue(KeyAddr ignored_addr = KeyAddr::none()); }; diff --git a/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.cpp b/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.cpp index 6e4244fe..3b79f878 100644 --- a/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.cpp +++ b/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.cpp @@ -32,8 +32,6 @@ namespace kaleidoscope { namespace plugin { -KeyAddr TopsyTurvy::tt_addr_ = KeyAddr::none(); - EventHandlerResult TopsyTurvy::onKeyEvent(KeyEvent &event) { if (keyToggledOff(event.state)) { if (event.addr == tt_addr_) diff --git a/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.h b/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.h index f5952d9a..ae6dcfd7 100644 --- a/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.h +++ b/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.h @@ -45,7 +45,7 @@ class TopsyTurvy : public kaleidoscope::Plugin { } private: - static KeyAddr tt_addr_; + KeyAddr tt_addr_ = KeyAddr::none(); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.cpp b/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.cpp index 96cc9970..cbf04105 100644 --- a/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.cpp +++ b/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.cpp @@ -37,16 +37,6 @@ namespace kaleidoscope { namespace plugin { -uint16_t Turbo::interval_ = 10; -uint16_t Turbo::flash_interval_ = 69; -bool Turbo::sticky_ = false; -bool Turbo::flash_ = true; -cRGB Turbo::active_color_ = CRGB(160, 0, 0); - -bool Turbo::active_ = false; -uint32_t Turbo::start_time_ = 0; -uint32_t Turbo::flash_start_time_ = 0; - uint16_t Turbo::interval() { return interval_; } diff --git a/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.h b/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.h index b78bc06e..918d7779 100644 --- a/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.h +++ b/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.h @@ -53,15 +53,15 @@ class Turbo : public kaleidoscope::Plugin { EventHandlerResult beforeSyncingLeds(); private: - static uint16_t interval_; - static uint16_t flash_interval_; - static bool sticky_; - static bool flash_; - static cRGB active_color_; + uint16_t interval_ = 10; + uint16_t flash_interval_ = 69; + bool sticky_ = false; + bool flash_ = true; + cRGB active_color_ = CRGB(160, 0, 0); - static bool active_; - static uint32_t start_time_; - static uint32_t flash_start_time_; + bool active_ = false; + uint32_t start_time_ = 0; + uint32_t flash_start_time_ = 0; }; } // namespace plugin