diff --git a/platformio.ini b/platformio.ini index e46b09f6..dc020120 100644 --- a/platformio.ini +++ b/platformio.ini @@ -79,6 +79,7 @@ upload_protocol = esptool [env:generic_esp32] board = esp32dev build_flags = ${env.build_flags} + -DPIN_MAPPING_REQUIRED=1 [env:generic_esp32_16mb_psram] @@ -87,6 +88,7 @@ board_build.flash_mode = qio board_build.partitions = partitions_custom_16mb.csv board_upload.flash_size = 16MB build_flags = ${env.build_flags} + -DPIN_MAPPING_REQUIRED=1 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue @@ -95,6 +97,7 @@ build_flags = ${env.build_flags} board = esp32-c3-devkitc-02 custom_patches = ${env.custom_patches} build_flags = ${env.build_flags} + -DPIN_MAPPING_REQUIRED=1 [env:generic_esp32c3_usb] @@ -103,11 +106,13 @@ custom_patches = ${env.custom_patches} build_flags = ${env.build_flags} -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 + -DPIN_MAPPING_REQUIRED=1 [env:generic_esp32s3] board = esp32-s3-devkitc-1 build_flags = ${env.build_flags} + -DPIN_MAPPING_REQUIRED=1 [env:generic_esp32s3_usb] @@ -116,6 +121,7 @@ upload_protocol = esp-builtin build_flags = ${env.build_flags} -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 + -DPIN_MAPPING_REQUIRED=1 [env:generic] diff --git a/src/WebApi_ws_live.cpp b/src/WebApi_ws_live.cpp index 5a27f324..5a7180a6 100644 --- a/src/WebApi_ws_live.cpp +++ b/src/WebApi_ws_live.cpp @@ -10,6 +10,10 @@ #include "defaults.h" #include +#ifndef PIN_MAPPING_REQUIRED + #define DPIN_MAPPING_REQUIRED 0 +#endif + WebApiWsLiveClass::WebApiWsLiveClass() : _ws("/livedata") , _wsCleanupTask(1 * TASK_SECOND, TASK_FOREVER, std::bind(&WebApiWsLiveClass::wsCleanupTaskCb, this)) @@ -126,8 +130,7 @@ void WebApiWsLiveClass::generateCommonJsonResponse(JsonVariant& root) hintObj["radio_problem"] = (Hoymiles.getRadioNrf()->isInitialized() && (!Hoymiles.getRadioNrf()->isConnected() || !Hoymiles.getRadioNrf()->isPVariant())) || (Hoymiles.getRadioCmt()->isInitialized() && (!Hoymiles.getRadioCmt()->isConnected())); hintObj["default_password"] = strcmp(Configuration.get().Security.Password, ACCESS_POINT_PASSWORD) == 0; - bool isGeneric = String(PIOENV) == "generic"; - hintObj["pin_mapping_issue"] = !isGeneric && !PinMapping.isMappingSelected(); + hintObj["pin_mapping_issue"] = PIN_MAPPING_REQUIRED && !PinMapping.isMappingSelected(); } void WebApiWsLiveClass::generateInverterCommonJsonResponse(JsonObject& root, std::shared_ptr inv)