Skip to content

Commit 0d285c1

Browse files
committed
minor changes
1 parent 7fbf678 commit 0d285c1

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

bin/deploydebug.bin

-32 Bytes
Binary file not shown.

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ AsyncWebSocket ws("/ws");
143143
#define BEEPERon LOW
144144

145145
// Variables for whole scope
146+
bool configured = false;
146147
unsigned long cooldown = 0;
147148
unsigned long currentMillis = 0;
148149
unsigned long deltaTime = 0;
@@ -282,7 +283,6 @@ void setup()
282283
delay(700);
283284
io2.setRelay(RELAY2, OFF);
284285
#endif
285-
bool configured = false;
286286
configured = loadConfiguration(config);
287287
// ethernet setup
288288
setupEth();

src/websocket.esp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ void addWsMessageToQueue(AsyncWebSocketClient *client, int messageSize)
3939
void processWsMessage(WsMessage *incomingMessage)
4040
{
4141
// We should always get a JSON object (stringfied) from browser, so parse it
42-
// DynamicJsonDocument root(2448);
4342
JsonDocument root;
4443
AsyncWebSocketClient *client = incomingMessage->client;
4544
// cast to const char * to avoid in-place editing of serializedMessage
@@ -217,8 +216,9 @@ void processWsMessage(WsMessage *incomingMessage)
217216
lastNTPepoch = t;
218217
sendTime(client);
219218
}
220-
else if (strcmp(command, "getconf") == 0)
219+
else if (strcmp(command, "getconf") == 0 && configured)
221220
{
221+
Serial.println(F("[ WARN ] getconf executing"));
222222
File configFile = LittleFS.open("/config.json", "r");
223223
if (configFile)
224224
{
@@ -232,6 +232,7 @@ void processWsMessage(WsMessage *incomingMessage)
232232
configFile.close();
233233
}
234234
}
235+
235236
free(incomingMessage->serializedMessage);
236237
free(incomingMessage);
237238
yield();

src/wsResponses.esp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ void sendStatus(AsyncWebSocketClient *client)
191191
root["dnseth"] = printIP(dnseth);
192192
root["maceth"] = config.ethmac;
193193
root["speedeth"] = config.ethlink;
194-
195194
size_t len = measureJson(root);
196195
AsyncWebSocketMessageBuffer *buffer = ws.makeBuffer(len);
196+
197197
if (buffer)
198198
{
199199
serializeJson(root, (char *)buffer->get(), len + 1);

0 commit comments

Comments
 (0)