mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: review fixes for step 4a
- e2e: the heap check uses a socket slot now, so it waits for the device to free it, and test_every_client_reconnecting_at_once closes its clients before the check runs. - Comments and docs that still named removed things (the /controller read, the event buffer, memStatus, SocketEmitter, ModelSnapshot). - ESPNetwork::emitSockets is emitStatus: one socket, and it sends the status. - Unused includes, whitespace-only lines left by the toJSON removal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2a954aa158
commit
cfa298f053
13 changed files with 26 additions and 23 deletions
|
|
@ -45,7 +45,7 @@ class BaseSettings {
|
|||
public:
|
||||
bool loadFile(const char* filename);
|
||||
bool fromJSON(JsonObject &obj);
|
||||
|
||||
|
||||
bool parseIPAddress(JsonObject &obj, const char *prop, IPAddress *);
|
||||
bool parseValueString(JsonObject &obj, const char *prop, char *dest, size_t size);
|
||||
int parseValueInt(JsonObject &obj, const char *prop, int defVal);
|
||||
|
|
@ -58,7 +58,7 @@ class NTPSettings: BaseSettings {
|
|||
char ntpServer[65] = "pool.ntp.org";
|
||||
char posixZone[64] = "";
|
||||
bool fromJSON(JsonObject &obj);
|
||||
|
||||
|
||||
bool apply();
|
||||
bool begin();
|
||||
bool save();
|
||||
|
|
@ -75,7 +75,7 @@ class WifiSettings: BaseSettings {
|
|||
//bool ssdpBroadcast = true;
|
||||
bool begin();
|
||||
bool fromJSON(JsonObject &obj);
|
||||
|
||||
|
||||
String mapEncryptionType(int type);
|
||||
bool ssidExists(const char *ssid);
|
||||
void printNetworks();
|
||||
|
|
@ -99,7 +99,7 @@ class EthernetSettings: BaseSettings {
|
|||
|
||||
bool begin();
|
||||
bool fromJSON(JsonObject &obj);
|
||||
|
||||
|
||||
bool load();
|
||||
bool save();
|
||||
void print();
|
||||
|
|
@ -117,7 +117,7 @@ class IPSettings: BaseSettings {
|
|||
IPAddress dns2 = IPAddress(0,0,0,0);
|
||||
bool begin();
|
||||
bool fromJSON(JsonObject &obj);
|
||||
|
||||
|
||||
bool load();
|
||||
bool save();
|
||||
void print();
|
||||
|
|
@ -141,7 +141,7 @@ class SecuritySettings: BaseSettings {
|
|||
bool save();
|
||||
bool load();
|
||||
void print();
|
||||
|
||||
|
||||
bool fromJSON(JsonObject &obj);
|
||||
};
|
||||
class MQTTSettings: BaseSettings {
|
||||
|
|
@ -158,7 +158,7 @@ class MQTTSettings: BaseSettings {
|
|||
bool begin();
|
||||
bool save();
|
||||
bool load();
|
||||
|
||||
|
||||
bool fromJSON(JsonObject &obj);
|
||||
};
|
||||
class ConfigSettings: BaseSettings {
|
||||
|
|
@ -185,7 +185,7 @@ class ConfigSettings: BaseSettings {
|
|||
SecuritySettings Security;
|
||||
bool requiresAuth();
|
||||
bool fromJSON(JsonObject &obj);
|
||||
|
||||
|
||||
bool begin();
|
||||
bool save();
|
||||
bool load();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "esp_log.h"
|
||||
#include "ConfigSettings.h"
|
||||
#include "ESPNetwork.h"
|
||||
#include "entryPoints/Web.h"
|
||||
#include "Somfy.h"
|
||||
#include "outputs/ProtoSocket.h"
|
||||
#include "Utils.h"
|
||||
#include "SSDP.h"
|
||||
|
|
@ -14,7 +14,6 @@
|
|||
static const char *TAG = "Network";
|
||||
|
||||
extern ConfigSettings settings;
|
||||
extern Web webServer;
|
||||
extern MqttConnection mqtt;
|
||||
extern rebootDelay_t rebootDelay;
|
||||
extern ESPNetwork net;
|
||||
|
|
@ -172,7 +171,7 @@ void ESPNetwork::loop() {
|
|||
}
|
||||
if(millis() - this->lastEmit >= STATUS_EMIT_MS) {
|
||||
this->lastEmit = millis();
|
||||
if(this->connected()) this->emitSockets();
|
||||
if(this->connected()) this->emitStatus();
|
||||
resetTaskWdt(); // Make sure we do not reboot here.
|
||||
}
|
||||
|
||||
|
|
@ -198,7 +197,7 @@ bool ESPNetwork::changeAP(const uint8_t *bssid, const int32_t channel) {
|
|||
}
|
||||
// The status broadcast, every STATUS_EMIT_MS from loop(). A wired link goes
|
||||
// out every time, the WiFi signal only when it really changed.
|
||||
void ESPNetwork::emitSockets() {
|
||||
void ESPNetwork::emitStatus() {
|
||||
this->emitHeap();
|
||||
#if HAS_ETHERNET
|
||||
if(this->connType == conn_types_t::ethernet) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class ESPNetwork {
|
|||
bool setup();
|
||||
void loop();
|
||||
void end();
|
||||
void emitSockets();
|
||||
void emitStatus();
|
||||
void emitHeap();
|
||||
uint32_t getChipId();
|
||||
static void networkEvent(WiFiEvent_t event);
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ void setup() {
|
|||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
//uint32_t heap = ESP.getFreeHeap();
|
||||
// Times the whole pass for memStatus, including any time the loop task was
|
||||
// Times the whole pass for the memory event, including any time the loop task was
|
||||
// pre-empted, since that delays the loop too.
|
||||
ElapsedTimer pass;
|
||||
if(rebootDelay.reboot && millis() > rebootDelay.rebootTime) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void registerHttpRoutes(AsyncWebServer &server) {
|
|||
root["serverId"] = settings.serverId;
|
||||
root["version"] = settings.fwVersion.name;
|
||||
root["model"] = "ESPSomfyRTS";
|
||||
root["hostname"] = settings.hostname;
|
||||
root["hostname"] = settings.hostname;
|
||||
response->setLength();
|
||||
request->send(response);
|
||||
});
|
||||
|
|
@ -92,7 +92,7 @@ void registerHttpRoutes(AsyncWebServer &server) {
|
|||
JsonDocument doc;
|
||||
DeserializationError err = deserializeJson(doc, dataStr);
|
||||
if(err) {
|
||||
request->send(500, "application/json", "{\"status\":\"ERROR\",\"desc\":\"JSON parse error\"}");
|
||||
request->send(500, _encoding_json, "{\"status\":\"ERROR\",\"desc\":\"JSON parse error\"}");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include "Somfy.h"
|
||||
#include "WResp.h"
|
||||
#include "LoopQueue.h"
|
||||
#include "ItemSnapshot.h"
|
||||
#include "SomfySnapshot.h"
|
||||
#include "Web.h"
|
||||
#include "WebRoutes.h"
|
||||
|
|
|
|||
|
|
@ -804,7 +804,7 @@ void ProtoSocket::wifiNetworks(int16_t count) {
|
|||
}
|
||||
}
|
||||
bool ProtoSocket::subscribed(proto_feed_t feed) const {
|
||||
// The feed is formatted into the event buffer, which is loop()'s.
|
||||
// The feed is formatted into the frame buffer, which is loop()'s.
|
||||
if(!onLoopTask()) return false;
|
||||
const uint8_t bit = 1 << static_cast<uint8_t>(feed);
|
||||
for(const proto_slot_t &s : slots)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue