diff --git a/docs/source/Plugin/P159.rst b/docs/source/Plugin/P159.rst index 70183da070..f754d4b23a 100644 --- a/docs/source/Plugin/P159.rst +++ b/docs/source/Plugin/P159.rst @@ -137,9 +137,9 @@ After checking the checkbox to enabled state, the settings will be available imm * **Idle seconds**: The number of seconds the *Presence* stays active after presence is removed, can be set here. Default value 5 sec. max. value is 65535 sec. * **Max. Moving gates**: The number of active gates for detecting Moving presence. Range 2 .. 8. * **Max. Stationary gates**: The number of active gates for detecting Stationary presence. Range 2 .. 8. -* **Sensitivity, Gate 0 .. 8**: For each type of detection, the sensitivity treshold can be set, range 0 .. 100, where 0 is the most sensitive, and 100 means it won't trigger, as that's the max. value that will be reported. +* **Sensitivity, Gate 0 .. 8**: For each type of detection, the sensitivity treshold can be set, range 0 .. 101, where 0 is the most sensitive, and 101 means it won't trigger, as 100 is the max. value that will be reported. -For each gate the distance range in meters is also shown. When the highest enabled Gate is less that the default 8, then only up to that gate-number is shown and configurable. +For each gate the distance range in meters is also shown. When the highest enabled Gate is less than the default 8, then only up to that gate-number is shown and configurable. If the **Modify sensor settings** checkbox is checked when submitting the page, the settings are sent to the sensor, and the sensor will be restarted to activate them. The configured values are persistently stored in the LD2410 sensor. diff --git a/src/_P159_LD2410.ino b/src/_P159_LD2410.ino index 6193ab5944..7493b314ca 100644 --- a/src/_P159_LD2410.ino +++ b/src/_P159_LD2410.ino @@ -5,6 +5,9 @@ // ####################################################################################################### /** Changelog: + * 2024-12-09 tonhuisman: Fix: Reduced max sensitivity to configure to 101, as the max value that vill be reported by the sensor is 100, + * so checking up to 100 was an off-by-one error. + * 2024-10-09 tonhuisman: Extend sensitivity max. value to 110 (experimental, was 100) * 2023-10-29 tonhuisman: Rework processing, allow Interval = 0, as now the events will be generated when a value changes, * but at most once per 100 msec, to not overload the ESP. Fixed the LD2410 library to work correctly * with the event-driven scheduler model of ESPEasy, instead of the continuous loop() run of Arduino diff --git a/src/src/PluginStructs/P159_data_struct.cpp b/src/src/PluginStructs/P159_data_struct.cpp index 45686bcf69..d267582941 100644 --- a/src/src/PluginStructs/P159_data_struct.cpp +++ b/src/src/PluginStructs/P159_data_struct.cpp @@ -113,7 +113,7 @@ bool P159_data_struct::processSensor(struct EventStruct *event) { for (uint8_t i = 0; i <= mMax; ++i) { addLog(LOG_LEVEL_INFO, strformat(F("LD2410: Sensitivity, gate %d (%.2f - %.2f mtr): moving:%3d, stationary:%3d"), - i, i * 0.75f, (i + 1) * 0.75f, + i, i * P159_GATE_DISTANCE_METERS, (i + 1) * P159_GATE_DISTANCE_METERS, i <= mMvGate ? radar->cfgMovingGateSensitivity(i) : 0, i <= mStGate ? radar->cfgStationaryGateSensitivity(i) : 0)); } @@ -297,11 +297,11 @@ bool P159_data_struct::plugin_webform_load(struct EventStruct *event) { for (uint8_t i = 0; i <= mMax; ++i) { html_TR_TD(); - addHtml(strformat(F("Gate %d (%.2f - %.2f mtr)"), i, i * 0.75f, (i + 1) * 0.75f)); + addHtml(strformat(F("Gate %d (%.2f - %.2f mtr)"), i, i * P159_GATE_DISTANCE_METERS, (i + 1) * P159_GATE_DISTANCE_METERS)); html_TD(); - addNumericBox(getPluginCustomArgName(idx++), radar->cfgMovingGateSensitivity(i), 0, 100, true); + addNumericBox(getPluginCustomArgName(idx++), radar->cfgMovingGateSensitivity(i), 0, P159_MAX_SENSITIVITY_VALUE, true); html_TD(); - addNumericBox(getPluginCustomArgName(idx++), radar->cfgStationaryGateSensitivity(i), 0, 100, true); + addNumericBox(getPluginCustomArgName(idx++), radar->cfgStationaryGateSensitivity(i), 0, P159_MAX_SENSITIVITY_VALUE, true); } html_end_table(); addHtml(strformat(F("\n