From 5626642a46bfaec602e7b2d2c4a07a9677687e61 Mon Sep 17 00:00:00 2001 From: Jens Maus Date: Wed, 20 Nov 2024 22:25:49 +0100 Subject: [PATCH] add additional fix to 0119-WebUI-Fix-ProofAndSetValue WebUI patch to fix issues in getOptionBox tcl function to perform a correct floating point comparison via an epsilon difference value if the option is a floating point. This should fix issue with not correctly selected combobox values (fixes #2929). --- .../0119-WebUI-Fix-ProofAndSetValue.patch | 22 +++++++++++++++++++ .../www/config/easymodes/etc/uiElements.tcl | 14 +++++++++--- .../www/config/easymodes/etc/uiElements.tcl | 14 +++++++++--- .../config/easymodes/etc/uiElements.tcl.orig | 14 +++++++++--- 4 files changed, 55 insertions(+), 9 deletions(-) diff --git a/buildroot-external/patches/occu/0119-WebUI-Fix-ProofAndSetValue.patch b/buildroot-external/patches/occu/0119-WebUI-Fix-ProofAndSetValue.patch index 3c57fe6ddf..9cb581381f 100644 --- a/buildroot-external/patches/occu/0119-WebUI-Fix-ProofAndSetValue.patch +++ b/buildroot-external/patches/occu/0119-WebUI-Fix-ProofAndSetValue.patch @@ -227,6 +227,28 @@ append s "jQuery('#separate_CHANNEL\_$chn\_$prn').val(this.value / 100);\">" append s "" +@@ -406,10 +419,18 @@ + set select "" + foreach val [lsort -real [array names optionValues]] { + +- if {$val == $value} { +- set select "selected=\"selected\"" ++ if {[string is double -strict $value]} { ++ if {[expr abs($val - $value)] < 1e-15} { ++ set select "selected=\"selected\"" ++ } else { ++ set select "" ++ } + } else { +- set select "" ++ if {$val == $value} { ++ set select "selected=\"selected\"" ++ } else { ++ set select "" ++ } + } + + append s "" --- occu/WebUI/www/config/easymodes/hm-cc-vg-1_master.tcl.orig +++ occu/WebUI/www/config/easymodes/hm-cc-vg-1_master.tcl @@ -24,7 +24,12 @@ diff --git a/buildroot-external/patches/occu/0119-WebUI-Fix-ProofAndSetValue/occu/WebUI/www/config/easymodes/etc/uiElements.tcl b/buildroot-external/patches/occu/0119-WebUI-Fix-ProofAndSetValue/occu/WebUI/www/config/easymodes/etc/uiElements.tcl index cabbe46e39..fc757820c6 100755 --- a/buildroot-external/patches/occu/0119-WebUI-Fix-ProofAndSetValue/occu/WebUI/www/config/easymodes/etc/uiElements.tcl +++ b/buildroot-external/patches/occu/0119-WebUI-Fix-ProofAndSetValue/occu/WebUI/www/config/easymodes/etc/uiElements.tcl @@ -419,10 +419,18 @@ proc getOptionBox {param options value chn prn {extraparam ""}} { set select "" foreach val [lsort -real [array names optionValues]] { - if {$val == $value} { - set select "selected=\"selected\"" + if {[string is double -strict $value]} { + if {[expr abs($val - $value)] < 1e-15} { + set select "selected=\"selected\"" + } else { + set select "" + } } else { - set select "" + if {$val == $value} { + set select "selected=\"selected\"" + } else { + set select "" + } } append s "" diff --git a/buildroot-external/patches/occu/0177-WebUI-Fix-EmptyHmIPWKPPIN/occu/WebUI/www/config/easymodes/etc/uiElements.tcl b/buildroot-external/patches/occu/0177-WebUI-Fix-EmptyHmIPWKPPIN/occu/WebUI/www/config/easymodes/etc/uiElements.tcl index 145f60192e..4ea51db2f4 100755 --- a/buildroot-external/patches/occu/0177-WebUI-Fix-EmptyHmIPWKPPIN/occu/WebUI/www/config/easymodes/etc/uiElements.tcl +++ b/buildroot-external/patches/occu/0177-WebUI-Fix-EmptyHmIPWKPPIN/occu/WebUI/www/config/easymodes/etc/uiElements.tcl @@ -419,10 +419,18 @@ proc getOptionBox {param options value chn prn {extraparam ""}} { set select "" foreach val [lsort -real [array names optionValues]] { - if {$val == $value} { - set select "selected=\"selected\"" + if {[string is double -strict $value]} { + if {[expr abs($val - $value)] < 1e-15} { + set select "selected=\"selected\"" + } else { + set select "" + } } else { - set select "" + if {$val == $value} { + set select "selected=\"selected\"" + } else { + set select "" + } } append s "" diff --git a/buildroot-external/patches/occu/0177-WebUI-Fix-EmptyHmIPWKPPIN/occu/WebUI/www/config/easymodes/etc/uiElements.tcl.orig b/buildroot-external/patches/occu/0177-WebUI-Fix-EmptyHmIPWKPPIN/occu/WebUI/www/config/easymodes/etc/uiElements.tcl.orig index cabbe46e39..fc757820c6 100755 --- a/buildroot-external/patches/occu/0177-WebUI-Fix-EmptyHmIPWKPPIN/occu/WebUI/www/config/easymodes/etc/uiElements.tcl.orig +++ b/buildroot-external/patches/occu/0177-WebUI-Fix-EmptyHmIPWKPPIN/occu/WebUI/www/config/easymodes/etc/uiElements.tcl.orig @@ -419,10 +419,18 @@ proc getOptionBox {param options value chn prn {extraparam ""}} { set select "" foreach val [lsort -real [array names optionValues]] { - if {$val == $value} { - set select "selected=\"selected\"" + if {[string is double -strict $value]} { + if {[expr abs($val - $value)] < 1e-15} { + set select "selected=\"selected\"" + } else { + set select "" + } } else { - set select "" + if {$val == $value} { + set select "selected=\"selected\"" + } else { + set select "" + } } append s ""