KeyboardInterrupt after wake by timer or accel interrupt
Gpy on Pytrack and acceleromter_wake example.
KeyboardInterrupt after wake by timer or accel interrupt.
rst:0x7 (TG0WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff8028,len:8 load:0x3fff8030,len:1728 load:0x4009fa00,len:0 load:0x4009fa00,len:14584 entry 0x400a059c Previous board is not available anymore > Failed to connect (Error: Port is not open). Click here to try again. Connecting to /dev/tty.usbmodemPy9254bb1... Traceback (most recent call last): File "main.py", line 9, in <module> File "pytrack.py", line 8, in __init__ File "pycoproc.py", line 75, in __init__ KeyboardInterrupt: Pycom MicroPython 1.18.1.r1 [cf6ef4f-dirty] on 2019-01-04; GPy with ESP32 Type "help()" for more information. >>>
robert-hh last edited by
@shaunix It still may be an interaction between the PC and its driver stack and the xxPy device. Can you try to catch the KeyboardException in a try/except clause, signal the fact by the LED and then run the device with a pure simple power supply, like a smart phone charger?
I guess I should make it clear that the keyboardinterrupt is not intentional. No keys were pressed. This happens automatically every time it wakes.
from pytrack import Pytrack #from pysense import Pysense from LIS2HH12 import LIS2HH12 import pycom import time pycom.heartbeat(False) py = Pytrack() # py = Pysense() # display the reset reason code and the sleep remaining in seconds # possible values of wakeup reason are: # WAKE_REASON_ACCELEROMETER = 1 # WAKE_REASON_PUSH_BUTTON = 2 # WAKE_REASON_TIMER = 4 # WAKE_REASON_INT_PIN = 8 print("Wakeup reason: " + str(py.get_wake_reason()) + "; Aproximate sleep remaining: " + str(py.get_sleep_remaining()) + " sec") time.sleep(0.5) # enable wakeup source from INT pin py.setup_int_pin_wake_up(False) # enable activity and also inactivity interrupts, using the default callback handler py.setup_int_wake_up(True, True) acc = LIS2HH12() # enable the activity/inactivity interrupts # set the accelereation threshold to 2000mG (2G) and the min duration to 200ms acc.enable_activity_interrupt(750, 200) # check if we were awaken due to activity if acc.activity(): pycom.rgbled(0xFF0000) else: pycom.rgbled(0x00FF00) # timer wake-up time.sleep(0.1) # go to sleep for 1 minute maximum if no accelerometer interrupt happens py.setup_sleep(60) py.go_to_sleep()