some doc and cleanup
1 files changed, 18 insertions(+), 11 deletions(-)

M firmware/remote_sensors_esp32/src/main.cpp
M firmware/remote_sensors_esp32/src/main.cpp +18 -11
@@ 12,6 12,20 @@ 
 #include <ESP_EEPROM.h>
 #include <OneButton.h>
 
+/*
+ * This is a simple ESP8266/Arduino based firmware that presents
+ * SHT1x temperature and relative humidity data via UDP broadcast
+ * based on the Weatherflow Smartweather protocol. Integrations
+ * that process the Smartweather UDP feed will see a device 
+ * running this firmware as a combined Smartweather Hub/Air.
+ *
+ * The wifi configuration and serial numbers are configured via 
+ * a custom wireless network/captive portal. Connect to its 
+ * ssid to provide the configuration information. Holding the 
+ * flash button down for 1 second will cause the configuration
+ * to be reset and the device to enter access point mode.
+ */
+
 #define DEBUG(X...) do{if(Serial)Serial.println(X);}while(0)
 #define DEBUGCHAR(X...) do{if(Serial)Serial.print(X);}while(0)
 

          
@@ 43,23 57,15 @@ int reportfreq = 60;
 
 NTPClient timeClient(ntpUdp);
 
-
-
+// 'flash' button is pin 0
 #define BUTTON_PIN 0
 
-/**
- * Initialize a new OneButton instance for a button
- * connected to digital pin 4 and GND, which is active low
- * and uses the internal pull-up resistor.
- */
-
 OneButton btn = OneButton(
         BUTTON_PIN,  // Input pin for the button
         true,        // Button is active LOW
         true         // Enable internal pull-up resistor
 );
 
-
 long ts;
 int reportcnt = 0;
 int lastobservation = 0;

          
@@ 75,6 81,7 @@ void blink(int speed, int count) {
     digitalWrite(16, ON);
 }
 
+//! clear the wifi configuration and restart the device in AP mode.
 void resetEverything() {
     WiFi.enableSTA(true);
     WiFi.persistent(true);

          
@@ 119,7 126,7 @@ String readStringFromEEPROM(int addrOffs
     {
         data[i] = EEPROM.read(addrOffset + 1 + i);
     }
-    data[newStrLen] = '\0'; // !!! NOTE !!! Remove the space between the slash "/" and "0" (I've added a space because otherwise there is a display bug)
+    data[newStrLen] = '\0'; 
     return String(data);
 }
 //***********************************************

          
@@ 309,4 316,4 @@ void loop() {
         udp.endPacket();
     }
     delay(100);
-}
  No newline at end of file
+}