Skip to content

Commit

Permalink
Merge pull request #274 from OpenEVSE/jeremypoulter/issue251
Browse files Browse the repository at this point in the history
Fixed crash when enabling the access point/factory resetting via the button
  • Loading branch information
glynhudson authored Nov 29, 2021
2 parents 130ecf5 + 9016f61 commit b114567
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,17 @@ unsigned long LcdTask::loop(MicroTasks::WakeReason reason)
nextUpdate = nextInfoDelay;
}

DBUGVAR(nextUpdate);
return nextUpdate;
}

unsigned long LcdTask::displayNextMessage()
{
while(millis() >= _nextMessageTime)
while(_head && millis() >= _nextMessageTime)
{
// Pop a message from the queue
Message *msg = _head;
DBUGF("msg = %p", msg);
_head = _head->getNext();
if(NULL == _head) {
_tail = NULL;
Expand All @@ -282,7 +284,9 @@ unsigned long LcdTask::displayNextMessage()
_updateInfoLine = true;
}

return _nextMessageTime - millis();
unsigned long nextUpdate = _nextMessageTime - millis();
DBUGVAR(nextUpdate);
return nextUpdate;
}


Expand Down
4 changes: 3 additions & 1 deletion src/net_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ net_setup()
ETH.begin();
#endif

if (MDNS.begin(esp_hostname.c_str()))
if (MDNS.begin(esp_hostname.c_str()))
{
MDNS.addService("http", "tcp", 80);
MDNS.addService("openevse", "tcp", 80);
Expand Down Expand Up @@ -466,6 +466,8 @@ net_loop()
}
else if(false == apMessage && LOW == wifiButtonState && millis() > wifiButtonTimeOut + WIFI_BUTTON_AP_TIMEOUT)
{
DBUGLN("*** Enable Access Point ***");

lcd.display(F("Access Point"), 0, 0, 0, LCD_CLEAR_LINE | LCD_DISPLAY_NOW);
lcd.display(F(""), 0, 1, 10 * 1000, LCD_CLEAR_LINE | LCD_DISPLAY_NOW);
apMessage = true;
Expand Down

0 comments on commit b114567

Please sign in to comment.