Update Smart_Roller_Bilind_V2.ino

This commit is contained in:
Make It Smart
2023-03-05 15:27:08 +03:00
parent 29e0dec1cc
commit b8c08aec9a

View File

@@ -238,8 +238,6 @@ void loadLastValues() {
} }
void go(int p) { void go(int p) {
lastActivity = millis();
goingTo = p; goingTo = p;
//if (motor_position_counter < goingTo && last_motor_move_direction == -1) motor_position_counter -= 2; //if (motor_position_counter < goingTo && last_motor_move_direction == -1) motor_position_counter -= 2;
@@ -274,8 +272,6 @@ void read_encoder() {
//--------------------HTTP functions----------------------------------------- //--------------------HTTP functions-----------------------------------------
void resetEncoder() { void resetEncoder() {
lastActivity = millis();
motor_position_counter = 0; motor_position_counter = 0;
saveMotorPosition(); saveMotorPosition();
@@ -283,19 +279,14 @@ void resetEncoder() {
} }
void getInfo() { void getInfo() {
lastActivity = millis();
httpServer.send(200, "text/plain", String(motor_position_counter) + "," + String(isReverse)); httpServer.send(200, "text/plain", String(motor_position_counter) + "," + String(isReverse));
} }
void get_device_type() { void get_device_type() {
lastActivity = millis();
httpServer.send(200, "text/plain", "Roller Blind"); httpServer.send(200, "text/plain", "Roller Blind");
} }
void motor_move() { void motor_move() {
lastActivity = millis();
int m_direction = httpServer.arg("direction").toInt(); int m_direction = httpServer.arg("direction").toInt();
if (goingTo == int_max) { if (goingTo == int_max) {
motor_direction = m_direction; motor_direction = m_direction;
@@ -308,8 +299,6 @@ void motor_move() {
} }
void go_to() { void go_to() {
lastActivity = millis();
int p = httpServer.arg("p").toInt(); int p = httpServer.arg("p").toInt();
go(p); go(p);
@@ -317,8 +306,6 @@ void go_to() {
} }
void setReverse() { void setReverse() {
lastActivity = millis();
int value = httpServer.arg("value").toInt(); int value = httpServer.arg("value").toInt();
isReverse = value == 1; isReverse = value == 1;
@@ -332,8 +319,6 @@ void setReverse() {
} }
void addPosition() { void addPosition() {
lastActivity = millis();
if (numPositions >= 10) if (numPositions >= 10)
httpServer.send(400, "text/plain", "You have reached max number of positions!"); httpServer.send(400, "text/plain", "You have reached max number of positions!");
@@ -386,8 +371,6 @@ void addPosition() {
} }
void deletePosition() { void deletePosition() {
lastActivity = millis();
String id = httpServer.arg("id"); String id = httpServer.arg("id");
int index = -1; int index = -1;
@@ -429,8 +412,6 @@ void deletePosition() {
} }
void getPositionList() { void getPositionList() {
lastActivity = millis();
String result = ""; String result = "";
for (int i = 0; i < numPositions; i++) { for (int i = 0; i < numPositions; i++) {
result += positionList[i].id + "#*#" + positionList[i].name + "#*#" + positionList[i].position + "#*#" + positionList[i].time + "*p*"; result += positionList[i].id + "#*#" + positionList[i].name + "#*#" + positionList[i].position + "#*#" + positionList[i].time + "*p*";
@@ -440,8 +421,6 @@ void getPositionList() {
} }
void getPosition() { void getPosition() {
lastActivity = millis();
String id = httpServer.arg("id"); String id = httpServer.arg("id");
int index = -1; int index = -1;