Commit 0ce638d2 authored by Jorge Visca's avatar Jorge Visca
Browse files

clean up

parent 7848f187
......@@ -84,7 +84,7 @@ apds9960r.color.set_rgb_callback(M.rgb_cb.call)
-- `nvs.read("color_sensor","period")`, deafults to 500.
M.enable = function (on, period)
if on then
period = period or nvs.read("color_sensor","period", 200)
period = period or nvs.read("color_sensor","period", 200) or 200
apds9960r.color.enable(period)
else
apds9960r.color.enable(false)
......
......@@ -5,15 +5,15 @@ local TEST_SEC = 100000 -- test for 10 seconds
local color = require('color')
local dump_rgb = function(r,g,b,a, hsv)
print('rgba:', r, g, b, a, 'hsv:')
local dump_rgb = function(r, g, b, a, h, s, v)
print('rgba:', r, g, b, a, 'hsv:', h, s, v)
end
local dump_color_change = function(name, h, s, v)
print('COLOR:'..tostring(name), 'hsv:', h, s, v)
end
color.rgb_cb.append(print) --dump_rgb)
color.rgb_cb.append(dump_rgb)
color.color_cb.append(dump_color_change)
print('Start color monitoring for '..TEST_SEC..'s')
......
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