Skip to content

Commit

Permalink
Update remotebuzzer_server.js
Browse files Browse the repository at this point in the history
Bug fixed: in pull request  andi34#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.
  • Loading branch information
marco-117 authored Aug 2, 2022
1 parent f97cf42 commit 9239c7d
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 9239c7d

Please sign in to comment.