Update Tasks

This commit is contained in:
iranl
2024-05-26 19:25:45 +02:00
parent 699d9a148a
commit acad87b308
15 changed files with 416 additions and 265 deletions

View File

@@ -475,32 +475,63 @@ bool WebCfgServer::processArgs(String& message)
}
else if(key == "TSKNTWK")
{
if(value.toInt() > 12287 && value.toInt() < 32769)
{
_preferences->putInt(preference_task_size_network, value.toInt());
configChanged = true;
}
}
else if(key == "TSKNUKI")
{
_preferences->putInt(preference_task_size_nuki, value.toInt());
configChanged = true;
if(value.toInt() > 8191 && value.toInt() < 32769)
{
_preferences->putInt(preference_task_size_nuki, value.toInt());
configChanged = true;
}
}
else if(key == "TSKPD")
{
_preferences->putInt(preference_task_size_pd, value.toInt());
configChanged = true;
if(value.toInt() > 1023 && value.toInt() < 4049)
{
_preferences->putInt(preference_task_size_pd, value.toInt());
configChanged = true;
}
}
else if(key == "ALMAX")
{
_preferences->putInt(preference_authlog_max_entries, value.toInt());
configChanged = true;
if(value.toInt() > 0 && value.toInt() < 51)
{
_preferences->putInt(preference_authlog_max_entries, value.toInt());
configChanged = true;
}
}
else if(key == "KPMAX")
{
_preferences->putInt(preference_keypad_max_entries, value.toInt());
configChanged = true;
if(value.toInt() > 0 && value.toInt() < 101)
{
_preferences->putInt(preference_keypad_max_entries, value.toInt());
configChanged = true;
}
}
else if(key == "TCMAX")
{
_preferences->putInt(preference_timecontrol_max_entries, value.toInt());
if(value.toInt() > 0 && value.toInt() < 51)
{
_preferences->putInt(preference_timecontrol_max_entries, value.toInt());
configChanged = true;
}
}
else if(key == "BUFFSIZE")
{
if(value.toInt() > 4095 && value.toInt() < 32769)
{
_preferences->putInt(preference_buffer_size, value.toInt());
configChanged = true;
}
}
else if(key == "BTLPRST")
{
_preferences->putBool(preference_enable_bootloop_reset, (value == "1"));
configChanged = true;
}
else if(key == "ACLLVLCHANGED")
@@ -1121,8 +1152,13 @@ void WebCfgServer::buildHtml(String& response)
buildNavigationButton(response, "Edit", "/gpiocfg");
response.concat("</td></tr><tr><td><h5>Firmware update</h5></td><td class=\"tdbtn\">");
buildNavigationButton(response, "Open", "/ota");
response.concat("</td></tr><tr><td><h5>Advanced Configuration</h5></td><td class=\"tdbtn\">");
buildNavigationButton(response, "Edit", "/advanced");
if(_preferences->getBool(preference_publish_debug_info, false))
{
response.concat("</td></tr><tr><td><h5>Advanced Configuration</h5></td><td class=\"tdbtn\">");
buildNavigationButton(response, "Edit", "/advanced");
}
response.concat("</td></tr>");
if(_allowRestartToPortal)
@@ -1304,12 +1340,17 @@ void WebCfgServer::buildAdvancedConfigHtml(String &response)
response.concat("<h3>Advanced Configuration</h3>");
response.concat("<h4 style=\"color: #ff0000\">Warning: Changing these settings can lead to bootloops that might require you to erase the ESP32 and reflash nukihub using USB/serial</h4>");
response.concat("<table>");
printInputField(response, "TSKNTWK", "Task size Network", _preferences->getInt(preference_task_size_network, 12288), 6);
printInputField(response, "TSKNUKI", "Task size Nuki", _preferences->getInt(preference_task_size_nuki, 8192), 6);
printInputField(response, "TSKPD", "Task size Presence Detection", _preferences->getInt(preference_task_size_pd, 1024), 6);
printInputField(response, "ALMAX", "Max auth log entries", _preferences->getInt(preference_authlog_max_entries, 5), 3);
printInputField(response, "KPMAX", "Max keypad entries", _preferences->getInt(preference_keypad_max_entries, 10), 3);
printInputField(response, "TCMAX", "Max timecontrol entries", _preferences->getInt(preference_timecontrol_max_entries, 10), 3);
response.concat("<tr><td>Current bootloop prevention state</td><td>");
response.concat(_preferences->getBool(preference_enable_bootloop_reset, false) ? "Enabled" : "Disabled");
response.concat("</td></tr>");
printCheckBox(response, "BTLPRST", "Enable Bootloop prevention (Try to reset these settings to default on bootloop)", true, "");
printInputField(response, "BUFFSIZE", "Char buffer size (min 4096, max 32768)", _preferences->getInt(preference_buffer_size, CHAR_BUFFER_SIZE), 6);
printInputField(response, "TSKNTWK", "Task size Network (min 12288, max 32768)", _preferences->getInt(preference_task_size_network, NETWORK_TASK_SIZE), 6);
printInputField(response, "TSKNUKI", "Task size Nuki (min 8192, max 32768)", _preferences->getInt(preference_task_size_nuki, NUKI_TASK_SIZE), 6);
printInputField(response, "TSKPD", "Task size Presence Detection (min 1024, max 4048)", _preferences->getInt(preference_task_size_pd, PD_TASK_SIZE), 6);
printInputField(response, "ALMAX", "Max auth log entries (min 1, max 50)", _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 3);
printInputField(response, "KPMAX", "Max keypad entries (min 1, max 100)", _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD), 3);
printInputField(response, "TCMAX", "Max timecontrol entries (min 1, max 50)", _preferences->getInt(preference_timecontrol_max_entries, MAX_TIMECONTROL), 3);
response.concat("</table>");
response.concat("<br><input type=\"submit\" name=\"submit\" value=\"Save\">");