mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-26 03:39:58 -07:00
Fix attaching debugger while paused
This commit is contained in:
36
scripts/enable_debug.py
Normal file
36
scripts/enable_debug.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import serial.tools.list_ports as list_ports
|
||||
import serial
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
flippers = list(list_ports.grep("flip_"))
|
||||
if len(flippers) != 1:
|
||||
return
|
||||
|
||||
port = serial.Serial()
|
||||
port.port = flippers[0].device
|
||||
port.timeout = 0.1
|
||||
port.write_timeout = 0.1
|
||||
port.baudrate = 115200 # Doesn't matter for VCP
|
||||
port.open()
|
||||
except Exception:
|
||||
return
|
||||
|
||||
try:
|
||||
port.write(
|
||||
b"sysctl debug 1\r"
|
||||
b"sysctl sleep_mode legacy\r"
|
||||
b"sysctl log_level debug\r"
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
try:
|
||||
port.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user