From 591a6689019eaa28bec03256a45c325495aabdfe Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Tue, 17 Jan 2023 20:46:52 +0100 Subject: [PATCH] Fixed issue when selecting new device profile --- src/WebApi_device.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/WebApi_device.cpp b/src/WebApi_device.cpp index 0e26dae..e363869 100644 --- a/src/WebApi_device.cpp +++ b/src/WebApi_device.cpp @@ -98,7 +98,7 @@ void WebApiDeviceClass::onDeviceAdminPost(AsyncWebServerRequest* request) return; } - if (!(root.containsKey("dev_pinmapping"))) { + if (!(root.containsKey("curPin"))) { retMsg[F("message")] = F("Values are missing!"); retMsg[F("code")] = WebApiError::GenericValueMissing; response->setLength(); @@ -106,7 +106,7 @@ void WebApiDeviceClass::onDeviceAdminPost(AsyncWebServerRequest* request) return; } - if (root[F("dev_pinmapping")].as().length() == 0 || root[F("dev_pinmapping")].as().length() > DEV_MAX_MAPPING_NAME_STRLEN) { + if (root[F("curPin")][F("name")].as().length() == 0 || root[F("curPin")][F("name")].as().length() > DEV_MAX_MAPPING_NAME_STRLEN) { retMsg[F("message")] = F("Pin mapping must between 1 and " STR(DEV_MAX_MAPPING_NAME_STRLEN) " characters long!"); retMsg[F("code")] = WebApiError::HardwarePinMappingLength; retMsg[F("param")][F("max")] = DEV_MAX_MAPPING_NAME_STRLEN; @@ -116,7 +116,7 @@ void WebApiDeviceClass::onDeviceAdminPost(AsyncWebServerRequest* request) } CONFIG_T& config = Configuration.get(); - strlcpy(config.Dev_PinMapping, root[F("dev_pinmapping")].as().c_str(), sizeof(config.Dev_PinMapping)); + strlcpy(config.Dev_PinMapping, root[F("curPin")][F("name")].as().c_str(), sizeof(config.Dev_PinMapping)); Configuration.write(); retMsg[F("type")] = F("success");