From 9a7de817c0b866778d416f11718f9fc3537248ac Mon Sep 17 00:00:00 2001 From: jp112sdl Date: Sun, 7 Mar 2021 16:33:36 +0100 Subject: [PATCH] add HB-ES-PMSw1-USB --- .../firmware/rftypes/hb-es-pmsw1-usb.xml | 724 ++++++++++++++++++ src/addon/install_hb-es-pmsw1-usb | 32 + src/addon/uninstall_hb-es-pmsw1-usb | 17 + .../config/easymodes/hb_power_ch_master.tcl | 125 +++ .../img/devices/250/hb-es-pmsw1-usb.png | Bin 0 -> 6087 bytes .../img/devices/50/hb-es-pmsw1-usb_thumb.png | Bin 0 -> 1828 bytes 6 files changed, 898 insertions(+) create mode 100644 src/addon/firmware/rftypes/hb-es-pmsw1-usb.xml create mode 100755 src/addon/install_hb-es-pmsw1-usb create mode 100755 src/addon/uninstall_hb-es-pmsw1-usb create mode 100755 src/addon/www/config/easymodes/hb_power_ch_master.tcl create mode 100644 src/addon/www/config/img/devices/250/hb-es-pmsw1-usb.png create mode 100644 src/addon/www/config/img/devices/50/hb-es-pmsw1-usb_thumb.png diff --git a/src/addon/firmware/rftypes/hb-es-pmsw1-usb.xml b/src/addon/firmware/rftypes/hb-es-pmsw1-usb.xml new file mode 100644 index 00000000..7ed02e44 --- /dev/null +++ b/src/addon/firmware/rftypes/hb-es-pmsw1-usb.xml @@ -0,0 +1,724 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/addon/install_hb-es-pmsw1-usb b/src/addon/install_hb-es-pmsw1-usb new file mode 100755 index 00000000..2fe1aafa --- /dev/null +++ b/src/addon/install_hb-es-pmsw1-usb @@ -0,0 +1,32 @@ +#!/bin/sh + +DEVICE="HB-ES-PMSw1-USB" +DEVICE_IMG=hb-es-pmsw1-usb.png +DEVICE_THUMB=hb-es-pmsw1-usb_thumb.png +DEVICE_DESC="homebrew power meter switch actuator 1-channel for USB" + +### Edit DEVDB.tcl ### +devdescrFile="/www/config/devdescr/DEVDB.tcl" +devdescrSearch="array[[:space:]]*set[[:space:]]*DEV_PATHS[[:space:]]*{" + +devdescrInsert="$DEVICE {{50 \/config\/img\/devices\/50\/$DEVICE_THUMB} {250 \/config\/img\/devices\/250\/$DEVICE_IMG}} " + +if [ -z "`cat $devdescrFile | grep \"$DEVICE\"`" ]; then + sed -i "s/\($devdescrSearch\)/\1$devdescrInsert/g" $devdescrFile +fi + +### Edit webui.js ### +webuiFile="/www/webui/webui.js" + +webuiSearchBegin="DEV_HIGHLIGHT[[:space:]]*=[[:space:]]*new Array();" +webuiInsert="\n" +webuiInsert="${webuiInsert}DEV_HIGHLIGHT['$DEVICE'] = new Object();\n" +webuiInsert="${webuiInsert}DEV_LIST.push('$DEVICE');\n" +webuiInsert="${webuiInsert}DEV_DESCRIPTION['$DEVICE']='$DEVICE_DESC';\n" +webuiInsert="${webuiInsert}DEV_PATHS['$DEVICE'] = new Object();\n" +webuiInsert="${webuiInsert}DEV_PATHS['$DEVICE']['50'] = '\/config\/img\/devices\/50\/$DEVICE_THUMB';\n" +webuiInsert="${webuiInsert}DEV_PATHS['$DEVICE']['250'] = '\/config\/img\/devices\/250\/$DEVICE_IMG';" + +if [ -z "`cat $webuiFile | grep \"$DEVICE\"`" ]; then + sed -i "s/\($webuiSearchBegin\)/\1$webuiInsert/g" $webuiFile +fi \ No newline at end of file diff --git a/src/addon/uninstall_hb-es-pmsw1-usb b/src/addon/uninstall_hb-es-pmsw1-usb new file mode 100755 index 00000000..fcbcd749 --- /dev/null +++ b/src/addon/uninstall_hb-es-pmsw1-usb @@ -0,0 +1,17 @@ +#!/bin/sh + +DEVICE="HB-ES-PMSw1-USB" +DEVICE_IMG=hb-es-pmsw1-usb.png +DEVICE_THUMB=hb-es-pmsw1-usb_thumb.png +FIRMWARE_FILE=/firmware/rftypes/hb-es-pmsw1-usb.xml + +devdescrFile="/www/config/devdescr/DEVDB.tcl" +devdescrSearch="$DEVICE {{50 \/config\/img\/devices\/50\/$DEVICE_THUMB} {250 \/config\/img\/devices\/250\/$DEVICE_IMG}} " +sed -i "s/\($devdescrSearch\)//g" $devdescrFile + +webuiFile="/www/webui/webui.js" +sed -i "/\($DEVICE\)/d" $webuiFile + +rm -f $FIRMWARE_FILE +rm -f /www/config/img/devices/250/$DEVICE_IMG +rm -f /www/config/img/devices/50/$DEVICE_THUMB diff --git a/src/addon/www/config/easymodes/hb_power_ch_master.tcl b/src/addon/www/config/easymodes/hb_power_ch_master.tcl new file mode 100755 index 00000000..207bc459 --- /dev/null +++ b/src/addon/www/config/easymodes/hb_power_ch_master.tcl @@ -0,0 +1,125 @@ +#!/bin/tclsh + +source [file join $env(DOCUMENT_ROOT) config/easymodes/em_common.tcl] + +proc getUnit {psDescr param} { + upvar psDescr descr + array_clear param_descr + array set param_descr $descr($param) + set unit $param_descr(UNIT) + + if {$unit == "minutes"} { + set unit "\${lblMinutes}" + } + + if {$unit == "K"} { + set unit "°C" + } + + return "$unit" +} + +proc getMinMaxValueDescr {psDescr param} { + upvar psDescr descr + array_clear param_descr + array set param_descr $descr($param) + set min $param_descr(MIN) + set max $param_descr(MAX) + + # Limit float to 2 decimal places + if {[llength [split $min "."]] == 2} { + set min [format {%1.2f} $min] + set max [format {%1.2f} $max] + } + return "($min - $max)" +} + +proc getTextField {type param value inputId} { + set elemId '$inputId' + # Limit float to 2 decimal places + if {[llength [split $value "."]] == 2} { + set value [format {%1.2f} $value] + } + + set s "" + return $s +} + +proc getComboBox {param prn special_input_id} { + global psDescr + upvar ps ps + set CHANNEL "CHANNEL" + + array_clear options + set options(0) "\${stringTableNotUsed}" + set options($ps($param)) "\${optionEnterValue}" + + + append s "" + append s "[get_ComboBox options $param option_${special_input_id}_$prn ps $param "onchange=\";document.getElementById('field_$prn').style.visibility=(this.selectedIndex < 1)?'hidden':'visible';document.getElementById('separate_CHANNEL_2_$prn').value=parseFloat(this.options\[this.selectedIndex\].value);\""]" + append s "" + append s "[getTextField $CHANNEL '$param' $ps($param) separate_${special_input_id}_$prn] [getUnit psDescr $param] [getMinMaxValueDescr psDescr $param]" + append s "" + return $s +} + +catch {unset internalKey} + +proc set_htmlParams {iface address pps pps_descr special_input_id peer_type} { + + global env iface_url psDescr + + #upvar PROFILES_MAP PROFILES_MAP + upvar HTML_PARAMS HTML_PARAMS + #upvar PROFILE_PNAME PROFILE_PNAME + upvar $pps ps + upvar $pps_descr ps_descr + + set CHANNEL "CHANNEL" + + array set psDescr [xmlrpc $iface_url($iface) getParamsetDescription [list string $address] [list string MASTER]] + + append HTML_PARAMS(separate_1) "" + + append HTML_PARAMS(separate_1) "" + + set prn 1 + set param AVERAGING + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) "" + + append HTML_PARAMS(separate_1) "" + + incr prn + set param TX_THRESHOLD_CURRENT + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) [getComboBox $param $prn $special_input_id] + append HTML_PARAMS(separate_1) "" + + incr prn + set param TX_THRESHOLD_VOLTAGE + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) [getComboBox $param $prn $special_input_id] + append HTML_PARAMS(separate_1) "" + + append HTML_PARAMS(separate_1) "" + + incr prn + set param TX_MINDELAY + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) "" + append HTML_PARAMS(separate_1) "" + + append HTML_PARAMS(separate_1) "
\${PMSwChannel2Header}

\${PMSwAveraging}[getTextField $CHANNEL '$param' $ps($param) separate_${special_input_id}_$prn] [getUnit psDescr $param] [getMinMaxValueDescr psDescr $param]


\${PMSwChannel2HintHeader}
\${PMSwChannel2Hint_Current}
\${PMSwChannel2Hint_Voltage}
\${PMSwChannel2Hint_Footer}

\${PMSwChannel2MinDelay}[getTextField $CHANNEL '$param' $ps($param) separate_${special_input_id}_$prn] [getUnit psDescr $param] [getMinMaxValueDescr psDescr $param]
" +} + +constructor + + diff --git a/src/addon/www/config/img/devices/250/hb-es-pmsw1-usb.png b/src/addon/www/config/img/devices/250/hb-es-pmsw1-usb.png new file mode 100644 index 0000000000000000000000000000000000000000..d865ce7fad60ef0a7ab94283d2d9128f1af2bbae GIT binary patch literal 6087 zcmeHLc|4R|`yWg-RE$Jr$&lqC+h~yqGYwKoBiXkJA=$TQ>_f?(sSuKoN{fu4vW5y{ z8%vRiVPuIcgRwP+nfKQ7ywCH#@8|vV_uucm=X2&<_qnh2obPq6bKi-k7mRibhzo!~ zpxtNB7?=V5`c{K%2mTXgZFPZ;C(z6Y4JzrB`~lqDbG1I}W?}+T251Oq8_ymP-xdq- z1M!H1w*8_(AY&ehzi2ZaIEWV*7Y3Sbyax#UCyy7z2?T+5h-@{UPM8n`(BJN1ZXIN8 zavtI0>#gQ=#n;(YEyUYzOA4eDf&fTw*B~cYh_{zd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e_ z4X(3gXhyaNSKaDwCuRr@sjT-uyyrrgxB$Fk*O9U@o){JJPwPY6@hf~17_%LW{)zbv zx^jiaXy>adBH!VTO7#&}jy|juV`bUQZswrWxVHrl-gaM{-1vNd6@8h6ci^06ktg7| z^u}unP?6Pry{#w5#rOnoJl7tn8r615)_#q+c6snqVe!XrH6$yIdF)|)9F3^{ZuCu9 z(Q4(>jZ=r)vk@9lUp_EkVxs>+0J=b{ zM02{B^=a&KUU+=E*GJpE)rZDVLyBB2mM+u1HBZhrxK>>J?G7H~Q@T99V#6VzOSCKZ gsb%1;Ng9{$)WgLAux#x0t#8+74KEm!pf6wl2X2Pz4*&oF literal 0 HcmV?d00001 diff --git a/src/addon/www/config/img/devices/50/hb-es-pmsw1-usb_thumb.png b/src/addon/www/config/img/devices/50/hb-es-pmsw1-usb_thumb.png new file mode 100644 index 0000000000000000000000000000000000000000..f2daaaa75a0eb6f5c9891526fa14cfb1d892abb8 GIT binary patch literal 1828 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1|;R|J2nC-#^NA%Cx&(BWL^R}(^4Zm(|mmy zw18|523AHP24;{FAY@>aVqgWc85q16rQz%#MneWBptv9qN3~}%ut3%10BI1=17e_V z2wh%Yu9umYU7Va)kgAtolnxYUUciX3V*wLfztI9_1RJQ1;Zw0*FOcFa@Q5sCU|<&p zVa9U`{2V~@PiKZiltlRYSS9D@>LsS+C#C9DzCHb_`sNdc^+B->Ug!Z$#{Ilm}X!A#FU&p^qJOF==wrYI%ND#*nRsvXF)RmvzS zDX`Ml2YIL57~~OsLrY6beFGzXBO_g)3fL_l;qF7xRgqW#(FFDt z#4;O@QC9v%nW;eMf*fUMXahDLMGWCM8=&b{&PAz-CHX}m`T03^=n-n8kFEl$*+w7a zT_o>A!WJwF3|u=dpiWps*>OEz@J54yfhEAx#W5s<_3bS06~2KI$Jc-7o!DIz*flB0 zgHu^KHS0iwPu|HXjW*A`G?%%looZM)bLLE*DM36uPbPNk`TXp^b@tz_*57uP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