mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
исправление вывода лога в режиме AP
This commit is contained in:
@@ -20,4 +20,5 @@ void periodicWsSend();
|
|||||||
void sendFileToWsByFrames(const String& filename, const String& header, const String& json, int client_id, size_t frameSize);
|
void sendFileToWsByFrames(const String& filename, const String& header, const String& json, int client_id, size_t frameSize);
|
||||||
void sendStringToWs(const String& header, String& payload, int client_id);
|
void sendStringToWs(const String& header, String& payload, int client_id);
|
||||||
|
|
||||||
void sendDeviceList(uint8_t num);
|
void sendDeviceList(uint8_t num);
|
||||||
|
int getNumWSClients();
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "MqttClient.h"
|
#include "MqttClient.h"
|
||||||
|
|
||||||
// boolean isNetworkActive();
|
boolean isNetworkActive();
|
||||||
inline boolean isNetworkActive() {return WiFi.status() == WL_CONNECTED;};
|
uint8_t getNumAPClients();
|
||||||
void routerConnect();
|
void routerConnect();
|
||||||
bool startAPMode();
|
bool startAPMode();
|
||||||
boolean RouterFind(String ssid);
|
boolean RouterFind(String ssid);
|
||||||
|
|||||||
@@ -414,7 +414,9 @@ void sendFileToWsByFrames(const String& filename, const String& header, const St
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sendStringToWs(const String& header, String& payload, int client_id) {
|
void sendStringToWs(const String& header, String& payload, int client_id) {
|
||||||
if (!(WiFi.softAPgetStationNum() || isNetworkActive())) {
|
if ((!getNumAPClients() && !isNetworkActive()) || !getNumWSClients()) {
|
||||||
|
// standWebSocket.disconnect(); // это и ниже надо сделать при -
|
||||||
|
// standWebSocket.close(); // - отключении AP И WiFi(STA), надо менять ядро WiFi. Сейчас не закрывается сессия клиента при пропаже AP И WiFi(STA)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,3 +448,7 @@ void sendDeviceList(uint8_t num) {
|
|||||||
SerialPrint("i", "FS", "flash list");
|
SerialPrint("i", "FS", "flash list");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getNumWSClients() {
|
||||||
|
return standWebSocket.connectedClients(false);
|
||||||
|
}
|
||||||
@@ -11,11 +11,11 @@ void SerialPrint(const String& errorLevel, const String& module, const String& m
|
|||||||
tosend += msg;
|
tosend += msg;
|
||||||
Serial.println(tosend);
|
Serial.println(tosend);
|
||||||
|
|
||||||
if (isNetworkActive()) {
|
// if (isNetworkActive()) { // все проверки происходят в sendStringToWs()
|
||||||
if (jsonReadInt(settingsFlashJson, F("log")) != 0) {
|
if (jsonReadInt(settingsFlashJson, F("log")) != 0) {
|
||||||
sendStringToWs(F("corelg"), tosend, -1);
|
sendStringToWs(F("corelg"), tosend, -1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
if (errorLevel == "E") {
|
if (errorLevel == "E") {
|
||||||
cleanString(tosend);
|
cleanString(tosend);
|
||||||
|
|||||||
@@ -115,9 +115,13 @@ boolean RouterFind(String ssid) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// boolean isNetworkActive() {
|
boolean isNetworkActive() {
|
||||||
// return WiFi.status() == WL_CONNECTED;
|
return WiFi.status() == WL_CONNECTED;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
uint8_t getNumAPClients() {
|
||||||
|
return WiFi.softAPgetStationNum();
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t RSSIquality() {
|
uint8_t RSSIquality() {
|
||||||
uint8_t res = 0;
|
uint8_t res = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user