Skip to content

Commit

Permalink
Inverted triggered events on rotary rotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-dot-exe authored and LoQue90 committed Aug 18, 2024
1 parent 53d3720 commit a547f98
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/menuHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ void menuInputInit() {
button_events = pulled_button_init(PIN_BIT(menuEnterPin->getPinNumber()) | PIN_BIT(menuUpPin->getPinNumber()) | PIN_BIT(menuDownPin->getPinNumber()), GPIO_PULLUP_ONLY);
break;
case MENUINPUT::ROTARY:
// TODO add rotary setup
menuEnterPin = new GPIOPin(PIN_MENU_ENTER, GPIOPin::IN_PULLUP);
menuUpPin = new GPIOPin(PIN_MENU_OUT_A, GPIOPin::IN_PULLUP);
menuDownPin = new GPIOPin(PIN_MENU_OUT_B, GPIOPin::IN_PULLUP);
Expand Down Expand Up @@ -130,12 +129,12 @@ void initMenu(U8G2& display) {
}
if (MENU_INPUT == MENUINPUT::ROTARY) {
int32_t pos = encoder.getCount() / ENCODER_CLICKS_PER_NOTCH;
if (pos < last) {
if (pos > last) {
menu->Event(EVENT_UP, EventState(EventState::STATE_DOWN));
LOG(DEBUG, "Menu: Up\n");
menu->Event(EVENT_UP, EventState(EventState::STATE_UP));
}
else if (pos > last) {
else if (pos < last) {
menu->Event(EVENT_DOWN, EventState(EventState::STATE_DOWN));
LOG(DEBUG, "Menu: Down\n");
menu->Event(EVENT_DOWN, EventState(EventState::STATE_UP));
Expand Down

0 comments on commit a547f98

Please sign in to comment.