mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-10-30 04:26:50 +03:00 
			
		
		
		
	* update examples * fix serial<->tcp example, use STASSID instead of SSID (name collision) * fix HTTPSRequest.ino * update AxTLS HTTPS examples, update AxTLS API to deprecated * fixes * fixes + fix astyle (no preproc directives) + restyling script * fix HTTPClient library * fixes * common.sh: do not reload arduino when already present (for locally CI testing) * common.sh: do not reload ArduinoJson when already present (for locally CI testing) * fix * fix * fix deprecated example * fix WiFiHTTPSServer.ino * reduce footprint * wipfix * fix led builtin * fix example * finished updating APSSID on all examples * style * restyle examples * helper to run CI test locally * local CI runner more verbose * +const * deprecation deprecation * deprecation * Update NTPClient.ino const char[] => const char * * Update interactive.ino const char[] => const char *
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|   To upload through terminal you can use: curl -F "image=@firmware.bin" esp8266-webupdate.local/update
 | |
| */
 | |
| 
 | |
| #include <ESP8266WiFi.h>
 | |
| #include <WiFiClient.h>
 | |
| #include <ESP8266WebServer.h>
 | |
| #include <ESP8266mDNS.h>
 | |
| #include <ESP8266HTTPUpdateServer.h>
 | |
| 
 | |
| #ifndef STASSID
 | |
| #define STASSID "your-ssid"
 | |
| #define STAPSK  "your-password"
 | |
| #endif
 | |
| 
 | |
| const char* host = "esp8266-webupdate";
 | |
| const char* ssid = STASSID;
 | |
| const char* password = STAPSK;
 | |
| 
 | |
| ESP8266WebServer httpServer(80);
 | |
| ESP8266HTTPUpdateServer httpUpdater;
 | |
| 
 | |
| void setup(void) {
 | |
| 
 | |
|   Serial.begin(115200);
 | |
|   Serial.println();
 | |
|   Serial.println("Booting Sketch...");
 | |
|   WiFi.mode(WIFI_AP_STA);
 | |
|   WiFi.begin(ssid, password);
 | |
| 
 | |
|   while (WiFi.waitForConnectResult() != WL_CONNECTED) {
 | |
|     WiFi.begin(ssid, password);
 | |
|     Serial.println("WiFi failed, retrying.");
 | |
|   }
 | |
| 
 | |
|   MDNS.begin(host);
 | |
| 
 | |
|   httpUpdater.setup(&httpServer);
 | |
|   httpServer.begin();
 | |
| 
 | |
|   MDNS.addService("http", "tcp", 80);
 | |
|   Serial.printf("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host);
 | |
| }
 | |
| 
 | |
| void loop(void) {
 | |
|   httpServer.handleClient();
 | |
| }
 |