fix station 2/3 program

This commit is contained in:
Kirigaya Kazuto 2017-10-24 12:44:43 +08:00
parent dace9e00fd
commit a92b210e75

View File

@ -2,8 +2,9 @@
Station 2/3 Schedule Program Station 2/3 Schedule Program
]] ]]
require("util") require("util")
require("libevent")
require("checkarg")
local sides = require("sides") local sides = require("sides")
local event = require("event")
-- Config your update functions here (Do not change function name) -- Config your update functions here (Do not change function name)
local redin1 = proxy("redstone", "") local redin1 = proxy("redstone", "")
@ -145,15 +146,30 @@ local function clearRedstoneOutput()
disabledevice("mid_kb") disabledevice("mid_kb")
end end
local function doCheck()
if(redin1==nil or redin2==nil or redout1==nil or redout2==nil) then
error("Check Failed. Please fill your redstone IO configure")
end
if(not (redin1 == redin2 and redin2 == redout1 and redout1 == redout2) ) then
-- Check OK
print("BeforeCheck Pass.")
else
error("Check Failed. Please check your redstone IO configure.")
end
end
local function doInit() local function doInit()
-- Flash output to zero. -- Flash output to zero.
clearRedstoneOutput() clearRedstoneOutput()
AddEventListener( AddEventListener(
"interrupted", "key_down",
function() function(Event,Addr,InputChar)
running = false if(InputChar==32) then -- Pressed Space
print("Interrupt Signal Received.") running = false
return false --Unregister event listener itself print("Interrupt Signal Received.")
return false --Unregister event listener itself
end
end end
) )
@ -324,7 +340,7 @@ local function TCSMain()
end -- No train, do nothing end -- No train, do nothing
end -- End of BA judge end -- End of BA judge
debugValueInfo() debugOutputInfo()
-- Sleep for next loop -- Sleep for next loop
dprint("==========") dprint("==========")