|
|
@ -8,6 +8,7 @@ const LOCO_F_CANREVERSE = 0x0020;
|
|
|
|
const LOCO_F_SHORTTRAIN = 0x0040;
|
|
|
|
const LOCO_F_SHORTTRAIN = 0x0040;
|
|
|
|
const LOCO_F_AUTO = 0x0100;
|
|
|
|
const LOCO_F_AUTO = 0x0100;
|
|
|
|
const LOCO_F_RANDOM = 0x0200;
|
|
|
|
const LOCO_F_RANDOM = 0x0200;
|
|
|
|
|
|
|
|
const LOCO_F_AUTOSTOP = 0x0400;
|
|
|
|
|
|
|
|
|
|
|
|
var locomotives = [];
|
|
|
|
var locomotives = [];
|
|
|
|
|
|
|
|
|
|
|
@ -30,10 +31,10 @@ function locomotive_Update(data) {
|
|
|
|
locomotives[i].vfast = data.vfast;
|
|
|
|
locomotives[i].vfast = data.vfast;
|
|
|
|
locomotives[i].vmax = data.vmax;
|
|
|
|
locomotives[i].vmax = data.vmax;
|
|
|
|
locomotives[i].flags = data.flags;
|
|
|
|
locomotives[i].flags = data.flags;
|
|
|
|
locomotives[i].blockassign = data.blockassing;
|
|
|
|
locomotives[i].blockassign = data.blockassign;
|
|
|
|
locomotives[i].blockpref = data.blockpref;
|
|
|
|
locomotives[i].blockprev = data.blockprev;
|
|
|
|
locomotives[i].blocknext = data.blocknext;
|
|
|
|
locomotives[i].blocknext = data.blocknext;
|
|
|
|
locomotives[i].blockdestination = data.blockdestination;
|
|
|
|
locomotives[i].blockdest = data.blockdest;
|
|
|
|
locodetail_setData(locomotives[i]);
|
|
|
|
locodetail_setData(locomotives[i]);
|
|
|
|
lococtrl_setData(data);
|
|
|
|
lococtrl_setData(data);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -46,14 +47,19 @@ function locomotive_Update(data) {
|
|
|
|
name: data.name,
|
|
|
|
name: data.name,
|
|
|
|
ifname: data.ifname,
|
|
|
|
ifname: data.ifname,
|
|
|
|
addr: data.addr,
|
|
|
|
addr: data.addr,
|
|
|
|
steps: data.steps,
|
|
|
|
stepcode: data.stepcode,
|
|
|
|
vmin: data.vmin,
|
|
|
|
vmin: data.vmin,
|
|
|
|
vslow: data.vslow,
|
|
|
|
vslow: data.vslow,
|
|
|
|
speed: data.speed,
|
|
|
|
speed: data.speed,
|
|
|
|
vmid: data.vmid,
|
|
|
|
vmid: data.vmid,
|
|
|
|
vfast: data.vfast,
|
|
|
|
vfast: data.vfast,
|
|
|
|
vmax: data.vmax,
|
|
|
|
vmax: data.vmax,
|
|
|
|
flags: data.flags
|
|
|
|
flags: data.flags,
|
|
|
|
|
|
|
|
blockassign: data.blockassign,
|
|
|
|
|
|
|
|
blockdest: data.blockdest,
|
|
|
|
|
|
|
|
blocknext: data.blocknext,
|
|
|
|
|
|
|
|
blockprev: data.blockprev
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -173,8 +179,8 @@ function locodetail_show(loconame) {
|
|
|
|
</fieldset> \
|
|
|
|
</fieldset> \
|
|
|
|
\
|
|
|
|
\
|
|
|
|
<fieldset><legend>Block</legend><table> \
|
|
|
|
<fieldset><legend>Block</legend><table> \
|
|
|
|
<tr><td>Destination:</td><td><input id=\"locodet_blockdest\" style=\"width: 50\" disabled></td></tr> \
|
|
|
|
|
|
|
|
<tr><td>Assined:</td><td><input id=\"locodet_blockassign\" style=\"width: 50\" disabled></td></tr> \
|
|
|
|
<tr><td>Assined:</td><td><input id=\"locodet_blockassign\" style=\"width: 50\" disabled></td></tr> \
|
|
|
|
|
|
|
|
<tr><td>Destination:</td><td><input id=\"locodet_blockdest\" style=\"width: 50\" disabled></td></tr> \
|
|
|
|
<tr><td>Next:</td><td><input id=\"locodet_blocknext\" style=\"width: 50\" disabled></td></tr> \
|
|
|
|
<tr><td>Next:</td><td><input id=\"locodet_blocknext\" style=\"width: 50\" disabled></td></tr> \
|
|
|
|
<tr><td>Prev:</td><td><input id=\"locodet_blockprev\" style=\"width: 50\" disabled></td></tr> \
|
|
|
|
<tr><td>Prev:</td><td><input id=\"locodet_blockprev\" style=\"width: 50\" disabled></td></tr> \
|
|
|
|
</table><button id=\"locodet_RESET\" type=\"button\">Reset</button></fileset>\
|
|
|
|
</table><button id=\"locodet_RESET\" type=\"button\">Reset</button></fileset>\
|
|
|
@ -428,7 +434,7 @@ function locodetail_setData(elm) {
|
|
|
|
var loco_blockassign = document.getElementById("locodet_blockassign");
|
|
|
|
var loco_blockassign = document.getElementById("locodet_blockassign");
|
|
|
|
var loco_blockdest = document.getElementById("locodet_blockdest");
|
|
|
|
var loco_blockdest = document.getElementById("locodet_blockdest");
|
|
|
|
var loco_blocknext = document.getElementById("locodet_blocknext");
|
|
|
|
var loco_blocknext = document.getElementById("locodet_blocknext");
|
|
|
|
var loco_blockprev = document.getElementById("locodet_blockpev");
|
|
|
|
var loco_blockprev = document.getElementById("locodet_blockprev");
|
|
|
|
|
|
|
|
|
|
|
|
if (elm) {
|
|
|
|
if (elm) {
|
|
|
|
if (loco_name) loco_name.value = elm.name;
|
|
|
|
if (loco_name) loco_name.value = elm.name;
|
|
|
@ -465,10 +471,10 @@ function locodetail_setData(elm) {
|
|
|
|
if (Number(elm.flags) & LOCO_F_RANDOM) loco_random.checked = true;
|
|
|
|
if (Number(elm.flags) & LOCO_F_RANDOM) loco_random.checked = true;
|
|
|
|
else loco_random.checked = false;
|
|
|
|
else loco_random.checked = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (loco_blockassign) loco_blockassign = elm.blockassign;
|
|
|
|
if (loco_blockassign) loco_blockassign.value = elm.blockassign;
|
|
|
|
if (loco_blockdest) loco_blockdest = elm.blockdest;
|
|
|
|
if (loco_blockdest) loco_blockdest.value = elm.blockdest;
|
|
|
|
if (loco_blocknext) loco_blocknext= elm.blocknext;
|
|
|
|
if (loco_blocknext) loco_blocknext.value = elm.blocknext;
|
|
|
|
if (loco_blockprev) loco_blockprev = elm.blockprev;
|
|
|
|
if (loco_blockprev) loco_blockprev.value = elm.blockprev;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -602,25 +608,40 @@ function lococtrl_show(name) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!win) {
|
|
|
|
if (!win) {
|
|
|
|
debug ("locolist_show create window");
|
|
|
|
debug ("locolist_show create window");
|
|
|
|
win = gWindowCreate("lococtrl_"+name, "Loco:"+name, 200, 500, " \
|
|
|
|
win = gWindowCreate("lococtrl_"+name, "Loco:"+name, 270, 500, " \
|
|
|
|
<div> \
|
|
|
|
|
|
|
|
Speed: <div id=\"lococtrl_"+name+"_SPEED\"></div> \
|
|
|
|
|
|
|
|
<table><tr><td> \
|
|
|
|
<table><tr><td> \
|
|
|
|
|
|
|
|
<fieldset><legend>Speed</legend><table><tr><td align=center>\
|
|
|
|
|
|
|
|
\
|
|
|
|
<input id=\"lococtrl_"+name+"_RANGE\" name=\""+name+"\" type=\"range\" orient=\"vertical\" \
|
|
|
|
<input id=\"lococtrl_"+name+"_RANGE\" name=\""+name+"\" type=\"range\" orient=\"vertical\" \
|
|
|
|
style=\"-webkit-appearance: slider-vertical; width: 10px; height: 100px;\"\
|
|
|
|
style=\"-webkit-appearance: slider-vertical; width: 10px; height: 100px;\"\
|
|
|
|
min=\"0\" value=\"0\" max=\"100\" > \
|
|
|
|
min=\"0\" value=\"0\" max=\"100\" > \
|
|
|
|
<br><button id=\"lococtrl_"+name+"_REVBTN\" type=\"button\">REV</button> \
|
|
|
|
<br><button id=\"lococtrl_"+name+"_REVBTN\" type=\"button\">REV</button> \
|
|
|
|
</td><td> \
|
|
|
|
\
|
|
|
|
<fieldset><legend>Speed</legend> <table>\
|
|
|
|
</td><td><table>\
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvstop\" type=\"button\" value=\"vstop\">Stop</button> </td></tr>\
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvstop\" type=\"button\" value=\"vstop\">Stop</button> </td></tr>\
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvmin\" type=\"button\" value=\"vmin\">Min</button></td></tr>\
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvmin\" type=\"button\" value=\"vmin\">Min</button></td></tr>\
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvslow\" type=\"button\" value=\"vslow\">Slow</button></td></tr> \
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvslow\" type=\"button\" value=\"vslow\">Slow</button></td></tr> \
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvmid\" type=\"button\" value=\"vmid\">Mid</button></td></tr> \
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvmid\" type=\"button\" value=\"vmid\">Mid</button></td></tr> \
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvfast\" type=\"button\" value=\"vfast\">Fast</button></td></tr> \
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvfast\" type=\"button\" value=\"vfast\">Fast</button></td></tr> \
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvmax\" type=\"button\" value=\"vmax\">Max</button></td></tr> \
|
|
|
|
<tr><td><button id=\"lococtrl_"+name+"_btnvmax\" type=\"button\" value=\"vmax\">Max</button></td></tr> \
|
|
|
|
</table></td></fieldset> \
|
|
|
|
</table></td></tr></table></fieldset> \
|
|
|
|
</td></tr></table></div> \
|
|
|
|
</td><td>\
|
|
|
|
<div align=right> \
|
|
|
|
<fieldset><legend>Control</legend><table>\
|
|
|
|
|
|
|
|
<tr> \
|
|
|
|
|
|
|
|
<td></td><td><button id=\"lococtrl_"+name+"_btnman\" type=\"button\" value=\"vstop\">MAN</button></td> \
|
|
|
|
|
|
|
|
</tr><tr> \
|
|
|
|
|
|
|
|
<td align=center><input id=\"lococtrl_"+name+"_cbstopman\" type=\"checkbox\" value=\"\" disabled></td>\
|
|
|
|
|
|
|
|
<td><button id=\"lococtrl_"+name+"_btnstopman\" type=\"button\" value=\"vstop\">A⇐M</button></td> \
|
|
|
|
|
|
|
|
</tr><tr> \
|
|
|
|
|
|
|
|
<td align=center><input id=\"lococtrl_"+name+"_cbauto\" type=\"checkbox\" value=\"\" disabled></td>\
|
|
|
|
|
|
|
|
<td><button id=\"lococtrl_"+name+"_btnauto\" type=\"button\" value=\"vstop\">AUTO</button></td> \
|
|
|
|
|
|
|
|
</tr><tr> \
|
|
|
|
|
|
|
|
<td align=center><input id=\"lococtrl_"+name+"_cbrand\" type=\"checkbox\" value=\"\" disabled></td>\
|
|
|
|
|
|
|
|
<td><button id=\"lococtrl_"+name+"_btnrand\" type=\"button\" value=\"vstop\">RAND</button></td> \
|
|
|
|
|
|
|
|
</tr> \
|
|
|
|
|
|
|
|
</table></fieldset> \
|
|
|
|
|
|
|
|
</td><tr></table>\
|
|
|
|
|
|
|
|
<br><div align=right> \
|
|
|
|
<button id=\"lococtrl_"+name+"_CLOSE\" type=\"button\" value=\""+name+"\">Close</button> \
|
|
|
|
<button id=\"lococtrl_"+name+"_CLOSE\" type=\"button\" value=\""+name+"\">Close</button> \
|
|
|
|
</div> \
|
|
|
|
</div> \
|
|
|
|
\
|
|
|
|
\
|
|
|
@ -633,6 +654,11 @@ function lococtrl_show(name) {
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnvfast", 'click', lococtrl_cb_btnmove);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnvfast", 'click', lococtrl_cb_btnmove);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnvmax", 'click', lococtrl_cb_btnmove);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnvmax", 'click', lococtrl_cb_btnmove);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnman", 'click', lococtrl_cb_btnman);
|
|
|
|
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnstopman", 'click', lococtrl_cb_btnstopman);
|
|
|
|
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnauto", 'click', lococtrl_cb_btnauto);
|
|
|
|
|
|
|
|
gAddEventListener("lococtrl_"+name+"_btnrand", 'click', lococtrl_cb_btnrand);
|
|
|
|
|
|
|
|
|
|
|
|
gAddEventListener("lococtrl_"+name+"_RANGE", 'click', lococtrl_speed);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_RANGE", 'click', lococtrl_speed);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_REVBTN", 'click', lococtrl_reverse);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_REVBTN", 'click', lococtrl_reverse);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_CLOSE", 'click', lococtrl_close);
|
|
|
|
gAddEventListener("lococtrl_"+name+"_CLOSE", 'click', lococtrl_close);
|
|
|
@ -644,6 +670,35 @@ function lococtrl_show(name) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function lococtrl_cb_btnman() {
|
|
|
|
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_btnman");
|
|
|
|
|
|
|
|
var request = { command: "locomotivesetman", locomotive: name };
|
|
|
|
|
|
|
|
serverinout (request, serverinout_defaultCallback);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function lococtrl_cb_btnstopman() {
|
|
|
|
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_btnstopman");
|
|
|
|
|
|
|
|
var request = { command: "locomotivesetautoman", locomotive: name };
|
|
|
|
|
|
|
|
serverinout (request, serverinout_defaultCallback);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function lococtrl_cb_btnauto() {
|
|
|
|
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_btnauto");
|
|
|
|
|
|
|
|
var request = { command: "locomotivesetauto", locomotive: name };
|
|
|
|
|
|
|
|
serverinout (request, serverinout_defaultCallback);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function lococtrl_cb_btnrand() {
|
|
|
|
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_btnauto");
|
|
|
|
|
|
|
|
var request = { command: "locomotivesetautorand", locomotive: name };
|
|
|
|
|
|
|
|
serverinout (request, serverinout_defaultCallback);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function lococtrl_reverse() {
|
|
|
|
function lococtrl_reverse() {
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_REVBTN");
|
|
|
|
var name = getTextBetween(this.id, "lococtrl_", "_REVBTN");
|
|
|
|
var reverse;
|
|
|
|
var reverse;
|
|
|
@ -707,6 +762,9 @@ function lococtrl_speed() {
|
|
|
|
function lococtrl_setData(data) {
|
|
|
|
function lococtrl_setData(data) {
|
|
|
|
var range = document.getElementById("lococtrl_"+data.name+"_RANGE");
|
|
|
|
var range = document.getElementById("lococtrl_"+data.name+"_RANGE");
|
|
|
|
var reverse = document.getElementById("lococtrl_"+data.name+"_REVBTN");
|
|
|
|
var reverse = document.getElementById("lococtrl_"+data.name+"_REVBTN");
|
|
|
|
|
|
|
|
var cbauto = document.getElementById("lococtrl_"+data.name+"_cbauto");
|
|
|
|
|
|
|
|
var cbrand = document.getElementById("lococtrl_"+data.name+"_cbrand");
|
|
|
|
|
|
|
|
var cbmanstop = document.getElementById("lococtrl_"+data.name+"_cbstopman");
|
|
|
|
|
|
|
|
|
|
|
|
if (range && reverse) {
|
|
|
|
if (range && reverse) {
|
|
|
|
debug ("lococtrl: " + data.name + " speed:" + data.speed + " vmax:" +
|
|
|
|
debug ("lococtrl: " + data.name + " speed:" + data.speed + " vmax:" +
|
|
|
@ -714,6 +772,10 @@ function lococtrl_setData(data) {
|
|
|
|
if (data.flags & LOCO_F_REVERSE) reverse.innerHTML = "REV";
|
|
|
|
if (data.flags & LOCO_F_REVERSE) reverse.innerHTML = "REV";
|
|
|
|
else reverse.innerHTML = "FWD";
|
|
|
|
else reverse.innerHTML = "FWD";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbauto.checked = (data.flags & LOCO_F_AUTO);
|
|
|
|
|
|
|
|
cbrand.checked = (data.flags & LOCO_F_RANDOM);
|
|
|
|
|
|
|
|
cbmanstop.checked = (data.flags & LOCO_F_AUTOSTOP);
|
|
|
|
|
|
|
|
|
|
|
|
range.min = 0;
|
|
|
|
range.min = 0;
|
|
|
|
if (data.vmax) range.max = data.vmax;
|
|
|
|
if (data.vmax) range.max = data.vmax;
|
|
|
|
range.value = Math.abs(Number(data.speed));
|
|
|
|
range.value = Math.abs(Number(data.speed));
|
|
|
|