mirror of
https://github.com/XeonSquared/OC-Copper.git
synced 2024-11-14 13:58:05 +11:00
Update IoT protocol for P9K-friendliness
This commit is contained in:
parent
2cd85360c6
commit
bb8671c202
@ -64,7 +64,7 @@ They are, as follows:
|
||||
|
||||
0: Void (Only useful for Actions. Think 'ignore anything out of here'.
|
||||
1: Human-Readable String (Generic string that a user could feasibly type. No special characters.)
|
||||
2: Boolean (Length > 0 means true, otherwise false. Odd definition, but also convenient.)
|
||||
2: Boolean ("false" means false, "true" means true, anything else is disallowed.)
|
||||
3: Float (See Human-Readable String, but translated to a number by the device.)
|
||||
4: Descriptor (See Part 3.)
|
||||
|
||||
|
@ -4,14 +4,12 @@
|
||||
|
||||
UR=CG("redstone")
|
||||
function UT(p)
|
||||
if ({["true"]=0,["false"]=15})[p]then
|
||||
US=p
|
||||
if#p>0then
|
||||
UR.setOutput(1,15)
|
||||
else
|
||||
UR.setOutput(1,0)
|
||||
UR.setOutput(1,UM[p])
|
||||
end
|
||||
end
|
||||
UT("")
|
||||
UT("false")
|
||||
function UG(t)
|
||||
RS(t,4,"\xC0\x42active.\x81setName")
|
||||
end
|
||||
@ -19,8 +17,7 @@ N={
|
||||
[0]=UG,
|
||||
[1]=function(f)RS(f,4,"\xC1"..US)end,
|
||||
[0x41]=function(_,p)UT(p)end,
|
||||
[0x82]=function(_,p)if#p>0then CG("eeprom").setLabel(p)TH=p end end,
|
||||
}
|
||||
[0x82]=function(_,p)if#p>0then CG("eeprom").setLabel(p)TH=p end end}
|
||||
function UI(f,t,p,d)
|
||||
local m=t==TH
|
||||
if p==1 and(t=="*"or m)then
|
||||
|
@ -21,7 +21,7 @@ local otext = text
|
||||
local function pass()
|
||||
text = text:gsub(".\n+.", function(i)
|
||||
local l = i:sub(1, 1) .. i:sub(#i)
|
||||
if not l:match("[^%(%)%{%}].") then
|
||||
if not l:match("[^%(%)%{%}%,].") then
|
||||
return l
|
||||
end
|
||||
return i:sub(1, 1) .. "\n" .. i:sub(#i)
|
||||
|
@ -53,18 +53,12 @@ TS(t,g..S.char(a,1)..d)x=RP(j,R4)end
|
||||
RN[t..g]=x
|
||||
end j()end
|
||||
-- EXAMPLE IoT Redstone Top Controller --
|
||||
UR=CG("redstone")function UT(p)US=p
|
||||
if#p>0then
|
||||
UR.setOutput(1,15)else
|
||||
UR.setOutput(1,0)end
|
||||
UR=CG("redstone")function UT(p)if ({["true"]=0,["false"]=15})[p]then
|
||||
US=p
|
||||
UR.setOutput(1,UM[p])end
|
||||
end
|
||||
UT("")function UG(t)RS(t,4,"\xC0\x42active.\x81setName")end
|
||||
N={[0]=UG,
|
||||
[1]=function(f)RS(f,4,"\xC1"..US)end,
|
||||
[0x41]=function(_,p)UT(p)end,
|
||||
[0x82]=function(_,p)if#p>0then CG("eeprom").setLabel(p)TH=p end end,
|
||||
}
|
||||
function UI(f,t,p,d)local m=t==TH
|
||||
UT("false")function UG(t)RS(t,4,"\xC0\x42active.\x81setName")end
|
||||
N={[0]=UG,[1]=function(f)RS(f,4,"\xC1"..US)end,[0x41]=function(_,p)UT(p)end,[0x82]=function(_,p)if#p>0then CG("eeprom").setLabel(p)TH=p end end}function UI(f,t,p,d)local m=t==TH
|
||||
if p==1 and(t=="*"or m)then
|
||||
UG(f)end
|
||||
if p==4 and m then
|
||||
|
Loading…
Reference in New Issue
Block a user