-- 2 : claimed locally but remote has changed
isblackout = false
-function dodraw() if not isblackout then ws2812.write(ledfb) end end
+dimfactor = 0
+function dodraw()
+ if not isblackout then
+ if dimfactor > 0 then
+ for i=1, ledfb:size() do
+ local g,r,b = ledfb:get(i)
+ -- need to allocate two buffers, reading from one and writing to the other to allow for some pixels only being set once then dimmed into infinity and others being redrawn each frame.
+ for dimindex = 0, dimfactor do
+ g = math.floor((g+1)/2)
+ b = math.floor((b+1)/2)
+ r = math.floor((r+1)/2)
+ end
+ ledfb:set(i, g, r, b)
+ end
+ end
+ --print(ledfb)
+ ws2812.write(ledfb)
+ end
+end
function doremotedraw()
if ledfb_claimed > 1
then ledfb_claimed = 2
--- globals referenced: isblackout, dodraw, ledfb, ledfb_claimed, remotefb, remotetmr, lamp_announce, tq, loaddrawfn
+-- globals referenced: isblackout, dimfactor, dodraw, ledfb, ledfb_claimed, remotefb, remotetmr, lamp_announce, tq, loaddrawfn
--
-- globals asserted: touchcolor, touchlastfn
--
local touch_db_fn = nil
local touchfns = { }
local touchfnix = 1
-local dimfactor = 0
if touchcolor == nil then touchcolor = 40 end
if touchlastfn == nil then touchlastfn = "fill" end
elseif c < 32 then r = 0; g = 15 - cm; b = cm
else r = cm; g = 0; b = 15 - cm
end
- if (dimfactor > 0) then
- print("before green is ", g)
- print("before blue is ", b)
-
- for i = 0, dimfactor do
- g = math.floor((g+1)/2)
- b = math.floor((b+1)/2)
- r = math.floor((r+1)/2)
- end
- print("green is ", g)
- print("blue is ", b)
- end
return g,r,b
end
end
end
- -- XXX front left: no function assigned, maybe device select or something?
+ -- XXX front left: dim the display
if bit.isset(down,4) then
dimdisplay()
claimfb()
. ./host/pushcommon.sh
dopushcompile net/nwfmqtt.lua
-dopushcompile cap1188/cap1188.lua
-dopushcompile cap1188/cap1188-init.lua
+#dopushcompile cap1188/cap1188.lua
+#dopushcompile cap1188/cap1188-init.lua
dopushcompile examples/lamp/lamp-touch.lua
-dopushcompile examples/lamp/lamp-remote.lua
-dopushcompile examples/lamp/telnetd-cap.lua
+#dopushcompile examples/lamp/lamp-remote.lua
+#dopushcompile examples/lamp/telnetd-cap.lua
#dopush examples/lamp/conf/nwfmqtt.conf
#dopush examples/lamp/conf/nwfmqtt.subs
dopushcompile examples/lamp/init2.lua
-for i in examples/lamp/draw-*.lua; do
- dopushcompile ${i}
-done
+#for i in examples/lamp/draw-*.lua; do
+# dopushcompile ${i}
+#done
echo "SUCCESS"