From 7dcd044fb5fef338e3d7793923884a3c29ac42d9 Mon Sep 17 00:00:00 2001 From: lexa Date: Sun, 2 Aug 2020 19:17:08 +0300 Subject: [PATCH] Remove comments and reset flood --- VT_ESP8266/src/main.cpp | 76 +++-------------------------------------- 1 file changed, 5 insertions(+), 71 deletions(-) diff --git a/VT_ESP8266/src/main.cpp b/VT_ESP8266/src/main.cpp index d209859..f4ade81 100644 --- a/VT_ESP8266/src/main.cpp +++ b/VT_ESP8266/src/main.cpp @@ -226,7 +226,11 @@ void buttLongClick() Serial.println("Button LongClick"); LCDsec = 0; lcd.setBacklight(255); - if (page == 3) return; + if (page == 3){ + pcf.write(LED_RED, 1); + mqttClient.publish("/home/vt/flood", 1, false, "0"); + return; + } if (modeEdit == 0){ modeEdit = 1; itemEdit = 0; @@ -291,76 +295,6 @@ void chkCount() } } -// void callback(char* topic, byte* payload, unsigned int length) { -// Serial.print("Message arrived ["); -// Serial.print(topic); -// Serial.print("] "); -// for (unsigned int i = 0; i < length; i++) { -// Serial.print((char)payload[i]); -// } -// Serial.println(); -// if (strcmp(topic, "/home/vt/h_sp_set") == 0){ -// wUstavki.hSP = atoi((char*)payload); -// ee.writeBlock(8, (uint8_t*)&wUstavki, sizeof(wUstavki)); -// return; -// } -// if (strcmp(topic, "/home/vt/h_db_set") == 0){ -// wUstavki.hDB = atoi((char*)payload); -// ee.writeBlock(8, (uint8_t*)&wUstavki, sizeof(wUstavki)); -// return; -// } -// if (strcmp(topic, "/home/vt/v_work_set") == 0){ -// ventUst.tWork = atoi((char*)payload); -// ee.writeBlock(16, (uint8_t*)&ventUst, sizeof(ventUst)); -// return; -// } -// if (strcmp(topic, "/home/vt/v_pause_set") == 0){ -// ventUst.tPause = atoi((char*)payload); -// ee.writeBlock(16, (uint8_t*)&ventUst, sizeof(ventUst)); -// return; -// } -// if (strcmp(topic, "/home/vt/QC_set") == 0){ -// wCounter.QC = atof((char*)payload); -// ee.writeBlock(0, (uint8_t*)&wCounter, sizeof(wCounter)); -// return; -// } -// if (strcmp(topic, "/home/vt/QH_set") == 0){ -// wCounter.QH = atof((char*)payload); -// ee.writeBlock(0, (uint8_t*)&wCounter, sizeof(wCounter)); -// return; -// } -// if (strcmp(topic, "/home/vt/LCDto_set") == 0){ -// LCDtimeout = atoi((char*)payload); -// ee.writeByte(20, LCDtimeout); -// } -// } - -// void reconnect() { -// uint8_t cnt = 0; -// // Loop until we're reconnected -// ledRed.start(); -// while (!client.connected() && (cnt < 5)) { -// Serial.print(F("Attempting MQTT connection...")); -// // Create a random client ID -// String clientId = "ESP_VT"; -// // Attempt to connect -// if (client.connect(clientId.c_str())) { -// Serial.println(F("connected")); -// client.subscribe("/home/vt/h_sp_set"); -// client.subscribe("/home/vt/h_db_set"); -// client.subscribe("/home/vt/v_work_set"); -// client.subscribe("/home/vt/v_pause_set"); -// client.subscribe("/home/vt/LCDto_set"); -// client.subscribe("/home/vt/QC_set"); -// client.subscribe("/home/vt/QH_set"); -// } else { -// Serial.print(F("failed, rc=")); -// Serial.print(client.state()); -// } -// cnt++; -// } -// } - void showLCD(uint8_t page, bool chgd) { char c = ' ';