# HG changeset patch # User William Welliver # Date 1631131665 14400 # Wed Sep 08 16:07:45 2021 -0400 # Node ID 2ab7632560a54513858631d2e4c22113ca27e861 # Parent 281e513f1797f5988fcee6fbb416ffec69133d7c some doc and cleanup diff --git a/firmware/remote_sensors_esp32/src/main.cpp b/firmware/remote_sensors_esp32/src/main.cpp --- a/firmware/remote_sensors_esp32/src/main.cpp +++ b/firmware/remote_sensors_esp32/src/main.cpp @@ -12,6 +12,20 @@ #include #include +/* + * 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 @@ 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 @@ 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 @@ { 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 @@ udp.endPacket(); } delay(100); -} \ No newline at end of file +}