HTTP, MQTT and PSRAM fixes
This commit is contained in:
37
boards/nuki-esp32dev.json
Normal file
37
boards/nuki-esp32dev.json
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino":{
|
||||||
|
"ldscript": "esp32_out.ld"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue",
|
||||||
|
"f_cpu": "240000000L",
|
||||||
|
"f_flash": "40000000L",
|
||||||
|
"flash_mode": "dio",
|
||||||
|
"mcu": "esp32",
|
||||||
|
"variant": "esp32"
|
||||||
|
},
|
||||||
|
"connectivity": [
|
||||||
|
"wifi",
|
||||||
|
"bluetooth",
|
||||||
|
"ethernet",
|
||||||
|
"can"
|
||||||
|
],
|
||||||
|
"debug": {
|
||||||
|
"openocd_board": "esp-wroom-32.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"arduino",
|
||||||
|
"espidf"
|
||||||
|
],
|
||||||
|
"name": "Espressif ESP32 Dev Module",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "4MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 4194304,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 460800
|
||||||
|
},
|
||||||
|
"url": "https://en.wikipedia.org/wiki/ESP32",
|
||||||
|
"vendor": "AI Thinker"
|
||||||
|
}
|
||||||
@@ -69,7 +69,7 @@ monitor_filters =
|
|||||||
time
|
time
|
||||||
|
|
||||||
[env:esp32]
|
[env:esp32]
|
||||||
board = esp32dev
|
board = nuki-esp32dev
|
||||||
board_build.cmake_extra_args =
|
board_build.cmake_extra_args =
|
||||||
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.defaults.esp32"
|
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.defaults.esp32"
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
|
|||||||
@@ -461,8 +461,13 @@ bool NukiNetwork::update()
|
|||||||
|
|
||||||
if(_lastMaintenanceTs == 0 || (ts - _lastMaintenanceTs) > 30000)
|
if(_lastMaintenanceTs == 0 || (ts - _lastMaintenanceTs) > 30000)
|
||||||
{
|
{
|
||||||
publishULong(_maintenancePathPrefix, mqtt_topic_uptime, ts / 1000 / 60, true);
|
int64_t curUptime = ts / 1000 / 60;
|
||||||
publishString(_maintenancePathPrefix, mqtt_topic_mqtt_connection_state, "online", true);
|
if(curUptime > _publishedUpTime)
|
||||||
|
{
|
||||||
|
publishULong(_maintenancePathPrefix, mqtt_topic_uptime, curUptime, true);
|
||||||
|
_publishedUpTime = curUptime;
|
||||||
|
}
|
||||||
|
//publishString(_maintenancePathPrefix, mqtt_topic_mqtt_connection_state, "online", true);
|
||||||
|
|
||||||
if(_lastMaintenanceTs == 0)
|
if(_lastMaintenanceTs == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ private:
|
|||||||
bool _connectReplyReceived = false;
|
bool _connectReplyReceived = false;
|
||||||
bool _firstDisconnected = true;
|
bool _firstDisconnected = true;
|
||||||
|
|
||||||
|
int64_t _publishedUpTime = 0;
|
||||||
int64_t _nextReconnect = 0;
|
int64_t _nextReconnect = 0;
|
||||||
char _mqttBrokerAddr[101] = {0};
|
char _mqttBrokerAddr[101] = {0};
|
||||||
char _mqttUser[31] = {0};
|
char _mqttUser[31] = {0};
|
||||||
|
|||||||
@@ -292,14 +292,31 @@ void WebCfgServer::initialize()
|
|||||||
{
|
{
|
||||||
return request->requestAuthentication(BASIC_AUTH, "Nuki Hub", "You must log in.");
|
return request->requestAuthentication(BASIC_AUTH, "Nuki Hub", "You must log in.");
|
||||||
}
|
}
|
||||||
if(_allowRestartToPortal)
|
String value = "";
|
||||||
|
if(request->hasParam("CONFIRMTOKEN"))
|
||||||
{
|
{
|
||||||
esp_err_t res = buildConfirmHtml(request, "Restarting. Connect to ESP access point (\"NukiHub\" with password \"NukiHubESP32\") to reconfigure Wi-Fi.", 0);
|
const PsychicWebParameter* p = request->getParam("CONFIRMTOKEN");
|
||||||
waitAndProcess(false, 1000);
|
if(p->value() != "")
|
||||||
_network->reconfigureDevice();
|
{
|
||||||
return res;
|
value = p->value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return(ESP_OK);
|
else
|
||||||
|
{
|
||||||
|
return buildConfirmHtml(request, "No confirm code set.", 3, true);
|
||||||
|
}
|
||||||
|
if(value != _confirmCode)
|
||||||
|
{
|
||||||
|
return request->redirect("/");
|
||||||
|
}
|
||||||
|
if(!_allowRestartToPortal)
|
||||||
|
{
|
||||||
|
return buildConfirmHtml(request, "Can't reset WiFi when network device is Ethernet", 3, true);
|
||||||
|
}
|
||||||
|
esp_err_t res = buildConfirmHtml(request, "Restarting. Connect to ESP access point (\"NukiHub\" with password \"NukiHubESP32\") to reconfigure Wi-Fi.", 0);
|
||||||
|
waitAndProcess(false, 1000);
|
||||||
|
_network->reconfigureDevice();
|
||||||
|
return res;
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
_psychicServer->on("/unpairlock", HTTP_POST, [&](PsychicRequest *request)
|
_psychicServer->on("/unpairlock", HTTP_POST, [&](PsychicRequest *request)
|
||||||
@@ -3363,37 +3380,37 @@ esp_err_t WebCfgServer::buildHtml(PsychicRequest *request)
|
|||||||
printParameter(&response, "Nuki Opener PIN status", openerState.c_str(), "", "openerPin");
|
printParameter(&response, "Nuki Opener PIN status", openerState.c_str(), "", "openerPin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printParameter(&response, "Firmware", NUKI_HUB_VERSION, "/info", "firmware");
|
printParameter(&response, "Firmware", NUKI_HUB_VERSION, "/info?", "firmware");
|
||||||
if(_preferences->getBool(preference_check_updates))
|
if(_preferences->getBool(preference_check_updates))
|
||||||
{
|
{
|
||||||
printParameter(&response, "Latest Firmware", _preferences->getString(preference_latest_version).c_str(), "/ota", "ota");
|
printParameter(&response, "Latest Firmware", _preferences->getString(preference_latest_version).c_str(), "/ota?", "ota");
|
||||||
}
|
}
|
||||||
response.print("</table><br>");
|
response.print("</table><br>");
|
||||||
response.print("<ul id=\"tblnav\">");
|
response.print("<ul id=\"tblnav\">");
|
||||||
buildNavigationMenuEntry(&response, "Network Configuration", "/ntwconfig");
|
buildNavigationMenuEntry(&response, "Network Configuration", "/ntwconfig?");
|
||||||
buildNavigationMenuEntry(&response, "MQTT Configuration", "/mqttconfig", _brokerConfigured ? "" : "Please configure MQTT broker");
|
buildNavigationMenuEntry(&response, "MQTT Configuration", "/mqttconfig?", _brokerConfigured ? "" : "Please configure MQTT broker");
|
||||||
buildNavigationMenuEntry(&response, "Nuki Configuration", "/nukicfg");
|
buildNavigationMenuEntry(&response, "Nuki Configuration", "/nukicfg?");
|
||||||
buildNavigationMenuEntry(&response, "Access Level Configuration", "/acclvl");
|
buildNavigationMenuEntry(&response, "Access Level Configuration", "/acclvl?");
|
||||||
buildNavigationMenuEntry(&response, "Credentials", "/cred", _pinsConfigured ? "" : "Please configure PIN");
|
buildNavigationMenuEntry(&response, "Credentials", "/cred?", _pinsConfigured ? "" : "Please configure PIN");
|
||||||
buildNavigationMenuEntry(&response, "GPIO Configuration", "/gpiocfg");
|
buildNavigationMenuEntry(&response, "GPIO Configuration", "/gpiocfg?");
|
||||||
buildNavigationMenuEntry(&response, "Firmware update", "/ota");
|
buildNavigationMenuEntry(&response, "Firmware update", "/ota?");
|
||||||
buildNavigationMenuEntry(&response, "Import/Export Configuration", "/impexpcfg");
|
buildNavigationMenuEntry(&response, "Import/Export Configuration", "/impexpcfg?");
|
||||||
if(_preferences->getInt(preference_network_hardware, 0) == 11)
|
if(_preferences->getInt(preference_network_hardware, 0) == 11)
|
||||||
{
|
{
|
||||||
buildNavigationMenuEntry(&response, "Custom Ethernet Configuration", "/custntw");
|
buildNavigationMenuEntry(&response, "Custom Ethernet Configuration", "/custntw?");
|
||||||
}
|
}
|
||||||
if (_preferences->getBool(preference_publish_debug_info, false))
|
if (_preferences->getBool(preference_publish_debug_info, false))
|
||||||
{
|
{
|
||||||
buildNavigationMenuEntry(&response, "Advanced Configuration", "/advanced");
|
buildNavigationMenuEntry(&response, "Advanced Configuration", "/advanced?");
|
||||||
}
|
}
|
||||||
if(_preferences->getBool(preference_webserial_enabled, false))
|
if(_preferences->getBool(preference_webserial_enabled, false))
|
||||||
{
|
{
|
||||||
buildNavigationMenuEntry(&response, "Open Webserial", "/webserial");
|
buildNavigationMenuEntry(&response, "Open Webserial", "/webserial?");
|
||||||
}
|
}
|
||||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||||
if(_allowRestartToPortal)
|
if(_allowRestartToPortal)
|
||||||
{
|
{
|
||||||
buildNavigationMenuEntry(&response, "Configure Wi-Fi", "/wifi");
|
buildNavigationMenuEntry(&response, "Configure Wi-Fi", "/wifi?");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
String rebooturl = "/reboot?CONFIRMTOKEN=" + _confirmCode;
|
String rebooturl = "/reboot?CONFIRMTOKEN=" + _confirmCode;
|
||||||
@@ -4002,7 +4019,8 @@ esp_err_t WebCfgServer::buildConfigureWifiHtml(PsychicRequest *request)
|
|||||||
buildHtmlHeader(&response);
|
buildHtmlHeader(&response);
|
||||||
response.print("<h3>Wi-Fi</h3>");
|
response.print("<h3>Wi-Fi</h3>");
|
||||||
response.print("Click confirm to remove saved WiFi settings and restart ESP into Wi-Fi configuration mode. After restart, connect to ESP access point to reconfigure Wi-Fi.<br><br>");
|
response.print("Click confirm to remove saved WiFi settings and restart ESP into Wi-Fi configuration mode. After restart, connect to ESP access point to reconfigure Wi-Fi.<br><br>");
|
||||||
buildNavigationButton(&response, "Confirm", "/wifimanager");
|
String wifiMgrUrl = "/wifimanager?CONFIRMTOKEN=" + _confirmCode;
|
||||||
|
buildNavigationButton(&response, "Confirm", wifiMgrUrl.c_str());
|
||||||
response.print("</body></html>");
|
response.print("</body></html>");
|
||||||
return response.endSend();
|
return response.endSend();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ monitor_filters =
|
|||||||
time
|
time
|
||||||
|
|
||||||
[env:updater_esp32]
|
[env:updater_esp32]
|
||||||
board = esp32dev
|
board = nuki-esp32dev
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
pre:pio_package_pre.py
|
pre:pio_package_pre.py
|
||||||
post:pio_package_post.py
|
post:pio_package_post.py
|
||||||
|
|||||||
Reference in New Issue
Block a user