View difference between Paste ID: 3TDNHLs5 and RjNkLDW5
SHOW: | | - or go back to the newest paste.
1
-- CompDCoreMon
2
3-
-- DEBUG
3+
4-
DEBUG = true
4+
5
rednetProtocol = "core"
6-
if DEBUG then 
6+
7-
	print("[DEBUG] Start of compCore")
7+
8
9
hostnameCMD = "cmdCore"
10
11
m = peripheral.wrap("bottom")
12
13
function Draw(v)
14
	-- v = {totalEnergy,MaxEnergy,tickPerS)
15
	m.clear()
16
	m.setBackgroundColor(colors.lightblue)
17
	m.setCursorPos(1,1)
18
	m.setTextColor(colors.black)
19
	m.write("Total charge : ")
20
	m.setCursorPos(16,1)
21-
	if DEBUG then 
21+
22-
		print("[DEBUG] Start of draw v = ",v)
22+
23
	else
24
		m.setTextColor(colors.red)
25
	end
26
	m.write(v[1])
27
	m.setTextColor(colors.black)
28
	m.setCursorPos(1,2)
29
	m.write("[")
30
	local nbGreen = (v[1] * 100) / v[2]
31
	m.setTextColor(colors.lime)
32
	for i=0,nbGreen,+1 do
33
		m.write("I")
34
	end
35
	m.setTextColor(colors.black)
36
	for j=0,(27-nbGreen),+1 do,
37
		m.write('-')
38
	end
39
	m.write("]")
40
	m.setCursorPos(1,4)
41
	m.write("Rf/tick = "
42
	m.setCursorPos(12,4)
43-
	for i=1,nbGreen do
43+
44
		m.setTextColor(colors.green)
45
	else
46
		m.setTextColor(colors.red)
47-
	for j=1,(28-nbGreen) do
47+
48
	m.write(v[3])
49
end
50
51
while true do
52-
	m.write("Rf/tick = ")
52+
53
	Draw(v)
54
end