/* * To upload through terminal you can use: curl -F "image=@firmware.bin" http://:8080/update * * * bin file location on windows: C:\Users\\AppData\Local\Temp\arduino_build_ */ #include #include #include #include #include ESP8266WebServer httpServer(8080); ESP8266HTTPUpdateServer httpUpdater; String ip = "127.0.0.1"; String dev = "unknown"; float sensValues[6]; void setupWebUpdater(void) { #ifdef DEBUG Serial.println(); Serial.println("Starting WebUpdater..."); #endif httpUpdater.setup(&httpServer); httpServer.on("/", showHTMLMain); // oko specific site httpServer.begin(); #ifdef DEBUG Serial.println("HTTPUpdateServer ready!"); #endif } void doWebUpdater(void) { digitalWrite(D0, HIGH); httpServer.handleClient(); } void setSensorData(String device, String localip, float sensorValues[]) { dev = device; ip = localip; for (uint8_t i = 0; i < 7; i++) { sensValues[i] = sensorValues[i]; } } void showHTMLMain(void) { String message = "OKO Weatherstation - " + String(dev) + "" "" "" "
firmware update

" "" "" "" "" "" "" "" "
temperature" + String(sensValues[SENSOR_TEMPERATURE]) + "
humidity" + String(sensValues[SENSOR_HUMIDITY]) + "
light" + String(sensValues[SENSOR_LIGHT]) + "
windspeed" + String(sensValues[SENSOR_WINDSPEED]) + "
pressure" + String(sensValues[SENSOR_PRESSURE]) + "
batvoltage" + String(sensValues[SENSOR_BAT_VOLTAGE]) + "
" ""; httpServer.send(200, "text/html", message); }