summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-04-01 20:24:04 +0100
committerubq323 <ubq323@ubq323.website>2024-04-01 20:24:04 +0100
commitc86ef0c09690baf82260481d17e5607f8f766791 (patch)
treeb57649d111ab2cc8b47d835ddbef8e8eacc1ea9c
parent102d43047dacab857d41f3b5c1d93d81dea43a2b (diff)
launch john
-rw-r--r--john.lua70
1 files changed, 37 insertions, 33 deletions
diff --git a/john.lua b/john.lua
index 9837cd3..4ae24dd 100644
--- a/john.lua
+++ b/john.lua
@@ -16,38 +16,42 @@ if monitors == nil or #monitors < 1 then
error("need john.monitors setting")
end
-local h = assert(http.get(URL, {}, true))
-fb:ppm(h)
-
-local W,H = fb:get_size()
-
-local total_width = 0
-for ix,iname in ipairs(monitors) do
- local mon = peripheral.wrap(iname)
- total_width = total_width + (mon.getSize())*2
-end
-local leftover = total_width - W
-print("mmm",total_width,W,leftover)
-local xoffs = -math.floor(leftover/2)
-
-for ix,iname in ipairs(monitors) do
- print("doing",ix,iname,"at",xoffs)
- local mon = peripheral.wrap(iname)
- mon.clear()
- mon.setTextScale(0.5)
- local _, bee = pcall(function() fb:present(mon,xoffs,0) end)
- xoffs = xoffs + (mon.getSize())*2 + 8
- -- print(bee)
+function main()
+ while true do
+ local h = assert(http.get(URL, {}, true))
+ fb:ppm(h)
+
+ local W,H = fb:get_size()
+
+ local total_width = 0
+ for ix,iname in ipairs(monitors) do
+ local mon = peripheral.wrap(iname)
+ total_width = total_width + (mon.getSize())*2
+ end
+ local leftover = total_width - W
+ print("mmm",total_width,W,leftover)
+ local xoffs = -math.floor(leftover/2)
+
+ for ix,iname in ipairs(monitors) do
+ print("doing",ix,iname,"at",xoffs)
+ local mon = peripheral.wrap(iname)
+ mon.clear()
+ mon.setTextScale(0.5)
+ local _, bee = pcall(function() fb:present(mon,xoffs,0) end)
+ xoffs = xoffs + (mon.getSize())*2 + 8
+ -- print(bee)
+ end
+
+ h.close()
+
+ os.sleep(15)
+ end
end
-h.close()
-
--- local m = peripheral.wrap "bottom"
--- m.clear()
--- m.setTextScale(0.5)
--- local t = term.redirect(m)
--- local _, bee = pcall(function()
--- fb:present()
--- end)
--- term.redirect(t)
--- print(bee)
+while true do
+ local ok, err = pcall(main)
+ if not ok then
+ print("error",err)
+ os.sleep(5)
+ end
+end