Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
remotebuzzer: fix rotary encoder
Browse files Browse the repository at this point in the history
Bug fixed: in pull request  #449 the direction detection was override by the same pin.

Update: when changing the direction, you may have to make more than 3 clicks. By resetting the counter on the first click in the new dirction this problem is solved.
Change-Id: If41f60a9f8aa5c005e9afdc37bc640e3f157b355
  • Loading branch information
marco-117 authored and andi34 committed Aug 5, 2022
1 parent 1dbc882 commit 822ef93
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/js/remotebuzzer_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,12 @@ const watchRotaryClk = function watchRotaryClk(err, gpioValue) {
}

if (gpioValue) {
if (rotaryClkPin) {
if (rotaryDtPin) {
/* rotation */
if (cnt > 0) {
/*delete click count for opposite direction */
cnt = 0;
}
/* rotation */
if (cnt < -3) {
photoboothAction('rotary-cw');
Expand Down Expand Up @@ -554,7 +559,12 @@ const watchRotaryDt = function watchRotaryDt(err, gpioValue) {
}

if (gpioValue) {
if (rotaryDtPin) {
if (rotaryClkPin) {
/* rotation */
if (cnt < 0) {
/*delete click count for opposite direction */
cnt = 0;
}
/* rotation */
if (cnt > 3) {
photoboothAction('rotary-ccw');
Expand Down

0 comments on commit 822ef93

Please sign in to comment.