mirror of
https://github.com/HASwitchPlate/HASPone.git
synced 2025-07-28 13:46:35 +00:00
Update HASPone branding
This commit is contained in:
parent
5c745745b9
commit
16a5695621
Binary file not shown.
@ -63,7 +63,7 @@ char nextionBaud[7] = "115200";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const float haspVersion = 1.04; // Current HASP software release version
|
||||
const float haspVersion = 1.04; // Current HASPone software release version
|
||||
const uint16_t mqttMaxPacketSize = 2048; // Size of buffer for incoming MQTT message
|
||||
byte nextionReturnBuffer[128]; // Byte array to pass around data coming from the panel
|
||||
uint8_t nextionReturnIndex = 0; // Index for nextionReturnBuffer
|
||||
@ -174,7 +174,7 @@ String lcdFirmwareUrl = "https://raw.githubusercontent.com/HASwitchPlate/HASPone
|
||||
void setup()
|
||||
{ // System setup
|
||||
debugPrint(String(F("\n\n================================================================================\n")));
|
||||
debugPrintln(String(F("SYSTEM: Starting HASwitchPlate v")) + String(haspVersion));
|
||||
debugPrintln(String(F("SYSTEM: Starting HASPone v")) + String(haspVersion));
|
||||
debugPrintln(String(F("SYSTEM: Last reset reason: ")) + String(ESP.getResetInfo()));
|
||||
debugPrintln(String(F("SYSTEM: heapFree: ")) + String(ESP.getFreeHeap()) + String(F(" heapMaxFreeBlockSize: ")) + String(ESP.getMaxFreeBlockSize()));
|
||||
debugPrintCrash();
|
||||
@ -1118,7 +1118,7 @@ void nextionProcessInput()
|
||||
}
|
||||
if (rebootOnp0b1 && (nextionPage == "0") && (nextionButtonID == "1"))
|
||||
{
|
||||
debugPrintln(String(F("HMI IN: p[0].b[1] pressed during HASP configuration, rebooting.")));
|
||||
debugPrintln(String(F("HMI IN: p[0].b[1] pressed during HASPone configuration, rebooting.")));
|
||||
espReset();
|
||||
}
|
||||
}
|
||||
@ -1715,7 +1715,7 @@ bool nextionConnect()
|
||||
}
|
||||
}
|
||||
|
||||
// Query backlight status. This should always succeed under simulation or non-HASP HMI
|
||||
// Query backlight status. This should always succeed under simulation or non-HASPone HMI
|
||||
lcdBacklightQueryFlag = true;
|
||||
debugPrintln(F("HMI: Querying LCD backlight status"));
|
||||
Serial1.write(nextionSuffix, sizeof(nextionSuffix));
|
||||
@ -1737,7 +1737,7 @@ bool nextionConnect()
|
||||
|
||||
// This check depends on the HMI having been designed with a version number in the object
|
||||
// defined in lcdVersionQuery. It's OK if this fails, it just means the HMI project is
|
||||
// not utilizing the version capability that the HASP project makes use of.
|
||||
// not utilizing the version capability that the HASPone project makes use of.
|
||||
lcdVersionQueryFlag = true;
|
||||
debugPrintln(F("HMI: Querying LCD firmware version number"));
|
||||
nextionSendCmd("get " + lcdVersionQuery);
|
||||
@ -1747,7 +1747,7 @@ bool nextionConnect()
|
||||
}
|
||||
if (lcdVersionQueryFlag)
|
||||
{ // Our flag is still set, meaning we never got a response. This should only happen if
|
||||
// there's a problem. Non-HASP projects should pass this check with lcdVersion = 0
|
||||
// there's a problem. Non-HASPone projects should pass this check with lcdVersion = 0
|
||||
debugPrintln(F("HMI: LCD version query timed out"));
|
||||
lcdVersionQueryFlag = false;
|
||||
return false;
|
||||
@ -1882,7 +1882,7 @@ void espWifiConnect()
|
||||
{ // We gave it a shot, still couldn't connect, so let WiFiManager run to make one last
|
||||
// connection attempt and then flip to AP mode to collect credentials from the user.
|
||||
|
||||
WiFiManagerParameter custom_haspNodeHeader("<br/><b>HASP Node</b>");
|
||||
WiFiManagerParameter custom_haspNodeHeader("<br/><b>HASPone Node</b>");
|
||||
WiFiManagerParameter custom_haspNode("haspNode", "<br/>Node Name <small>(required: lowercase letters, numbers, and _ only)</small>", haspNode, 15, " maxlength=15 required pattern='[a-z0-9_]*'");
|
||||
WiFiManagerParameter custom_groupName("groupName", "Group Name <small>(required)</small>", groupName, 15, " maxlength=15 required");
|
||||
WiFiManagerParameter custom_mqttHeader("<br/><br/><b>MQTT</b>");
|
||||
@ -2024,7 +2024,7 @@ void espWifiConfigCallback(WiFiManager *myWiFiManager)
|
||||
nextionSendCmd("page 0");
|
||||
}
|
||||
nextionSetAttr("p[0].b[1].font", "6");
|
||||
nextionSetAttr("p[0].b[1].txt", "\" HASP WiFi Setup\\r AP: " + String(wifiConfigAP) + "\\rPassword: " + String(wifiConfigPass) + "\\r\\r\\r\\r\\r\\r\\r http://192.168.4.1\"");
|
||||
nextionSetAttr("p[0].b[1].txt", "\" HASPone Setup\\r AP: " + String(wifiConfigAP) + "\\rPassword: " + String(wifiConfigPass) + "\\r\\r\\r\\r\\r\\r\\r http://192.168.4.1\"");
|
||||
nextionSendCmd("vis 3,1");
|
||||
}
|
||||
|
||||
@ -2039,14 +2039,14 @@ void espSetupOta()
|
||||
ArduinoOTA.onStart([]()
|
||||
{
|
||||
debugPrintln(F("ESP OTA: update start"));
|
||||
nextionSetAttr("p[0].b[1].txt", "\"\\rHASP update:\\r\\r\\r \"");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"\\rHASPone update:\\r\\r\\r \"");
|
||||
nextionSendCmd("page 0");
|
||||
nextionSendCmd("vis 4,1");
|
||||
});
|
||||
ArduinoOTA.onEnd([]()
|
||||
{
|
||||
debugPrintln(F("ESP OTA: update complete"));
|
||||
nextionSetAttr("p[0].b[1].txt", "\"\\rHASP update:\\r\\r Complete!\\rRestarting.\"");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"\\rHASPone update:\\r\\r Complete!\\rRestarting.\"");
|
||||
nextionSendCmd("vis 4,1");
|
||||
delay(1000);
|
||||
espReset();
|
||||
@ -2067,7 +2067,7 @@ void espSetupOta()
|
||||
else if (error == OTA_END_ERROR)
|
||||
debugPrintln(F("ESP OTA: ERROR - End Failed"));
|
||||
nextionSendCmd("vis 4,0");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"HASP update:\\r FAILED\\rerror: " + String(error) + "\"");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"HASPone update:\\r FAILED\\rerror: " + String(error) + "\"");
|
||||
delay(1000);
|
||||
nextionSendCmd("page " + String(nextionActivePage));
|
||||
});
|
||||
@ -2079,7 +2079,7 @@ void espSetupOta()
|
||||
void espStartOta(const String &espOtaUrl)
|
||||
{ // Update ESP firmware from HTTP/HTTPS URL
|
||||
|
||||
nextionSetAttr("p[0].b[1].txt", "\"\\rHASP update:\\r\\r\\r \"");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"\\rHASPone update:\\r\\r\\r \"");
|
||||
nextionSendCmd("page 0");
|
||||
nextionSendCmd("vis 4,1");
|
||||
|
||||
@ -2107,18 +2107,18 @@ void espStartOta(const String &espOtaUrl)
|
||||
case HTTP_UPDATE_FAILED:
|
||||
debugPrintln(String(F("ESPFW: HTTP_UPDATE_FAILED error ")) + String(ESPhttpUpdate.getLastError()) + " " + ESPhttpUpdate.getLastErrorString());
|
||||
nextionSendCmd("vis 4,0");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"HASP update:\\r FAILED\\rerror: " + ESPhttpUpdate.getLastErrorString() + "\"");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"HASPone update:\\r FAILED\\rerror: " + ESPhttpUpdate.getLastErrorString() + "\"");
|
||||
break;
|
||||
|
||||
case HTTP_UPDATE_NO_UPDATES:
|
||||
debugPrintln(F("ESPFW: HTTP_UPDATE_NO_UPDATES"));
|
||||
nextionSendCmd("vis 4,0");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"HASP update:\\rNo update\"");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"HASPone update:\\rNo update\"");
|
||||
break;
|
||||
|
||||
case HTTP_UPDATE_OK:
|
||||
debugPrintln(F("ESPFW: HTTP_UPDATE_OK"));
|
||||
nextionSetAttr("p[0].b[1].txt", "\"\\rHASP update:\\r\\r Complete!\\rRestarting.\"");
|
||||
nextionSetAttr("p[0].b[1].txt", "\"\\rHASPone update:\\r\\r Complete!\\rRestarting.\"");
|
||||
nextionSendCmd("vis 4,1");
|
||||
delay(1000);
|
||||
espReset();
|
||||
@ -2130,7 +2130,7 @@ void espStartOta(const String &espOtaUrl)
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void espReset()
|
||||
{
|
||||
debugPrintln(F("RESET: HASP reset"));
|
||||
debugPrintln(F("RESET: HASPone reset"));
|
||||
if (mqttClient.connected())
|
||||
{
|
||||
mqttClient.publish(mqttStateJSONTopic, String(F("{\"event_type\":\"hasp_device\",\"event\":\"offline\"}")));
|
||||
@ -2463,7 +2463,7 @@ void webHandleRoot()
|
||||
webServer.sendContent(F("<b>WiFi SSID</b> <i><small>(required)</small></i><input id='wifiSSID' required name='wifiSSID' maxlength=32 placeholder='WiFi SSID' value='"));
|
||||
webServer.sendContent(WiFi.SSID());
|
||||
webServer.sendContent(F("'><br/><b>WiFi Password</b> <i><small>(required)</small></i><input id='wifiPass' required name='wifiPass' type='password' maxlength=64 placeholder='WiFi Password' value='********'>"));
|
||||
webServer.sendContent(F("<br/><br/><b>HASP Node Name</b> <i><small>(required. lowercase letters, numbers, and _ only)</small></i><input id='haspNode' required name='haspNode' maxlength=15 placeholder='HASP Node Name' pattern='[a-z0-9_]*' value='"));
|
||||
webServer.sendContent(F("<br/><br/><b>HASPone Node Name</b> <i><small>(required. lowercase letters, numbers, and _ only)</small></i><input id='haspNode' required name='haspNode' maxlength=15 placeholder='HASPone Node Name' pattern='[a-z0-9_]*' value='"));
|
||||
webServer.sendContent(haspNode);
|
||||
webServer.sendContent(F("'><br/><b>Group Name</b> <i><small>(required)</small></i><input id='groupName' required name='groupName' maxlength=15 placeholder='Group Name' value='"));
|
||||
webServer.sendContent(groupName);
|
||||
@ -2501,12 +2501,12 @@ void webHandleRoot()
|
||||
}
|
||||
webServer.sendContent(F("'>"));
|
||||
|
||||
webServer.sendContent(F("<br/><br/><b>HASP Admin Username</b> <i><small>(optional)</small></i><input id='configUser' name='configUser' maxlength=31 placeholder='Admin User' value='"));
|
||||
webServer.sendContent(F("<br/><br/><b>HASPone Admin Username</b> <i><small>(optional)</small></i><input id='configUser' name='configUser' maxlength=31 placeholder='Admin User' value='"));
|
||||
if (strcmp(configUser, "") != 0)
|
||||
{
|
||||
webServer.sendContent(configUser);
|
||||
}
|
||||
webServer.sendContent(F("'><br/><b>HASP Admin Password</b> <i><small>(optional)</small></i><input id='configPassword' name='configPassword' type='password' maxlength=31 placeholder='Admin User Password' value='"));
|
||||
webServer.sendContent(F("'><br/><b>HASPone Admin Password</b> <i><small>(optional)</small></i><input id='configPassword' name='configPassword' type='password' maxlength=31 placeholder='Admin User Password' value='"));
|
||||
if (strcmp(configPassword, "") != 0)
|
||||
{
|
||||
webServer.sendContent(F("********"));
|
||||
@ -2524,7 +2524,7 @@ void webHandleRoot()
|
||||
webServer.sendContent(F("'><br/><hr>"));
|
||||
// Big menu of possible serial speeds
|
||||
if ((lcdVersion != 1) && (lcdVersion != 2))
|
||||
{ // HASP lcdVersion 1 and 2 have `bauds=115200` in the pre-init script of page 0. Don't show this option if either of those two versions are running.
|
||||
{ // HASPone lcdVersion 1 and 2 have `bauds=115200` in the pre-init script of page 0. Don't show this option if either of those two versions are running.
|
||||
webServer.sendContent(F("<b>LCD Serial Speed: </b><select id='nextionBaud' name='nextionBaud'>"));
|
||||
|
||||
for (unsigned int nextionSpeedsIndex = 0; nextionSpeedsIndex < nextionSpeedsLength; nextionSpeedsIndex++)
|
||||
@ -2590,11 +2590,11 @@ void webHandleRoot()
|
||||
|
||||
if (updateEspAvailable)
|
||||
{
|
||||
webServer.sendContent(F("<br/><hr><font color='green'><center><h3>HASP Update available!</h3></center></font>"));
|
||||
webServer.sendContent(F("<br/><hr><font color='green'><center><h3>HASPone Update available!</h3></center></font>"));
|
||||
webServer.sendContent(F("<form method='get' action='espfirmware'>"));
|
||||
webServer.sendContent(F("<input id='espFirmwareURL' type='hidden' name='espFirmware' value='"));
|
||||
webServer.sendContent(espFirmwareUrl);
|
||||
webServer.sendContent(F("'><button type='submit'>update HASP to v"));
|
||||
webServer.sendContent(F("'><button type='submit'>update HASPone to v"));
|
||||
webServer.sendContent(String(updateEspAvailableVersion));
|
||||
webServer.sendContent(F("</button></form>"));
|
||||
}
|
||||
@ -2646,14 +2646,14 @@ void webHandleRoot()
|
||||
{
|
||||
webServer.sendContent(mqttClientId);
|
||||
}
|
||||
webServer.sendContent(F("<br/><b>HASP Version: </b>"));
|
||||
webServer.sendContent(F("<br/><b>HASPone FW Version: </b>"));
|
||||
webServer.sendContent(String(haspVersion));
|
||||
webServer.sendContent(F("<br/><b>LCD Model: </b>"));
|
||||
if (nextionModel != "")
|
||||
{
|
||||
webServer.sendContent(nextionModel);
|
||||
}
|
||||
webServer.sendContent(F("<br/><b>LCD Version: </b>"));
|
||||
webServer.sendContent(F("<br/><b>LCD FW Version: </b>"));
|
||||
webServer.sendContent(String(lcdVersion));
|
||||
webServer.sendContent(F("<br/><b>LCD Active Page: </b>"));
|
||||
webServer.sendContent(String(nextionActivePage));
|
||||
@ -2983,7 +2983,7 @@ void webHandleFirmware()
|
||||
webServer.sendContent(F("<form method='get' action='/espfirmware'>"));
|
||||
if (updateEspAvailable)
|
||||
{
|
||||
webServer.sendContent(F("<font color='green'><b>HASP ESP8266 update available!</b></font>"));
|
||||
webServer.sendContent(F("<font color='green'><b>HASPone ESP8266 update available!</b></font>"));
|
||||
}
|
||||
webServer.sendContent(F("<br/><b>Update ESP8266 from URL</b>"));
|
||||
webServer.sendContent(F("<br/><input id='espFirmwareURL' name='espFirmware' value='"));
|
||||
@ -2996,12 +2996,12 @@ void webHandleFirmware()
|
||||
|
||||
webServer.sendContent(F("<br/><br/><hr><h1>WARNING!</h1>"));
|
||||
webServer.sendContent(F("<b>Nextion LCD firmware updates can be risky.</b> If interrupted, the LCD will display an error message until a successful firmware update has completed. "));
|
||||
webServer.sendContent(F("<br/><br/><i>Note: Failed LCD firmware updates on HASP hardware prior to v1.0 may require a hard power cycle of the device, via a circuit breaker or by physically disconnecting the device.</i>"));
|
||||
webServer.sendContent(F("<br/><br/><i>Note: Failed LCD firmware updates on HASPone hardware prior to v1.0 may require a hard power cycle of the device, via a circuit breaker or by physically disconnecting the device.</i>"));
|
||||
|
||||
webServer.sendContent(F("<br/><hr><form method='get' action='lcddownload'>"));
|
||||
if (updateLcdAvailable)
|
||||
{
|
||||
webServer.sendContent(F("<font color='green'><b>HASP LCD update available!</b></font>"));
|
||||
webServer.sendContent(F("<font color='green'><b>HASPone LCD update available!</b></font>"));
|
||||
}
|
||||
webServer.sendContent(F("<br/><b>Update Nextion LCD from URL</b><small><i> http only</i></small>"));
|
||||
webServer.sendContent(F("<br/><input id='lcdFirmware' name='lcdFirmware' value='"));
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user