mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
рабочая для 8266 версия
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -8,9 +8,10 @@
|
|||||||
#include <TickerScheduler.h>
|
#include <TickerScheduler.h>
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
#include <WiFi.h>
|
#include "WiFi.h"
|
||||||
#include <HTTPClient.h>
|
#include <HTTPClient.h>
|
||||||
#include <HTTPUpdate.h>
|
#include <HTTPUpdate.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
@@ -34,8 +35,10 @@
|
|||||||
|
|
||||||
#ifdef STANDARD_WEB_SOCKETS
|
#ifdef STANDARD_WEB_SOCKETS
|
||||||
#include <WebSocketsServer.h>
|
#include <WebSocketsServer.h>
|
||||||
|
#ifdef ESP8266
|
||||||
#include <Hash.h>
|
#include <Hash.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
|
|
||||||
@@ -49,6 +52,7 @@
|
|||||||
**********************************************************************************************************************/
|
**********************************************************************************************************************/
|
||||||
|
|
||||||
extern TickerScheduler ts;
|
extern TickerScheduler ts;
|
||||||
|
extern WiFiClient espClient;
|
||||||
#ifdef ASYNC_WEB_SERVER
|
#ifdef ASYNC_WEB_SERVER
|
||||||
extern AsyncWebServer server;
|
extern AsyncWebServer server;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,4 +19,7 @@ extern void handleFileList();
|
|||||||
#ifdef STANDARD_WEB_SOCKETS
|
#ifdef STANDARD_WEB_SOCKETS
|
||||||
extern void standWebSocketsInit();
|
extern void standWebSocketsInit();
|
||||||
extern void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length);
|
extern void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length);
|
||||||
|
#ifdef ESP32
|
||||||
|
extern void hexdump(const void* mem, uint32_t len, uint8_t cols);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
**********************************************************************************************************************/
|
**********************************************************************************************************************/
|
||||||
|
|
||||||
TickerScheduler ts(MYTEST + 1);
|
TickerScheduler ts(MYTEST + 1);
|
||||||
|
WiFiClient espClient;
|
||||||
#ifdef ASYNC_WEB_SERVER
|
#ifdef ASYNC_WEB_SERVER
|
||||||
AsyncWebServer server(80);
|
AsyncWebServer server(80);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
|||||||
|
|
||||||
case WStype_BIN: {
|
case WStype_BIN: {
|
||||||
Serial.printf("[%u] get binary length: %u\n", num, length);
|
Serial.printf("[%u] get binary length: %u\n", num, length);
|
||||||
hexdump(payload, length);
|
//hexdump(payload, length);
|
||||||
|
|
||||||
// send message to client
|
// send message to client
|
||||||
// standWebSocket.sendBIN(num, payload, length);
|
// standWebSocket.sendBIN(num, payload, length);
|
||||||
@@ -232,4 +232,19 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
|
void hexdump(const void* mem, uint32_t len, uint8_t cols = 16) {
|
||||||
|
const uint8_t* src = (const uint8_t*)mem;
|
||||||
|
Serial.printf("\n[HEXDUMP] Address: 0x%08X len: 0x%X (%d)", (ptrdiff_t)src, len, len);
|
||||||
|
for (uint32_t i = 0; i < len; i++) {
|
||||||
|
if (i % cols == 0) {
|
||||||
|
Serial.printf("\n[0x%08X] 0x%08X: ", (ptrdiff_t)src, i);
|
||||||
|
}
|
||||||
|
Serial.printf("%02X ", *src);
|
||||||
|
src++;
|
||||||
|
}
|
||||||
|
Serial.printf("\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user