Skip to content

Commit

Permalink
Update genibot.js
Browse files Browse the repository at this point in the history
  • Loading branch information
wodnjs6512 committed Aug 24, 2021
1 parent 32a2366 commit bdc62d1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/modules/genibot.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ const convertHexToSignedInt = (hex => {
return hexString;
});

var isButtonPressed = false;

class Module extends BaseModule {
constructor() {
super();
Expand Down Expand Up @@ -200,9 +202,16 @@ class Module extends BaseModule {
handler.write('ROBOT_VERSION',this.robot.version);

if (this.buttonStatus.status > 0) {
this.buttonStatus.status = -1;
handler.write('BUTTON', true);

if(!isButtonPressed){
isButtonPressed = true;
this.buttonStatus.status = -1;
handler.write('BUTTON', true);
setTimeout(()=>{
isButtonPressed = false;
},3000);
}else{
handler.write('BUTTON', false);
}
}else{
handler.write('BUTTON', false);
}
Expand Down

0 comments on commit bdc62d1

Please sign in to comment.