Skip to content

Commit b114567

Browse files
authored
Merge pull request #274 from OpenEVSE/jeremypoulter/issue251
Fixed crash when enabling the access point/factory resetting via the button
2 parents 130ecf5 + 9016f61 commit b114567

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/lcd.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,17 @@ unsigned long LcdTask::loop(MicroTasks::WakeReason reason)
256256
nextUpdate = nextInfoDelay;
257257
}
258258

259+
DBUGVAR(nextUpdate);
259260
return nextUpdate;
260261
}
261262

262263
unsigned long LcdTask::displayNextMessage()
263264
{
264-
while(millis() >= _nextMessageTime)
265+
while(_head && millis() >= _nextMessageTime)
265266
{
266267
// Pop a message from the queue
267268
Message *msg = _head;
269+
DBUGF("msg = %p", msg);
268270
_head = _head->getNext();
269271
if(NULL == _head) {
270272
_tail = NULL;
@@ -282,7 +284,9 @@ unsigned long LcdTask::displayNextMessage()
282284
_updateInfoLine = true;
283285
}
284286

285-
return _nextMessageTime - millis();
287+
unsigned long nextUpdate = _nextMessageTime - millis();
288+
DBUGVAR(nextUpdate);
289+
return nextUpdate;
286290
}
287291

288292

src/net_manager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ net_setup()
408408
ETH.begin();
409409
#endif
410410

411-
if (MDNS.begin(esp_hostname.c_str()))
411+
if (MDNS.begin(esp_hostname.c_str()))
412412
{
413413
MDNS.addService("http", "tcp", 80);
414414
MDNS.addService("openevse", "tcp", 80);
@@ -466,6 +466,8 @@ net_loop()
466466
}
467467
else if(false == apMessage && LOW == wifiButtonState && millis() > wifiButtonTimeOut + WIFI_BUTTON_AP_TIMEOUT)
468468
{
469+
DBUGLN("*** Enable Access Point ***");
470+
469471
lcd.display(F("Access Point"), 0, 0, 0, LCD_CLEAR_LINE | LCD_DISPLAY_NOW);
470472
lcd.display(F(""), 0, 1, 10 * 1000, LCD_CLEAR_LINE | LCD_DISPLAY_NOW);
471473
apMessage = true;

0 commit comments

Comments
 (0)