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");