Browse Source

OTA support

master
iansun2 2 years ago
parent
commit
90c9b60221
  1. 10
      platformio.ini
  2. 20
      src/main.cpp

10
platformio.ini

@ -16,3 +16,13 @@ lib_deps = ottowinter/ESPAsyncWebServer-esphome@^3.0.0
board_build.filesystem = littlefs
upload_speed = 921600
monitor_speed = 115200
[env:nodemcuv2_OTA]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = ottowinter/ESPAsyncWebServer-esphome@^3.0.0
board_build.filesystem = littlefs
upload_protocol = espota
upload_port = 192.168.4.1
monitor_speed = 115200

20
src/main.cpp

@ -3,6 +3,7 @@
#include <ESP8266WiFi.h>
#include <LITTLEFS.h>
#include <Ticker.h>
#include <ArduinoOTA.h>
/*===== Define =====*/
/*[const]*/
@ -10,11 +11,11 @@
/*[pin]*/
#define HEAT_GUN_FAN_PIN D2
#define HEATER1_PIN D4
#define HEATER2_PIN D4
#define CONNECTION_LED_PIN D0
#define HEATER1_LED_PIN D0
#define HEATER2_LED_PIN D0
#define HEATER1_PIN D0
#define HEATER2_PIN D5
#define CONNECTION_LED_PIN D5
#define HEATER1_LED_PIN D4
#define HEATER2_LED_PIN D5
#define HEATER1_THERMISTOR_PIN A0
#define HEATER2_THERMISTOR_PIN A0
@ -210,6 +211,7 @@ void setup() {
server.on("/main.css", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(LittleFS, "/main.css", "text/css"); }); //main css
server.begin();
ArduinoOTA.begin();
//ticker
temp_reporter.attach(0.5, temp_report_handler);
@ -217,7 +219,9 @@ void setup() {
}
void loop() {
temp1_current = rand()%100;
temp2_current = rand()%100;
delay(100);
//temp1_current = rand()%100;
//temp2_current = rand()%100;
//delay(100);
ws.cleanupClients();
ArduinoOTA.handle();
}
Loading…
Cancel
Save