Refactorisé le projet Cigales et corrigé un bug de timer dans init.lua
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
-- Scripts à charger après le boot pour démarrer son appli
|
||||
|
||||
print("\n boot.lua zf190119.1933 \n")
|
||||
print("\n boot.lua zf190721.1603 \n")
|
||||
|
||||
function heartbeat()
|
||||
f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end
|
||||
@@ -11,6 +11,7 @@ function heartbeat()
|
||||
end)
|
||||
end
|
||||
|
||||
f= "wifi_off.lua" if file.exists(f) then dofile(f) end
|
||||
--f= "wifi_ap_start.lua" if file.exists(f) then dofile(f) end
|
||||
--f= "wifi_cli_conf.lua" if file.exists(f) then dofile(f) end
|
||||
--f= "wifi_cli_start.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
-- le script repair.lua pendant xx secondes avant de continuer
|
||||
--Source: https://nodemcu.readthedocs.io/en/master/en/modules/node/#nodebootreason
|
||||
|
||||
print("\n init.lua zf190131.009 \n")
|
||||
print("\n init.lua zf190601.1612 \n")
|
||||
|
||||
zswitch=3 --switch flash
|
||||
gpio.mode(zswitch, gpio.INT, gpio.PULLUP)
|
||||
|
||||
function hvbouton()
|
||||
-- gpio.trig(zswitch, "none")
|
||||
tmr.unregister(initalarme)
|
||||
initalarme:unregister()
|
||||
f= "boot.lua" if file.exists(f) then dofile(f) end
|
||||
end
|
||||
|
||||
@@ -20,7 +20,8 @@ function second_chance()
|
||||
print("seconde chance...")
|
||||
f= "repair.lua" if file.exists(f) then dofile(f) end
|
||||
initalarme=tmr.create()
|
||||
tmr.alarm(initalarme, 8*1000, tmr.ALARM_SINGLE, function()
|
||||
-- tmr.alarm(initalarme, 4*1000, tmr.ALARM_SINGLE, function()
|
||||
initalarme:alarm(4*1000, tmr.ALARM_SINGLE, function()
|
||||
f= "boot.lua" if file.exists(f) then dofile(f) end
|
||||
end)
|
||||
end
|
||||
@@ -32,6 +33,11 @@ if reset_reason == 0 then
|
||||
second_chance()
|
||||
elseif reset_reason == 4 then
|
||||
print("node.restart")
|
||||
gpio.trig(zswitch)
|
||||
hvbouton=nil
|
||||
second_chance=nil
|
||||
zswitch=nil
|
||||
reset_reason=nil
|
||||
f= "boot.lua" if file.exists(f) then dofile(f) end
|
||||
elseif reset_reason == 5 then
|
||||
print("dsleep wake up")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- Scripts pour jouer un fichier son sur un HP
|
||||
|
||||
print("\n play_file.lua zf190721.1238 \n")
|
||||
print("\n play_file.lua zf190721.1600 \n")
|
||||
|
||||
|
||||
-- ****************************************************************************
|
||||
@@ -17,6 +17,8 @@ function cb_drained(d)
|
||||
file.seek("set", 0)
|
||||
-- uncomment the following line for continuous playback
|
||||
--d:play(pcm.RATE_8K)
|
||||
d:play(pcm.RATE_16K)
|
||||
|
||||
end
|
||||
|
||||
function cb_stopped(d)
|
||||
@@ -28,7 +30,7 @@ function cb_paused(d)
|
||||
print("playback paused")
|
||||
end
|
||||
|
||||
file.open("cigale_10s_16k.wav", "r")
|
||||
file.open("cigale_1mn_16k.wav", "r")
|
||||
|
||||
drv = pcm.new(pcm.SD, 5)
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 289 KiB After Width: | Height: | Size: 289 KiB |
@@ -3,14 +3,14 @@
|
||||
-- le script repair.lua pendant xx secondes avant de continuer
|
||||
--Source: https://nodemcu.readthedocs.io/en/master/en/modules/node/#nodebootreason
|
||||
|
||||
print("\n init.lua zf190601.1620 \n")
|
||||
print("\n init.lua zf190601.1612 \n")
|
||||
|
||||
zswitch=3 --switch flash
|
||||
gpio.mode(zswitch, gpio.INT, gpio.PULLUP)
|
||||
|
||||
function hvbouton()
|
||||
-- gpio.trig(zswitch, "none")
|
||||
tmr.unregister(initalarme)
|
||||
initalarme:unregister()
|
||||
f= "boot.lua" if file.exists(f) then dofile(f) end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
-- le script repair.lua pendant xx secondes avant de continuer
|
||||
--Source: https://nodemcu.readthedocs.io/en/master/en/modules/node/#nodebootreason
|
||||
|
||||
print("\n init.lua zf190601.1620 \n")
|
||||
print("\n init.lua zf190601.1612 \n")
|
||||
|
||||
zswitch=3 --switch flash
|
||||
gpio.mode(zswitch, gpio.INT, gpio.PULLUP)
|
||||
|
||||
function hvbouton()
|
||||
-- gpio.trig(zswitch, "none")
|
||||
tmr.unregister(initalarme)
|
||||
initalarme:unregister()
|
||||
f= "boot.lua" if file.exists(f) then dofile(f) end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
-- le script repair.lua pendant xx secondes avant de continuer
|
||||
--Source: https://nodemcu.readthedocs.io/en/master/en/modules/node/#nodebootreason
|
||||
|
||||
print("\n init.lua zf190601.1620 \n")
|
||||
print("\n init.lua zf190601.1612 \n")
|
||||
|
||||
zswitch=3 --switch flash
|
||||
gpio.mode(zswitch, gpio.INT, gpio.PULLUP)
|
||||
|
||||
function hvbouton()
|
||||
-- gpio.trig(zswitch, "none")
|
||||
tmr.unregister(initalarme)
|
||||
initalarme:unregister()
|
||||
f= "boot.lua" if file.exists(f) then dofile(f) end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
-- le script repair.lua pendant xx secondes avant de continuer
|
||||
--Source: https://nodemcu.readthedocs.io/en/master/en/modules/node/#nodebootreason
|
||||
|
||||
print("\n init.lua zf190310.1549 \n")
|
||||
print("\n init.lua zf190601.1612 \n")
|
||||
|
||||
zswitch=3 --switch flash
|
||||
gpio.mode(zswitch, gpio.INT, gpio.PULLUP)
|
||||
|
||||
function hvbouton()
|
||||
-- gpio.trig(zswitch, "none")
|
||||
tmr.unregister(initalarme)
|
||||
initalarme:unregister()
|
||||
f= "boot.lua" if file.exists(f) then dofile(f) end
|
||||
end
|
||||
|
||||
@@ -20,7 +20,8 @@ function second_chance()
|
||||
print("seconde chance...")
|
||||
f= "repair.lua" if file.exists(f) then dofile(f) end
|
||||
initalarme=tmr.create()
|
||||
tmr.alarm(initalarme, 4*1000, tmr.ALARM_SINGLE, function()
|
||||
-- tmr.alarm(initalarme, 4*1000, tmr.ALARM_SINGLE, function()
|
||||
initalarme:alarm(4*1000, tmr.ALARM_SINGLE, function()
|
||||
f= "boot.lua" if file.exists(f) then dofile(f) end
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user