Merge pull request #1187 from VOREStation/apc-map

Enhances power monitor computers to use the nano-map to show APC locations.
This commit is contained in:
Arokha Sieyes
2017-03-15 22:55:10 -04:00
committed by GitHub
5 changed files with 67 additions and 0 deletions
@@ -29,6 +29,10 @@
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "power_monitor.tmpl", "Power Monitoring Console", 800, 500, state = state)
// adding a template with the key "mapContent" enables the map ui functionality
ui.add_template("mapContent", "power_monitor_map_content.tmpl")
// adding a template with the key "mapHeader" replaces the map header content
ui.add_template("mapHeader", "power_monitor_map_header.tmpl")
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
@@ -163,6 +163,10 @@
// Cell Status
APC_entry["cell_charge"] = A.cell ? round(A.cell.percent()) : "NO CELL"
APC_entry["cell_status"] = A.cell ? chg[A.charging+1] : "N"
// Location
APC_entry["x"] = A.x
APC_entry["y"] = A.y
APC_entry["z"] = A.z
// Other info
APC_entry["total_load"] = reading_to_text(A.lastused_total)
// Hopefully removes those goddamn \improper s which are screwing up the UI