From 0f7e57c1f13adc30c5d56df71ddd6bfff7c26d4f Mon Sep 17 00:00:00 2001 From: Dan Suwanseree Date: Thu, 26 Mar 2020 19:18:06 +0700 Subject: [PATCH] Extra comments --- Node main module/src/autoconnectPages.json | 9 +++++++++ Node main module/src/main.cpp | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Node main module/src/autoconnectPages.json b/Node main module/src/autoconnectPages.json index fb88928..add8dbb 100644 --- a/Node main module/src/autoconnectPages.json +++ b/Node main module/src/autoconnectPages.json @@ -69,6 +69,15 @@ "type": "ACInput", "label": "Update Interval (ms)" }, + { + "name": "ledSettingRadio", + "type": "ACRadio", + "label": "Blink LED when sending the data", + "value":[ + "On", + "Off" + ] + }, { "name": "save", "type": "ACSubmit", diff --git a/Node main module/src/main.cpp b/Node main module/src/main.cpp index f3e62af..c34d729 100644 --- a/Node main module/src/main.cpp +++ b/Node main module/src/main.cpp @@ -14,6 +14,7 @@ #include "protocol.h" #include "customPages.h" +// Time is in milliseconds #define LED_TICKER 33 #define BUTTON_PIN 32 #define DEFAULT_UPDATE_INTERVAL 60000 @@ -127,6 +128,7 @@ void asyncBlink(unsigned long ms = 0) } } +// Button input checking function void checkButton(){ static unsigned long pushedDownTime = NULL; if (pushedDownTime == NULL && digitalRead(BUTTON_PIN) == LOW){ // Button being pressed @@ -153,8 +155,6 @@ void checkButton(){ pushedDownTime = NULL; } - - } @@ -698,11 +698,12 @@ void loop() { scanDevices(); fetchData(); + // Send latest data if it is possible to do so if ((currentJSONReply != NULL || currentJSONReply != "") && (WiFi.status() != WL_IDLE_STATUS) && (WiFi.status() != WL_DISCONNECTED)) { if (WiFi.getMode() == WIFI_MODE_STA){ sendDataToEndpoint(); - + // blink once data is sent if (nodeLEDSetting == "On"){ asyncBlink(200); }