Skip to content

Commit

Permalink
Fix W1m dashboard.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchote committed Aug 16, 2024
1 parent 6f81488 commit 2d15d05
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
6 changes: 3 additions & 3 deletions dashboard/templates/onemetre.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
<div class="col-lg-3 col-md-6 col-xs-12 g-2">
<div class="list-group rounded-0">
<span class="list-group-item" data-mount-index='["w1m_telescope"]' data-power-index='["w1m_power", "mount"]' data-generator="onemetreState">Mount</span>
<span class="list-group-item" data-mount-index='["w1m_telescope"]' data-power-index='["w1m_power"]' data-generator="onemetreState">Mount</span>
<span class="list-group-item" data-index='["w1m_telescope"]' data-generator="onemetreRADec">RA / Dec</span>
<span class="list-group-item" data-index='["w1m_telescope"]' data-generator="onemetreAltAz">Alt / Az</span>
<span class="list-group-item" data-index='["w1m_telescope"]' data-generator="onemetreSunMoon">Sun / Moon Sep.</span>
Expand Down Expand Up @@ -96,8 +96,8 @@
</tr>
<tr>
<td>Focus</td>
<td data-focuser-index='["w1m_telescope"]' data-generator="onemetreFocus"></td>
<td data-focuser-index='["w1m_telescope"]' data-generator="onemetreRedFocus"></td>
<td data-index='["w1m_telescope"]' data-generator="onemetreFocus"></td>
<td data-index='["w1m_telescope"]' data-generator="onemetreRedFocus"></td>
</tr>
</tbody>
</table>
Expand Down
40 changes: 34 additions & 6 deletions static/rockit-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ function andorState(row, cell, data) {
}

function andorCooling(row, cell, data) {
console.log('here');
const state = getData(data, ["state"]);
const temperature = getData(data, ["temperature"]);
const temperature_locked = getData(data, ["temperature_locked"]);
Expand Down Expand Up @@ -815,13 +814,20 @@ function onemetreState(row, cell, data) {
['LIMITING', 'text-warning'],
];

if (data && 'state' in data) {
if ('axes_homed' in data && !data['axes_homed']) {
const mount_data = getData(data, row.data('mount-index'));
const power_data = getData(data, row.data('power-index'));

if (power_data && 'tel80' in power_data && 'tel12' in power_data && (!power_data['tel80'] || !power_data['tel12'])) {
cell.html('POWER OFF');
cell.addClass('text-danger');
}
if (mount_data && 'state' in mount_data) {
if ('axes_homed' in mount_data && !mount_data['axes_homed']) {
cell.html('NOT HOMED');
cell.addClass('text-danger');
} else {
cell.html(state[data['state']][0]);
cell.addClass(state[data['state']][1]);
cell.html(state[mount_data['state']][0]);
cell.addClass(state[mount_data['state']][1]);
}
} else {
cell.html('ERROR');
Expand Down Expand Up @@ -888,7 +894,29 @@ function onemetreFocus(row, cell, data) {
}

function onemetreRedFocus(row, cell, data) {
cell.html('N/A');
const status = getData(data, ['status']);
const current_steps = getData(data, ['current_steps']);

let label, style;
if (status === 0) {
label = 'OFFLINE';
style = 'text-danger';
} else if (status === 1) {
label = 'INITIALIZING';
style = 'text-warning';
} else if (status === 3) {
label = 'MOVING';
style = 'text-warning';
} else if (status === 2 && current_steps !== undefined) {
label = current_steps + ' steps';
style = '';
} else {
label = 'ERROR';
style = 'text-danger';
}

cell.html(label);
cell.addClass(style);
}

function previewHeader(row, data) {
Expand Down
1 change: 1 addition & 0 deletions update-dashboard-data
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def generate_onemetre_json(output_path, date, environment, status):
(daemons.onemetre_pipeline, 'w1m_pipeline', lambda d: d.report_status()),
(daemons.onemetre_blue_camera, 'w1m_blue', lambda d: d.report_status()),
(daemons.onemetre_red_camera, 'w1m_red', lambda d: d.report_status()),
(daemons.onemetre_red_focuser, 'w1m_red_focuser', lambda d: d.report_status()),
(daemons.onemetre_power, 'w1m_power', lambda d: d.last_measurement()),
(daemons.onemetre_dehumidifier, 'w1m_dehumidifier', lambda d: d.status())
], status))
Expand Down

0 comments on commit 2d15d05

Please sign in to comment.