local interval = 30 local function showquarystatus(mon, msg, name) if msg.enabled == 1 then digiline_send(mon, "-----"..name.."-----") else digiline_send(mon, "#####"..name.."#####") end digiline_send(mon, "Dgging..."..msg.max_depth) digiline_send(mon, "Radius:"..msg.radius) digiline_send(mon, "Level:" .. msg.dig_level) digiline_send(mon, "Dug:" .. msg.dug_nodes) local finished = "No" if msg.finished == true then finished = "Yes" end digiline_send(mon, "Finished:" .. finished) end local function sendmessage(msg) digiline_send("q1", msg) digiline_send("q2", msg) digiline_send("q3", msg) digiline_send("q4", msg) end local function setuptouchscreen() digiline_send("touchscreen", { command = "set", locked = true, no_prepend = false, real_coordinates = false, fixed_size = false, width = 10, height = 8, focus = "Tacit", }) digiline_send("touchscreen", { { command="clear", }, { label="Turn all on", command="addbutton", name="btnTurnAllOn", H=0.8, W=1.6, X=0.8, Y=0.8, }, { label="Turn all off", command="addbutton", name="btnTurnAllOff", X=0.8, H=0.8, W=1.6, Y=2, }, { label="Quaries", listelements={ "1", "2", "3", "4", }, selected_id=mem.selectedq or 0, transparent=false, command="addtextlist", name="qlist", W=2.6, Y=0.8, H=1.8, X=5.6, }, { label="Turn on", command="addbutton", name="btnTurnOn", H=0.8, W=1.6, X=3.2, Y=0.8, } , { label="Turn off", command="addbutton", name="btnTurnOff", H=0.8, W=1.6, X=3.2, Y=2, }, { label="Restart all", command="addbutton", name="btnRestartAll", X=0.8, H=0.8, W=1.6, Y=3.2, }, { label="Restart", command="addbutton", name="btnRestart", H=0.8, W=1.6, X=3.2, Y=3.2, }, {X=7.18,label="Created with SX Digi labs Touch Designer",Y=8.11,command="addlabel"} }) end if event.type == "program" then setuptouchscreen() mem.heat = heat interrupt(interval) end if event.type == "interrupt" then digiline_send("q1", "GET") digiline_send("q2", "GET") digiline_send("q3", "GET") digiline_send("q4", "GET") digiline_send("pm", "GET") interrupt(interval) end if event.type == "digiline" then if event.channel == "touchscreen" then if event.msg.btnTurnAllOn ~= nill then sendmessage("on") elseif event.msg.btnTurnAllOff ~= nil then sendmessage("off") elseif event.msg.btnRestartAll ~= nil then sendmessage("restart") elseif event.msg.btnTurnOn ~= nil then local q = mem.selectedq or 0 digiline_send("q"..q, "on") elseif event.msg.btnTurnOff ~= nil then local q = mem.selectedq or 0 digiline_send("q"..q, "off") elseif event.msg.btnRestart ~= nil then local q = mem.selectedq or 0 digiline_send("q"..q, "restart") elseif event.msg.qlist ~= nil then mem.selectedq = tonumber(string.sub(event.msg.qlist,5,5)) setuptouchscreen() end elseif event.channel == "pm" then digiline_send("monpm", "Power HV") digiline_send("monpm", "S:"..event.msg.supply) digiline_send("monpm", "D:"..event.msg.demand) digiline_send("monpm", "Battery:"..event.msg.battery_count) digiline_send("monpm", "BC:"..event.msg.battery_charge) digiline_send("monpm", "BCM:"..event.msg.battery_charge_max) elseif event.channel == "q1" then showquarystatus("mon", event.msg, event.channel) elseif event.channel == "q2" then showquarystatus("mon2", event.msg, event.channel) elseif event.channel == "q3" then showquarystatus("mon3", event.msg, event.channel) elseif event.channel == "q4" then showquarystatus("mon4", event.msg, event.channel) else mem.event = event end end