Skip to content

Commit

Permalink
HB-LC-SwX-TP: add multichannel (more than 1) handling to set time pro…
Browse files Browse the repository at this point in the history
…files
  • Loading branch information
jp112sdl committed May 26, 2021
1 parent a72f8f5 commit 5cbe932
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 40 deletions.
10 changes: 9 additions & 1 deletion patchsource/www/webui/webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -37605,7 +37605,15 @@ SaveDeviceParameters = function()
SetParameters ($F('global_iface'), channel_address, 'CHANNEL_'+i);
actions++;
}

if (
( (window.P1_tom) && (P1_tom.iface == $F('global_iface')) && (P1_tom.address == channel_address) && (P1_tom.tom_isDirty()) && (P1_tom.jphb) ) ||
( (window.P2_tom) && (P2_tom.iface == $F('global_iface')) && (P2_tom.address == channel_address) && (P2_tom.tom_isDirty()) && (P2_tom.jphb) ) ||
( (window.P3_tom) && (P3_tom.iface == $F('global_iface')) && (P3_tom.address == channel_address) && (P3_tom.tom_isDirty()) && (P3_tom.jphb) ) ||
( (window.P4_tom) && (P4_tom.iface == $F('global_iface')) && (P4_tom.address == channel_address) && (P4_tom.tom_isDirty()) && (P4_tom.jphb) )
) {
SetParameters ($F('global_iface'), channel_address, 'TIMEOUTMANAGER');
actions++;
}
if($('chInternalPeers_' + i)) {
// Alle Adressen der internen Links
var _internalLinks = $('chInternalPeers_' + i).innerHTML,
Expand Down
2 changes: 1 addition & 1 deletion src/addon/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3
5.4
38 changes: 14 additions & 24 deletions src/addon/js/jp_webui_inc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ HBTimeoutManager = Class.create();

HBTimeoutManager.prototype = Object.extend(new MsgBox(), {

initialize: function (iface, address, isOldDevGeneration, prgName) {
initialize: function (iface, address, prgName) {

this.TOM_DAY = new Array (
translateKey('timeModuleLblSelSerialPatternSaturday') ,
Expand All @@ -47,9 +47,9 @@ HBTimeoutManager.prototype = Object.extend(new MsgBox(), {
translateKey('timeModuleLblSelSerialPatternFriday')
);

this.isOldDevGeneration = isOldDevGeneration;
this.iface = iface;
this.address = address;
this.jphb = true;

this.prg = (prgName != undefined && prgName != null) ? prgName : "";

Expand Down Expand Up @@ -143,21 +143,16 @@ HBTimeoutManager.prototype = Object.extend(new MsgBox(), {
} else {
inputelem = this.prg + elem[1] + "_" + elem[2] + "_" + loop;
}
if (this.isOldDevGeneration) {
// Minuten der Zeit auf volle 10 pruefen und ggf. anpassen
$(inputelem).value = time = $(inputelem).value.replace(/[1-9]$/, "0");
} else {
// Minuten der Zeit auf volle 5 pruefen und ggf. anpassen
var arTime = $(inputelem).value.split(":"),
hour = parseInt(arTime[0]),
min =Math.round(arTime[1] / 5) * 5 ;
if (min <= 9) {min = "0" + min;}
if (min == 60) {min = "00"; hour++;}
if (hour <= 9) {hour = "0" + hour;}
if (hour == 24) {hour = "23"; min = "55";}

$(inputelem).value = time = hour + ":" + min;
}
// Minuten der Zeit auf volle 5 pruefen und ggf. anpassen
var arTime = $(inputelem).value.split(":"),
hour = parseInt(arTime[0]),
min =Math.round(arTime[1] / 5) * 5 ;
if (min <= 9) {min = "0" + min;}
if (min == 60) {min = "00"; hour++;}
if (hour <= 9) {hour = "0" + hour;}
if (hour == 24) {hour = "23"; min = "55";}

$(inputelem).value = time = hour + ":" + min;
endtime = this.tom_toTimeout(time);
prev_endtime = -1;
next_endtime = -1;
Expand Down Expand Up @@ -238,13 +233,8 @@ HBTimeoutManager.prototype = Object.extend(new MsgBox(), {

if (timeouts && timeouts.length > 0) {
for (var i = 0; i < timeouts.length; i++) {
if (this.isOldDevGeneration) {
postStr += "&LEVEL" + TOM_DAY_ENG[dayidx] +"_" + (i+1) + "=" + timeouts[i][tom_level];
postStr += "&TIMEOUT_" + TOM_DAY_ENG[dayidx] +"_" + (i+1) + "=" + timeouts[i][tom_endtime];
} else {
postStr += "&" + this.prg + "LEVEL_" + TOM_DAY_ENG[dayidx] + "_" + (i + 1) + "=" + timeouts[i][tom_level];
postStr += "&" + this.prg + "ENDTIME_" + TOM_DAY_ENG[dayidx] + "_" + (i + 1) + "=" + timeouts[i][tom_endtime];
}
postStr += "&" + "LEVEL_" + TOM_DAY_ENG[dayidx] + "_" + (i + 1) + "=" + timeouts[i][tom_level];
postStr += "&" + "ENDTIME_" + TOM_DAY_ENG[dayidx] + "_" + (i + 1) + "=" + timeouts[i][tom_endtime];
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions src/addon/patch/common/webui.js.patch
Original file line number Diff line number Diff line change
Expand Up @@ -797,3 +797,20 @@
ID_CHOOSE_LED = 1022;
ID_SET_OUCFM_MODE = 1023;
ID_SET_STATUS_DISPLAY = 1024;
@@ -36863,7 +37605,15 @@
SetParameters ($F('global_iface'), channel_address, 'CHANNEL_'+i);
actions++;
}
-
+ if (
+ ( (window.P1_tom) && (P1_tom.iface == $F('global_iface')) && (P1_tom.address == channel_address) && (P1_tom.tom_isDirty()) && (P1_tom.jphb) ) ||
+ ( (window.P2_tom) && (P2_tom.iface == $F('global_iface')) && (P2_tom.address == channel_address) && (P2_tom.tom_isDirty()) && (P2_tom.jphb) ) ||
+ ( (window.P3_tom) && (P3_tom.iface == $F('global_iface')) && (P3_tom.address == channel_address) && (P3_tom.tom_isDirty()) && (P3_tom.jphb) ) ||
+ ( (window.P4_tom) && (P4_tom.iface == $F('global_iface')) && (P4_tom.address == channel_address) && (P4_tom.tom_isDirty()) && (P4_tom.jphb) )
+ ) {
+ SetParameters ($F('global_iface'), channel_address, 'TIMEOUTMANAGER');
+ actions++;
+ }
if($('chInternalPeers_' + i)) {
// Alle Adressen der internen Links
var _internalLinks = $('chInternalPeers_' + i).innerHTML,
24 changes: 10 additions & 14 deletions src/addon/www/config/easymodes/hb_sw_tp_ch_master.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ proc set_htmlParams {iface address pps pps_descr special_input_id peer_type} {

set CHANNEL "CHANNEL"

set ch [lindex [split $special_input_id _] 1]
set ch [lindex [split $special_input_id _] 1]
set pNr "P$ch";


set hlpBoxWidth 450
set hlpBoxHeight 160

Expand All @@ -123,38 +123,34 @@ proc set_htmlParams {iface address pps pps_descr special_input_id peer_type} {



## Wochenprogramm ##

append HTML_PARAMS(separate_1) "<div id=\"Timeouts_Area\" style=\"display:none\">"
## Wochenprogramm ##

append HTML_PARAMS(separate_1) "<div id=\"$pNr\_Timeouts_Area\">"
foreach day {SATURDAY SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY} {
append HTML_PARAMS(separate_1) "<div id=\"level_prof_$day\"></div>"
append HTML_PARAMS(separate_1) "<div id=\"$pNr\_level_prof_$day\"></div>"
}
append HTML_PARAMS(separate_1) "</div>"

append HTML_PARAMS(separate_1) "<script type=\"text/javascript\">"
append HTML_PARAMS(separate_1) "tom = new HBTimeoutManager('$iface', '$address');"


append HTML_PARAMS(separate_1) "$pNr\_tom = new HBTimeoutManager('$iface', '$address', '$pNr\_');"
foreach day {SATURDAY SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY} {

for {set i 1} {$i <= 13} {incr i} {

set timeout $ps(ENDTIME_${day}_$i)
set level $ps(LEVEL_${day}_$i)
append HTML_PARAMS(separate_1) "tom.setLevel('$day', $timeout, $level);"
append HTML_PARAMS(separate_1) "$pNr\_tom.setLevel('$day', $timeout, $level);"

if {$timeout == 1440} then {
break;
}
}

append HTML_PARAMS(separate_1) "tom.setDivname('$day', 'level_prof_$day');"
append HTML_PARAMS(separate_1) "tom.writeDay('$day');"
append HTML_PARAMS(separate_1) "$pNr\_tom.setDivname('$day', '$pNr\_level_prof_$day');"
append HTML_PARAMS(separate_1) "$pNr\_tom.writeDay('$day');"
}

# TODO - Set the weekly program only visible while certain modes are active.
# This has to be clarified with the developer of the device
append HTML_PARAMS(separate_1) "jQuery('#Timeouts_Area').show();"

append HTML_PARAMS(separate_1) "</script>"

Expand Down

0 comments on commit 5cbe932

Please sign in to comment.