]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_lamp/commitdiff
updates to one file per pattern and fixes a couple bugs
authorRachael <srbennett@gmail.com>
Sun, 16 Oct 2016 06:49:32 +0000 (23:49 -0700)
committerRachael <srbennett@gmail.com>
Sun, 16 Oct 2016 06:49:32 +0000 (23:49 -0700)
draw-kiss.lua
init2.lua
lamp-touch.lua

index 381b52aede8319c22a2914dc1bce6fb3f2ef1d0c..a9b7660b06fe61c19130fb08dbb2908913df02a4 100644 (file)
@@ -1,4 +1,4 @@
-return  function(t,fb,g,r,b)
+return function(t,fb,g,r,b)
   t:unregister()
   fb:fill(0,0,0)
   local ix = 0
@@ -17,4 +17,4 @@ return  function(t,fb,g,r,b)
     ix = 1 - ix
     dodraw()
   end)
-end
\ No newline at end of file
+end
index a71dc7bf3d12fe513cd2e5f6c51553a21f7d00ae..1311114dd46dced4d4d201c27789892eaf92a522 100644 (file)
--- a/init2.lua
+++ b/init2.lua
@@ -14,7 +14,9 @@ cap = require "cap1188"
 
 local function drawfailsafe(t,fb,g,r,b) fb:fill(g,r,b) end
 function loaddrawfn(name)
-  local f = loadfile ("draw-%s.lc":format(name))
+  print("The name is ")
+  print(name)
+  local f = loadfile (string.format("draw-%s.lc", name))
   local fn = f and f()
   if fn then return fn else return drawfailsafe end
 end
index cfa2719ceac6fe444828f81e6feb77766a06a1e9..58e6058ad36ba4a8de393d2a300e7f4603680c17 100644 (file)
@@ -13,8 +13,9 @@ local touchfnix = 1
 -- Whip through the drawing functions and build indexes
 local k,v
 for k,v in pairs(file.list()) do
-  local ix, _, meth = k:find("^draw-(%w+)\\.lc$")
+  local ix, _, meth = k:find("^draw%-(%w+)%.lc$")
   if ix then
+    print("XXXXX touching", meth, #touchfns)
     touchfns[#touchfns+1] = meth
     if meth == "fill" then touchfnix = #touchfns end
   end
@@ -118,10 +119,12 @@ local function ontouch()
 
     -- front middle: mode select (rate-limited, not exactly debounced)
     if bit.isset(down,3) then
+      print("front middle touched", touch_db_fn)
       if touch_db_fn == nil then
        touchfnix = touchfnix + 1
        if touchfnix > #touchfns then touchfnix = 1 end
        touch_db_fn = touch_tq:queue(200,onfndebounce)
+       print("the function is now", touch_db_fn)
       end
       claimfb()
     end
@@ -131,8 +134,11 @@ local function ontouch()
   -- if bit.isset(down,4) then end
 
   -- draw if we've claimed it!
+  print("ahhhh", ledfb, touchfb)
   if ledfb == touchfb then
     touchtmr:unregister()
+    print("XXXXX looking for XXXXX")
+    print(touchfnix)
     loaddrawfn(touchfns[touchfnix])(touchtmr,touchfb,touchcolorvec(touchcolor)); dodraw()
     touchtmr:start()
   end