mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-13 07:16:31 +02:00
fix OTA example build and build tests for esp8266 examples
This commit is contained in:
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@ -36,10 +36,10 @@ jobs:
|
|||||||
echo -en "::set-output name=matrix::"
|
echo -en "::set-output name=matrix::"
|
||||||
echo -en "["
|
echo -en "["
|
||||||
|
|
||||||
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266 esp8266 1.8.19 esp8266com:esp8266:generic:xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=80,FlashMode=qio,eesz=4M2M,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Serial1,lvl=SSL,wipe=none,baud=115200
|
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266_pico esp8266 1.8.19 esp8266com:esp8266:generic:xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=80,FlashMode=qio,eesz=4M2M,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Serial1,lvl=SSL,wipe=none,baud=115200
|
||||||
echo -en ","
|
echo -en ","
|
||||||
|
|
||||||
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266 esp8266 1.8.19 esp8266com:esp8266:generic:xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=80,FlashMode=qio,eesz=4M2M,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200
|
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266_pico esp8266 1.8.19 esp8266com:esp8266:generic:xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=80,FlashMode=qio,eesz=4M2M,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200
|
||||||
echo -en ","
|
echo -en ","
|
||||||
|
|
||||||
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp32 esp32 1.8.19 espressif:esp32:esp32:FlashFreq=80
|
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp32 esp32 1.8.19 espressif:esp32:esp32:FlashFreq=80
|
||||||
|
@ -10,24 +10,27 @@
|
|||||||
|
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
|
#include <ESP8266WiFiMulti.h>
|
||||||
#include <ESP8266mDNS.h>
|
#include <ESP8266mDNS.h>
|
||||||
#include <Updater.h>
|
#include <Updater.h>
|
||||||
|
#include <Hash.h>
|
||||||
|
|
||||||
|
ESP8266WiFiMulti WiFiMulti;
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
#include "WiFi.h"
|
#include <WiFi.h>
|
||||||
|
#include <WiFiMulti.h>
|
||||||
#include "ESPmDNS.h"
|
#include "ESPmDNS.h"
|
||||||
#include <Update.h>
|
#include <Update.h>
|
||||||
|
|
||||||
|
WiFiMulti WiFiMulti;
|
||||||
#else
|
#else
|
||||||
#error Unsupported device
|
#error Unsupported device
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
#include <ESP8266WiFiMulti.h>
|
|
||||||
|
|
||||||
#include <WebSocketsClient.h>
|
#include <WebSocketsClient.h>
|
||||||
|
|
||||||
#include <Hash.h>
|
|
||||||
|
|
||||||
ESP8266WiFiMulti WiFiMulti;
|
|
||||||
WebSocketsClient webSocket;
|
WebSocketsClient webSocket;
|
||||||
|
|
||||||
#define USE_SERIAL Serial
|
#define USE_SERIAL Serial
|
||||||
@ -49,19 +52,12 @@ uint32_t maxSketchSpace = 0;
|
|||||||
int SketchSize = 0;
|
int SketchSize = 0;
|
||||||
bool ws_conn = false;
|
bool ws_conn = false;
|
||||||
|
|
||||||
String IpAddress2String(const IPAddress& ipAddress)
|
|
||||||
{
|
|
||||||
return String(ipAddress[0]) + String(".") +
|
|
||||||
String(ipAddress[1]) + String(".") +
|
|
||||||
String(ipAddress[2]) + String(".") +
|
|
||||||
String(ipAddress[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void greetings_(){
|
void greetings_(){
|
||||||
StaticJsonDocument<200> doc;
|
StaticJsonDocument<200> doc;
|
||||||
doc["type"] = "greetings";
|
doc["type"] = "greetings";
|
||||||
doc["mac"] = WiFi.macAddress();
|
doc["mac"] = WiFi.macAddress();
|
||||||
doc["ip"] = IpAddress2String(WiFi.localIP());
|
doc["ip"] = WiFi.localIP().toString();
|
||||||
doc["version"] = version;
|
doc["version"] = version;
|
||||||
doc["name"] = name;
|
doc["name"] = name;
|
||||||
doc["chip"] = chip;
|
doc["chip"] = chip;
|
||||||
@ -89,7 +85,7 @@ typedef struct {
|
|||||||
CALLBACK_FUNCTION func;
|
CALLBACK_FUNCTION func;
|
||||||
} RESPONSES_STRUCT;
|
} RESPONSES_STRUCT;
|
||||||
|
|
||||||
void OTA(JsonDocument &msg){
|
void OTA_RESPONSES(JsonDocument &msg){
|
||||||
USE_SERIAL.print(F("[WSc] OTA mode: "));
|
USE_SERIAL.print(F("[WSc] OTA mode: "));
|
||||||
const char* go = "go";
|
const char* go = "go";
|
||||||
const char* ok = "ok";
|
const char* ok = "ok";
|
||||||
@ -114,17 +110,17 @@ void OTA(JsonDocument &msg){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void STATE(JsonDocument &msg){
|
void STA_RESPONSES(JsonDocument &msg){
|
||||||
// Do something with message
|
// Do something with message
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count of responses handled by RESPONSES_STRUCT
|
// Count of responses handled by RESPONSES_STRUCT
|
||||||
// increase increase if another response handler is added
|
// increase increase if another response handler is added
|
||||||
int nrOfResponses = 2;
|
const int nrOfResponses = 2;
|
||||||
|
|
||||||
RESPONSES_STRUCT responses[] = {
|
RESPONSES_STRUCT responses[nrOfResponses] = {
|
||||||
{"ota", OTA},
|
{"ota", OTA_RESPONSES},
|
||||||
{"state", STATE},
|
{"state", STA_RESPONSES},
|
||||||
};
|
};
|
||||||
|
|
||||||
void text(uint8_t * payload, size_t length){
|
void text(uint8_t * payload, size_t length){
|
||||||
|
Reference in New Issue
Block a user