Commit 41adb94d authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

New buttons with indicator lights instead of a colored button.

parent 4cc12d9d
......@@ -47,6 +47,41 @@ function dt_button(element)
}
}
function dt_button_indicator(element)
{
this.div = document.getElementById(element);
this.button_element = 'dt_button_' + element;
this.button_ind_element = 'dt_button_ind_' + element;
this.button_div_element = 'dt_button_div_' + element;
this.div.innerHTML =
"<button type='button' id='" + this.button_element + "'>" +
"<div style='display:inline-block; margin: 0px 5px 0px 1px; border:1px solid black; width:10px; height:10px' id='" + this.button_ind_element + "'></div>" +
"<div style='display:inline-block' id='" + this.button_div_element + "'></div>" +
"</button>";
this.button = document.getElementById(this.button_element);
this.button_ind = document.getElementById(this.button_ind_element);
this.button_div = document.getElementById(this.button_div_element);
this.button_ind.style.background="black";
this.value = function dt_button_value(text) {
this.button_div.innerHTML = text;
}
this.background = function dt_button_background(color)
{
this.button_ind.style.background = color;
}
this.indicator = this.background;
this.click = function dt_button_click(click_action)
{
this.button.onclick = click_action;
}
}
function dt_traceval(element)
{
......@@ -133,7 +168,7 @@ function dt_traceval(element)
"</div>";
changed = true;
if (this.highlight_enabled) {
if (this.highlight_enabled && !this.highlight_high) {
this.background(this.highlight_color_high);
this.highlight_high = true;
}
......
......@@ -392,11 +392,11 @@
</th><td></td>
<td rowspan="2"></td>
<td rowspan="2" style="border: thin solid black" width="1">
<td rowspan="2" style="border: thin solid black" >
<center><b>Speed:</b></center><br>
<input type="button" id="manual_speed_slow" value="Slow" onClick="manual_speed_set('manual_speed_slow');"><br>
<input type="button" id="manual_speed_medium" value="Medium" onClick="manual_speed_set('manual_speed_medium');" style="background: lightgrey"><br>
<input type="button" id="manual_speed_fast" value="Fast" onClick="manual_speed_set('manual_speed_fast');" style="background: lightgrey"><br>
<span id="manual_speed_slow"></span><br>
<span id="manual_speed_medium"></span><br>
<span id="manual_speed_fast"></span><br>
</td>
</tr>
......@@ -1142,38 +1142,38 @@ function do_shell(command)
*
******************************************************************/
var auth_idle = new dt_button("auth_idle");
auth_idle.background("#b0b0b0");
var auth_idle = new dt_button_indicator("auth_idle");
auth_idle.indicator("#b0b0b0");
auth_idle.value("Idle");
auth_idle.click(function() { do_auth('console/idle');} );
var auth_azel = new dt_button("auth_azel");
auth_azel.background("#b0b0b0");
var auth_azel = new dt_button_indicator("auth_azel");
auth_azel.indicator("#b0b0b0");
auth_azel.value("Azimuth & Elevation");
auth_azel.click(function() { do_auth('console/azel');} );
var auth_j2000 = new dt_button("auth_j2000");
auth_j2000.background("#b0b0b0");
var auth_j2000 = new dt_button_indicator("auth_j2000");
auth_j2000.indicator("#b0b0b0");
auth_j2000.value("J2000");
auth_j2000.click(function() { do_auth('console/j2000tracker');} );
var auth_moon = new dt_button("auth_moon");
auth_moon.background("#b0b0b0");
var auth_moon = new dt_button_indicator("auth_moon");
auth_moon.indicator("#b0b0b0");
auth_moon.value("Moon");
auth_moon.click(function() { do_auth('console/moontracker');} );
var auth_sun = new dt_button("auth_sun");
auth_sun.background("#b0b0b0");
var auth_sun = new dt_button_indicator("auth_sun");
auth_sun.indicator("#b0b0b0");
auth_sun.value("Sun");
auth_sun.click(function() { do_auth('console/suntracker');} );
var auth_sat = new dt_button("auth_sat");
auth_sat.background("#b0b0b0");
var auth_sat = new dt_button_indicator("auth_sat");
auth_sat.indicator("#b0b0b0");
auth_sat.value("Satellite");
auth_sat.click(function() { do_auth('console/sattracker');} );
var auth_manual = new dt_button("auth_manual");
auth_manual.background("#b0b0b0");
var auth_manual = new dt_button_indicator("auth_manual");
auth_manual.indicator("#b0b0b0");
auth_manual.value("Manual");
auth_manual.click(function() { do_auth('console/manual');} );
......@@ -1347,18 +1347,18 @@ function dt_auth_status_line(obj, line, azimuth_off, elevation_off)
spg_sun.style.background = "grey";
spg_moon.style.background = "grey";
spg_manual.style.background = "grey";
auth_idle.background("#b0b0b0");
auth_azel.background("#b0b0b0");
auth_j2000.background("#b0b0b0");
auth_sat.background("#b0b0b0");
auth_moon.background("#b0b0b0");
auth_sun.background("#b0b0b0");
auth_manual.background("#b0b0b0");
auth_idle.indicator("#b0b0b0");
auth_azel.indicator("#b0b0b0");
auth_j2000.indicator("#b0b0b0");
auth_sat.indicator("#b0b0b0");
auth_moon.indicator("#b0b0b0");
auth_sun.indicator("#b0b0b0");
auth_manual.indicator("#b0b0b0");
if (line == "console/azel") {
azel_do_cp_pos();
spg_azel.style.background = "lightgrey";
auth_azel.background("lightgreen");
auth_azel.indicator("lightgreen");
spg_azel.style.display = 'block';
} else {
spg_azel.style.display = 'none';
......@@ -1366,37 +1366,37 @@ function dt_auth_status_line(obj, line, azimuth_off, elevation_off)
if (line == "console/j2000tracker") {
j2000_do_cp_pos();
spg_j2000.style.background = "lightgrey";
auth_j2000.background("lightgreen");
auth_j2000.indicator("lightgreen");
spg_j2000.style.display = 'block';
} else {
spg_j2000.style.display = 'none';
}
if (line == "console/sattracker") {
spg_sat.style.background = "lightgrey";
auth_sat.background("lightgreen");
auth_sat.indicator("lightgreen");
spg_sat.style.display = 'block';
} else {
spg_sat.style.display = 'none';
}
if (line == "console/idle") {
auth_idle.background("lightgreen");
auth_idle.indicator("lightgreen");
}
if (line == "console/moontracker") {
spg_moon.style.background = "lightgrey";
auth_moon.background("lightgreen");
auth_moon.indicator("lightgreen");
spg_moon.style.display = 'block';
} else {
spg_moon.style.display = 'none';
}
if (line == "console/suntracker") {
spg_sun.style.background = "lightgrey";
auth_sun.background("lightgreen");
auth_sun.indicator("lightgreen");
spg_sun.style.display = 'block';
} else {
spg_sun.style.display = 'none';
}
if (line == "console/manual") {
auth_manual.background("lightgreen");
auth_manual.indicator("lightgreen");
spg_manual.style.background = "lightgrey";
manual_spg_active = 1;
spg_manual.style.display = 'block';
......@@ -1507,18 +1507,18 @@ function azel_set_el(el)
*
******************************************************************/
var j2000_tracking_enabled = new dt_button("j2000_tracking_enabled");
j2000_tracking_enabled.background("white");
var j2000_tracking_enabled = new dt_button_indicator("j2000_tracking_enabled");
j2000_tracking_enabled.indicator("white");
j2000_tracking_enabled.value("Tracking enabled");
j2000_tracking_enabled.click(function() { j2000_toggle_switch('enabled'); } );
var j2000_refraction_enabled = new dt_button("j2000_refraction_enabled");
j2000_refraction_enabled.background("white");
var j2000_refraction_enabled = new dt_button_indicator("j2000_refraction_enabled");
j2000_refraction_enabled.indicator("white");
j2000_refraction_enabled.value("Refraction");
j2000_refraction_enabled.click(function() { j2000_toggle_switch('refraction'); } );
var j2000_dt_model_enabled = new dt_button("j2000_dt_model_enabled");
j2000_dt_model_enabled.background("white");
var j2000_dt_model_enabled = new dt_button_indicator("j2000_dt_model_enabled");
j2000_dt_model_enabled.indicator("white");
j2000_dt_model_enabled.value("DT model");
j2000_dt_model_enabled.click(function() { j2000_toggle_switch('dt_model'); } );
......@@ -1591,9 +1591,9 @@ function j2000_status_cb(
switchtype=j2000_refraction_enabled;
if (switch_array[i].split('=')[1].charAt(0) == '1')
switchtype.background("lightgreen");
switchtype.indicator("lightgreen");
else
switchtype.background("red");
switchtype.indicator("red");
}
}
}
......@@ -1679,18 +1679,18 @@ function j2000_set_coord(ra, de)
*
******************************************************************/
var sat_enabled = new dt_button("sat_enabled");
sat_enabled.background("white");
var sat_enabled = new dt_button_indicator("sat_enabled");
sat_enabled.indicator("white");
sat_enabled.value("Tracking enabled");
sat_enabled.click(function() { sat_toggle_switch('enabled'); } );
var sat_refraction_enabled = new dt_button("sat_refraction_enabled");
sat_refraction_enabled.background("white");
var sat_refraction_enabled = new dt_button_indicator("sat_refraction_enabled");
sat_refraction_enabled.indicator("white");
sat_refraction_enabled.value("Refraction");
sat_refraction_enabled.click(function() { sat_toggle_switch('refraction'); } );
var sat_dt_model_enabled = new dt_button("sat_dt_model_enabled");
sat_dt_model_enabled.background("white");
var sat_dt_model_enabled = new dt_button_indicator("sat_dt_model_enabled");
sat_dt_model_enabled.indicator("white");
sat_dt_model_enabled.value("DT model");
sat_dt_model_enabled.click(function() { sat_toggle_switch('dt_model'); } );
......@@ -1740,9 +1740,9 @@ function sat_status_cb(switches)
if (switchset == true) {
if (switch_array[i].split('=')[1].charAt(0) == '1')
switchtype.background("lightgreen");
switchtype.indicator("lightgreen");
else
switchtype.background("red");
switchtype.indicator("red");
}
}
}
......@@ -1816,13 +1816,13 @@ function sat_toggle_switch(switchname)
*
******************************************************************/
var sun_enabled = new dt_button("sun_enabled");
sun_enabled.background("white");
var sun_enabled = new dt_button_indicator("sun_enabled");
sun_enabled.indicator("white");
sun_enabled.value("Tracking enabled");
sun_enabled.click(function() { sun_toggle_switch('enabled'); } );
var sun_dt_model_enabled = new dt_button("sun_dt_model_enabled");
sun_dt_model_enabled.background("white");
var sun_dt_model_enabled = new dt_button_indicator("sun_dt_model_enabled");
sun_dt_model_enabled.indicator("white");
sun_dt_model_enabled.value("DT model");
sun_dt_model_enabled.click(function() { sun_toggle_switch('dt_model'); } );
......@@ -1855,9 +1855,9 @@ function sun_status_cb(switches)
if (switchset == true) {
if (switch_array[i].split('=')[1].charAt(0) == '1')
switchtype.background("lightgreen");
switchtype.indicator("lightgreen");
else
switchtype.background("red");
switchtype.indicator("red");
}
}
}
......@@ -1906,13 +1906,13 @@ function sun_toggle_switch(switchname)
*
******************************************************************/
var moon_enabled = new dt_button("moon_enabled");
moon_enabled.background("white");
var moon_enabled = new dt_button_indicator("moon_enabled");
moon_enabled.indicator("white");
moon_enabled.value("Tracking enabled");
moon_enabled.click(function() { moon_toggle_switch('enabled'); } );
var moon_dt_model_enabled = new dt_button("moon_dt_model_enabled");
moon_dt_model_enabled.background("white");
var moon_dt_model_enabled = new dt_button_indicator("moon_dt_model_enabled");
moon_dt_model_enabled.indicator("white");
moon_dt_model_enabled.value("DT model");
moon_dt_model_enabled.click(function() { moon_toggle_switch('dt_model'); } );
......@@ -1945,9 +1945,9 @@ function moon_status_cb(switches)
if (switchset == true) {
if (switch_array[i].split('=')[1].charAt(0) == '1')
switchtype.background("lightgreen");
switchtype.indicator("lightgreen");
else
switchtype.background("red");
switchtype.indicator("red");
}
}
}
......@@ -2005,29 +2005,42 @@ var manual_slow = 0.0001;
var manual_medium = 0.0003;
var manual_fast = 0.001;
var manual_speed = manual_slow;
var manual_speed_slow = document.getElementById('manual_speed_slow');
var manual_speed_medium = document.getElementById('manual_speed_medium');
var manual_speed_fast = document.getElementById('manual_speed_fast');
var manual_color_selected = 'lightgreen';
var manual_color_off = 'grey';
var manual_button_slow = new dt_button_indicator("manual_speed_slow");
manual_button_slow.indicator(manual_color_selected);
manual_button_slow.value("Slow");
manual_button_slow.click(function() { manual_speed_set('manual_speed_slow'); } );
var manual_button_medium = new dt_button_indicator("manual_speed_medium");
manual_button_medium.indicator(manual_color_off);
manual_button_medium.value("Medium");
manual_button_medium.click(function() { manual_speed_set('manual_speed_medium'); } );
var manual_button_fast = new dt_button_indicator("manual_speed_fast");
manual_button_fast.indicator(manual_color_off);
manual_button_fast.value("Fast");
manual_button_fast.click(function() { manual_speed_set('manual_speed_fast'); } );
manualcommand = new manual_command(manual_command_url, "manual");
function manual_speed_set(button)
{
manual_speed_slow.style.background = 'lightgrey';
manual_speed_medium.style.background = 'lightgrey';
manual_speed_fast.style.background = 'lightgrey';
manual_button_slow.indicator(manual_color_off);
manual_button_medium.indicator(manual_color_off);
manual_button_fast.indicator(manual_color_off);
if (button == "manual_speed_slow") {
manual_speed = manual_slow
manual_speed_slow.style.background = '#f0f0f0';
manual_button_slow.indicator(manual_color_selected);
}
if (button == "manual_speed_medium") {
manual_speed = manual_medium
manual_speed_medium.style.background = '#f0f0f0';
manual_button_medium.indicator(manual_color_selected);
}
if (button == "manual_speed_fast") {
manual_speed = manual_fast
manual_speed_fast.style.background = '#f0f0f0';
manual_button_fast.indicator(manual_color_selected);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment