Skip to content

Commit

Permalink
Bugfix for encoder wrapping and reset in configs (#908)
Browse files Browse the repository at this point in the history
Bugfix for encoder wrapping in configs
  • Loading branch information
speedypotato committed Mar 24, 2024
1 parent 80e0de8 commit 3c6bfa7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions headers/addons/rotaryencoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#define ENCODER_ONE_PIN_B -1
#endif

#ifndef ENCODER_ONE_RESET
#define ENCODER_ONE_RESET 0
#endif

#ifndef ENCODER_ONE_MODE
#define ENCODER_ONE_MODE ENCODER_MODE_NONE
#endif
Expand Down Expand Up @@ -54,6 +58,10 @@
#define ENCODER_TWO_PIN_B -1
#endif

#ifndef ENCODER_TWO_RESET
#define ENCODER_TWO_RESET 0
#endif

#ifndef ENCODER_TWO_MODE
#define ENCODER_TWO_MODE ENCODER_MODE_NONE
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/config_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,16 +671,16 @@ void ConfigUtils::initUnsetPropertiesWithDefaults(Config& config)
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderOne, pinB, (Pin_t)ENCODER_ONE_PIN_B);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderOne, mode, ENCODER_ONE_MODE);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderOne, pulsesPerRevolution, ENCODER_ONE_PPR);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderOne, resetAfter, 0);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderOne, allowWrapAround, 0);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderOne, resetAfter, ENCODER_ONE_RESET);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderOne, allowWrapAround, ENCODER_ONE_WRAP);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderOne, multiplier, ENCODER_ONE_MULTIPLIER);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, enabled, !!ENCODER_TWO_ENABLED);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, pinA, (Pin_t)ENCODER_TWO_PIN_A);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, pinB, (Pin_t)ENCODER_TWO_PIN_B);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, mode, ENCODER_TWO_MODE);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, pulsesPerRevolution, ENCODER_TWO_PPR);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, resetAfter, 0);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, allowWrapAround, 0);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, resetAfter, ENCODER_TWO_RESET);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, allowWrapAround, ENCODER_TWO_WRAP);
INIT_UNSET_PROPERTY(config.addonOptions.rotaryOptions.encoderTwo, multiplier, ENCODER_TWO_MULTIPLIER);

// keyboardMapping
Expand Down

0 comments on commit 3c6bfa7

Please sign in to comment.