Fix some bugs

parent c1f0a0be
......@@ -3,7 +3,7 @@
super_mario_count = 0
local disp = require("display")
local disp.setup()
disp.setup()
local timer_id = 3
local timer_mqtt_id = 4
......@@ -35,12 +35,12 @@ require("tools") -- debounce function
function change_count_on_input(pin, direction)
gpio.mode(pin, gpio.INT)
gpi.trig(pin, "both", debounce(
gpio.trig(pin, "both", debounce(
function (level)
if(level == gpio.high) then
if level == gpio.high then
change_super_mario_count(direction)
end
end
end)
)
end
......
......@@ -9,7 +9,7 @@ end
function debounce (func, delay)
local last = 0
-- 50ms * 1000 as tmr.now() has μs resolution
local delay = if delay then delay else 50000 end
local delay = delay or 50000
return function (...)
local now = tmr.now()
......@@ -21,4 +21,4 @@ function debounce (func, delay)
last = now
return func(...)
end
end
\ No newline at end of file
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment