Initial conversion to PrettyOTA
This commit is contained in:
		
							parent
							
								
									49a9b45ab9
								
							
						
					
					
						commit
						14759902be
					
				| 
						 | 
				
			
			@ -13,6 +13,9 @@ platform = espressif32
 | 
			
		|||
board = esp32doit-devkit-v1
 | 
			
		||||
framework = arduino
 | 
			
		||||
monitor_speed = 115200
 | 
			
		||||
lib_deps = tzapu/WiFiManager@^2.0.17
 | 
			
		||||
;upload_protocol = espota
 | 
			
		||||
;upload_port = 192.168.2.233
 | 
			
		||||
upload_protocol = espota
 | 
			
		||||
upload_port = 192.168.2.232
 | 
			
		||||
lib_compat_mode = strict
 | 
			
		||||
lib_deps = 
 | 
			
		||||
	tzapu/WiFiManager@^2.0.17
 | 
			
		||||
	lostincompilation/PrettyOTA@^1.1.2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/main.cpp
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -3,8 +3,9 @@
 | 
			
		|||
#include <WiFi.h>
 | 
			
		||||
#include <HTTPClient.h>
 | 
			
		||||
#include <ArduinoOTA.h>
 | 
			
		||||
#include <PrettyOTA.h>
 | 
			
		||||
 | 
			
		||||
#define FIRMWARE "2.0"
 | 
			
		||||
#define FIRMWARE "2.1b"
 | 
			
		||||
 | 
			
		||||
#define BUTTONPIN 23
 | 
			
		||||
#define DEBOUNCEMS 15
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +18,9 @@ String statusURL = "http://moon.basement.lan/l/boardstatus.php";
 | 
			
		|||
unsigned short buttonState = HIGH, lastButtonState = HIGH;
 | 
			
		||||
unsigned long lastStatusTime = 0;
 | 
			
		||||
 | 
			
		||||
AsyncWebServer server(80);
 | 
			
		||||
PrettyOTA OTAUpdates;
 | 
			
		||||
 | 
			
		||||
void sendToggleMessage(bool state) {
 | 
			
		||||
  Serial.println("Action button triggered");
 | 
			
		||||
  char webMsg[255] = "";
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +51,7 @@ void setup() {
 | 
			
		|||
  WiFiManager wifiManager;
 | 
			
		||||
  wifiManager.autoConnect("LEDsActionButton");
 | 
			
		||||
  lastStatusTime = sendDeviceStatus();
 | 
			
		||||
  ArduinoOTA.onStart([]() {
 | 
			
		||||
  /*ArduinoOTA.onStart([]() {
 | 
			
		||||
    String type;
 | 
			
		||||
    if ( ArduinoOTA.getCommand() == U_FLASH )
 | 
			
		||||
      type = "sketch";
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +70,12 @@ void setup() {
 | 
			
		|||
      else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
 | 
			
		||||
      else if (error == OTA_END_ERROR) Serial.println("End Failed");
 | 
			
		||||
  });
 | 
			
		||||
  ArduinoOTA.begin();
 | 
			
		||||
  ArduinoOTA.begin();*/
 | 
			
		||||
  OTAUpdates.Begin(&server);
 | 
			
		||||
  OTAUpdates.SetHardwareID(SERVICE);
 | 
			
		||||
  OTAUpdates.OverwriteAppVersion(FIRMWARE);
 | 
			
		||||
  PRETTY_OTA_SET_CURRENT_BUILD_TIME_AND_DATE();
 | 
			
		||||
  server.begin();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned long lastDebounceTime = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user