Skip to content
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.

Commit

Permalink
Removed trip msgs as that pauses the movement of the blind
Browse files Browse the repository at this point in the history
  • Loading branch information
nidayand committed Oct 4, 2017
1 parent 3dc1376 commit ed90d91
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions motor_on_a_roller_blind-ws.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <WebSocketsServer.h>

String version = "1.0";
String version = "1.1";

//Configure Default Settings
String APid = "BlindsConnectAP";
Expand Down Expand Up @@ -366,29 +366,12 @@ void loop(void)
if (currentPosition > path){
small_stepper.step(-1);
currentPosition = currentPosition - 1;

//Avoid flooding the websocket
if (tripCounter > 40){
int pos = (currentPosition * 100)/maxPosition;
webSocket.broadcastTXT("{ \"type\":\"position\", \"value\":"+String(pos)+"}");
tripCounter = 0;
}
tripCounter++;

} else if (currentPosition < path){
small_stepper.step(1);
currentPosition = currentPosition + 1;
//Avoid flooding the websocket
if (tripCounter > 40){
int pos = (currentPosition * 100)/maxPosition;
webSocket.broadcastTXT("{ \"type\":\"position\", \"value\":"+String(pos)+"}");
tripCounter = 0;
}
tripCounter++;
} else {
path = 0;
action = "";
tripCounter = 0;
int pos = (currentPosition * 100)/maxPosition;
webSocket.broadcastTXT("{ \"type\":\"position\", \"value\":"+String(pos)+"}");
Serial.println("Stopped. Reached wanted position");
Expand Down

0 comments on commit ed90d91

Please sign in to comment.