With old firmware, my NodeMCU device reset automatically if button (GPIO0) was hold for more then 8 sec. Therefore I counted 6 seconds (with sound feedback to user after each second), and after that switch AP mode on. Copy of code bellow.
With new firmware same NodeMCU resets after only 2 or 3 seconds. So I can not use this function any more.
Something changed in firmware between those two versions, regarding this issue?
Old firmware used: esp8266-20190125-v1.10
New firmware used: esp8266-20191220-v1.12
(I did erase flush while upgrading)
Code: Select all
def pinBTN_cb(p): a=machine.disable_irq() if p.value() == 0: t0 = time.ticks_ms()-1001 t1 = t0 b = 0 # loop waiting button release while p.value() == 0: t2 = time.ticks_ms() # sound tick every sec if (t2-t1)>=1000: print('tick: ' + str(int((t2-t0-1000)/1000)) + ' sec') sound(0) t1=t2 # sound tick after 6 sec if ((t2-t0)-1000>=6000 and b==0): sound(1) b=1 # after release, continue program, b = number of seconds while pressed d=int((t2-t0-1000)/1000) # short click (less then 1 sec) if d==0: # send some mqtt message # more then 6 sec if d>=6: print('STARTING AP') sound(1) do_AP_onoff(True) machine.enable_irq(a)