Skip to content

Commit

Permalink
add hb-ou-af-sen-temp
Browse files Browse the repository at this point in the history
  • Loading branch information
jp112sdl committed Feb 26, 2021
1 parent 7ff9f82 commit d65fb24
Show file tree
Hide file tree
Showing 90 changed files with 10,765 additions and 7 deletions.
16 changes: 16 additions & 0 deletions patchsource/www/rega/esp/channels.fn
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,22 @@ function ::fanOldVal()
return;
}

! [chnId]
function ::airflapOldVal()
{
object chn = dom.GetObject( system.GetVar("chnId") );
if (chn)
{
object oOL = chn.DPByControl("AIRFLAP.OLD_LEVEL");
object oL = chn.DPByControl("AIRFLAP.LEVEL");
if( oL && oOL )
{
oOL.State(1);
}
}
return;
}

! [chnId]
! --> bhasReadDPs
function ::chnHasReadDPs() {
Expand Down
12 changes: 12 additions & 0 deletions patchsource/www/rega/esp/datapointconfigurator.fn
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function ::dcCreate()
var CN_IRRC_BUTTON = "IRRCBTN.";
var CN_IBTN_BUTTON = "IBTN.";
var CN_SERVO = "SERVO.";
var CN_AIRFLAP = "AIRFLAP.";
var CN_FAN = "FAN.";
var CN_PFS = "PFS.";
var CN_LDRSC = "LDRSC.";
Expand Down Expand Up @@ -422,6 +423,17 @@ function ::dcCreate()
Call("/esp/controls/servo.fn::CreateServoActuator()");
}

!# AIRFLAP
bIsControl = ( sControlName.Find(CN_AIRFLAP) > -1 );
if( bIsControl && (sLastControlName!=CN_AIRFLAP) )
{
object ch = dom.GetObject(chnId);
isKnownControl = true;
sLastControlName = CN_AIRFLAP;
WriteLine( "<script>conInfo('Control AIRFLAP found.');</script>" );
Call("/esp/controls/airflap.fn::CreateAirflapActuator()");
}

!# FAN
bIsControl = ( sControlName.Find(CN_FAN) > -1 );
if( bIsControl && (sLastControlName!=CN_FAN) )
Expand Down
4 changes: 2 additions & 2 deletions patchsource/www/webui/js/extern/sliderControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ sliderControl = function(type,id, val, iViewOnly, bSliderPosFlag,min, max, facto
this.n_pathLeft = 1;
this.n_pathTop = 1;
this.n_pathLength = 190;
this.s_imgControlGreen = (type == "Servo") ?'/ise/img/slider/servoslider_grey.png':'/ise/img/slider/slider_yellow.png';
this.s_imgControlGray = (type == "Servo") ?'/ise/img/slider/servoslider_grey.png':'/ise/img/slider/slider_grey.png';
this.s_imgControlGreen = (type == "Servo" || type == "AirFlap") ?'/ise/img/slider/servoslider_grey.png':'/ise/img/slider/slider_yellow.png';
this.s_imgControlGray = (type == "Servo" || type == "AirFlap") ?'/ise/img/slider/servoslider_grey.png':'/ise/img/slider/slider_grey.png';
this.s_imgSlider = '/ise/img/slider/slider.gif';

// register in the global collection
Expand Down
836 changes: 836 additions & 0 deletions src/addon/firmware/rftypes/hb-ou-af-sen-temp.xml

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions src/addon/install_hb-ou-af-sen-temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/sh

DEVICE="HB-OU-AF-SEN-TEMP"
DEVICE_IMG=hb-ou-af-sen-temp.png
DEVICE_THUMB=hb-ou-af-sen-temp_thumb.png
DEVICE_DESC="AirFlap control with Temperature sensor"

### 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

webuiSearchBegin="elvST[[:space:]]*=[[:space:]]*new Array();"

webuiInsertParam="RELEASE_AFTER_MOVE"
webuiInsertValue="stringTableHbReleaseAfterMove"
webuiInsert="\n"
webuiInsert="${webuiInsert}elvST['$webuiInsertParam'] = '\${$webuiInsertValue}';"
if [ -z "`cat $webuiFile | grep \"$webuiInsertParam\"`" ]; then
sed -i "s/\($webuiSearchBegin\)/\1$webuiInsert/g" $webuiFile
fi

### Edit stringtable_de.txt ###
stringtable_deFile="/www/config/stringtable_de.txt"

stringtable_deInsert="AIRFLAP|LEVEL\t\${stringTableHbHbAirFlapLevel}"
if [ -z "`cat $stringtable_deFile | grep \"AIRFLAP|LEVEL"`" ]; then
echo -e $stringtable_deInsert >> $stringtable_deFile
fi
stringtable_deInsert="AIRFLAP|OLD_LEVEL\t\${stringTableHbAirFlapOldLevel}"
if [ -z "`cat $stringtable_deFile | grep \"AIRFLAP|OLD_LEVEL"`" ]; then
echo -e $stringtable_deInsert >> $stringtable_deFile
fi

stringtable_deInsert="RELEASE_AFTER_MOVE\t\${stringTableHbReleaseAfterMove}"
if [ -z "`cat $stringtable_deFile | grep \"RELEASE_AFTER_MOVE"`" ]; then
echo -e $stringtable_deInsert >> $stringtable_deFile
fi
### Edit translate.lang.stringtable.js ###
translate_deFile="/www/webui/js/lang/de/translate.lang.stringtable.js"
translate_deSearch="\"dummy\" : \"\","
translate_deInsert="\n \"stringTableHbHbAirFlapLevel\" : \"%D6ffnung\","
if [ -z "`cat $translate_deFile | grep \"stringTableHbHbAirFlapLevel\"`" ]; then
sed -i "s/\($translate_deSearch\)/\1$translate_deInsert/g" $translate_deFile
fi
translate_deInsert="\n \"stringTableHbAirFlapOldLevel\" : \"Letzte %D6ffnung\","
if [ -z "`cat $translate_deFile | grep \"stringTableHbAirFlapOldLevel\"`" ]; then
sed -i "s/\($translate_deSearch\)/\1$translate_deInsert/g" $translate_deFile
fi
translate_deInsert="\n \"stringTableHbReleaseAfterMove\" : \"Motor nach Positionierung freigeben\","
if [ -z "`cat $translate_deFile | grep \"stringTableHbReleaseAfterMove\"`" ]; then
sed -i "s/\($translate_deSearch\)/\1$translate_deInsert/g" $translate_deFile
fi
### Edit channels.html ###
channelsFile="/www/rega/esp/channels.htm"
channelsInsert="\n<% if (action == \"airflapOldVal\") { Call(\"channels.fn::airflapOldVal()\"); } %>"
if [ -z "`cat $channelsFile | grep \"airflapOldVal"`" ]; then
echo -e $channelsInsert >> $channelsFile
fi
142 changes: 142 additions & 0 deletions src/addon/js/jp_webui_inc.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,148 @@ iseButtonsServo.prototype = {
}
};

/**
* ise/iseButtonsAirFlap.js
**/

/**
* @fileOverview ?
* @author ise
**/

/**
* @class
**/
iseButtonsAirFlap = Class.create();

iseButtonsAirFlap.prototype = {
/*
* id = DOM-ID of switch
* initState = Creation State
*/
initialize: function(id, initState, lvlDP, oldLvlDP, iViewOnly, bSliderPosFlag, label)
{
conInfo( "iseAirFlap: initialize()" );
this.id = id;
this.state = initState;
this.lvlDP = lvlDP;
this.oldLvlDP = oldLvlDP;

if(bSliderPosFlag)
{
this.bSliderPosFlag = bSliderPosFlag;
}
else
{
this.bSliderPosFlag = false;
}
this.slider = new sliderControl("AirFlap", this.id, initState, iViewOnly,this.bSliderPosFlag);


this.hasRampClicked = false;

this.txtPerc = $(this.id + "Perc");

// Add event handlers
if (iViewOnly === 0)
{
this.mouseOut = this.onMouseOut.bindAsEventListener(this);
Event.observe($("slidCtrl" + this.id), 'mouseout', this.mouseOut);

this.rampClick = this.onRampClick.bindAsEventListener(this);
Event.observe(this.slider.e_base, 'mousedown', this.rampClick);

this.handleClick = this.onHandleClick.bindAsEventListener(this);
Event.observe($("slidCtrl" + this.id), 'mouseup', this.handleClick);

this.PercChange = this.onPercChange.bindAsEventListener(this);
Event.observe($(this.id + "Perc"), 'change', this.PercChange);
}
this.refresh(false);
},

onMouseOut: function(event)
{
var e = event;
if (!e) { e = window.event; }
var relTarg = e.relatedTarget || e.fromElement;
if( relTarg )
{
var b1 = (relTarg.id.indexOf("slider")!=-1);
var b2 = (relTarg.id.indexOf("base")!=-1);
var b3 = (relTarg.id.indexOf("green")!=-1);
if( !b1 && !b2 && !b3 )
{
if( this.hasRampClicked )
{
conInfo( "iseAirflap: onMouseOut() ["+relTarg.id+"] "+this.slider.n_value );
this.hasRampClicked = false;
this.state = this.slider.n_value;
//this.refresh();
}
}
}
},

onRampClick: function(ev)
{
conInfo( "iseAirFlap: onRampClick()" );
this.hasRampClicked = true;
var pos = Position.page(this.slider.e_base);
var offset = ev.clientX - pos[0];
var val = ( offset * 100 ) / this.slider.n_controlWidth;
var oldstate = parseInt(this.state);
this.state = Math.floor(val);
if (this.state < (oldstate-3))
{
this.slider.f_setValue(val);
}
else if (this.state > (oldstate+3))
{
this.slider.f_setValue(val);
}
conInfo("setting AirFlap DP "+this.lvlDP+" State --> " + this.state + " -- old State --> "+oldstate);
//window.setTimeout("ibd"+this.id+".refresh()",1000);
},

onHandleClick: function()
{
conInfo( "iseAirFlap: onHandleClick()" );
//this.state = this.txtPerc.value;
this.refresh();
},

onPercChange: function()
{
conInfo( "iseAirFlap: onPercChange()" );
if( isNaN(this.txtPerc.value) ) return;
if( parseInt(this.txtPerc.value) > 100 ) this.txtPerc.value = 100;
if( parseInt(this.txtPerc.value) < 0 ) this.txtPerc.value = 0;
this.state = this.txtPerc.value;
this.refresh();
},

update: function(newVal)
{
conInfo( "iseAirFlap: update()" );
this.state = newVal;
this.refresh(newVal);
},

refresh: function(setstate)
{
conInfo( "iseAirFlap: refresh() " + this.state );
this.slider.f_setValue(this.state, true);
this.txtPerc.value = this.state;

if(typeof setstate == "undefined")
{
conInfo("setting Servo DP "+this.lvlDP+" State -------> " + this.state);
setDpState(this.lvlDP, (this.state / 100));
}
}
};

/**
* @class
**/
Expand Down
18 changes: 17 additions & 1 deletion src/addon/patch/common/channels.fn.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- ./patchsource/www/rega/esp/channels.fn.orig
+++ ./patchsource/www/rega/esp/channels.fn
@@ -761,6 +761,38 @@
@@ -761,6 +761,54 @@
}

! [chnId]
Expand Down Expand Up @@ -35,6 +35,22 @@
+ return;
+}
+
+! [chnId]
+function ::airflapOldVal()
+{
+ object chn = dom.GetObject( system.GetVar("chnId") );
+ if (chn)
+ {
+ object oOL = chn.DPByControl("AIRFLAP.OLD_LEVEL");
+ object oL = chn.DPByControl("AIRFLAP.LEVEL");
+ if( oL && oOL )
+ {
+ oOL.State(1);
+ }
+ }
+ return;
+}
+
+! [chnId]
! --> bhasReadDPs
function ::chnHasReadDPs() {
Expand Down
16 changes: 14 additions & 2 deletions src/addon/patch/common/datapointconfigurator.fn.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
--- ./patchsource/www/rega/esp/datapointconfigurator.fn.orig
+++ ./patchsource/www/rega/esp/datapointconfigurator.fn
@@ -148,6 +148,17 @@
@@ -148,6 +148,18 @@
var CN_WIN_SC_SENSOR = "WIN_SC_SENSOR.";
var CN_WINDOW = "WINDOW.";

+ var CN_RFID_BUTTON = "RFIDBTN.";
+ var CN_IRRC_BUTTON = "IRRCBTN.";
+ var CN_IBTN_BUTTON = "IBTN.";
+ var CN_SERVO = "SERVO.";
+ var CN_AIRFLAP = "AIRFLAP.";
+ var CN_FAN = "FAN.";
+ var CN_PFS = "PFS.";
+ var CN_LDRSC = "LDRSC.";
Expand All @@ -18,7 +19,7 @@
var CN_EVENT_INTERFACE = "EVENT_INTERFACE.";
var CN_NOT_ACTIVE = "CHANNEL_NOT_ACTIVE";

@@ -369,7 +380,109 @@
@@ -369,7 +381,120 @@
sLastControlName = CN_BTN_SHORT_ONLY;
Call("/esp/controls/button.fn::CreateKeyShortOnly()");
}
Expand Down Expand Up @@ -65,6 +66,17 @@
+ Call("/esp/controls/servo.fn::CreateServoActuator()");
+ }
+
+ !# AIRFLAP
+ bIsControl = ( sControlName.Find(CN_AIRFLAP) > -1 );
+ if( bIsControl && (sLastControlName!=CN_AIRFLAP) )
+ {
+ object ch = dom.GetObject(chnId);
+ isKnownControl = true;
+ sLastControlName = CN_AIRFLAP;
+ WriteLine( "<script>conInfo('Control AIRFLAP found.');</script>" );
+ Call("/esp/controls/airflap.fn::CreateAirflapActuator()");
+ }
+
+ !# FAN
+ bIsControl = ( sControlName.Find(CN_FAN) > -1 );
+ if( bIsControl && (sLastControlName!=CN_FAN) )
Expand Down
4 changes: 2 additions & 2 deletions src/addon/patch/common/sliderControl.js.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
this.n_pathLength = 190;
- this.s_imgControlGray = '/ise/img/slider/slider_grey.png';
- this.s_imgControlGreen = '/ise/img/slider/slider_yellow.png';
+ this.s_imgControlGreen = (type == "Servo") ?'/ise/img/slider/servoslider_grey.png':'/ise/img/slider/slider_yellow.png';
+ this.s_imgControlGray = (type == "Servo") ?'/ise/img/slider/servoslider_grey.png':'/ise/img/slider/slider_grey.png';
+ this.s_imgControlGreen = (type == "Servo" || type == "AirFlap") ?'/ise/img/slider/servoslider_grey.png':'/ise/img/slider/slider_yellow.png';
+ this.s_imgControlGray = (type == "Servo" || type == "AirFlap") ?'/ise/img/slider/servoslider_grey.png':'/ise/img/slider/slider_grey.png';
this.s_imgSlider = '/ise/img/slider/slider.gif';

// register in the global collection
Loading

0 comments on commit d65fb24

Please sign in to comment.