Skip to content

Commit

Permalink
snekde: Send ^C before eeprom.write or eeprom.show commands
Browse files Browse the repository at this point in the history
This interrupts any running code to get or put snek code

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Mar 27, 2019
1 parent 8c253ba commit 9fe343f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions snekde/snekde.py
Expand Up @@ -243,7 +243,7 @@ def writer(self):
if interrupt:
self.serial.reset_output_buffer()
self.serial.xonxoff = False
self.serial.write(b'\x03')
self.serial.write(b'\x0f\x03\x0e')
self.serial.xonxoff = True
if send_data:
self.serial.write(send_data.encode('utf-8'))
Expand All @@ -263,8 +263,8 @@ def write(self, data):
self.write_queue = data
self.interface.cv.notify()

def command(self, data):
self.write("\x0e" + data)
def command(self, data, intr='\x03'):
self.write("\x0e" + intr + data)

class EditWin:
"""Editable text object"""
Expand Down Expand Up @@ -941,7 +941,7 @@ def snekde_put_text():
return
snek_device.command("eeprom.write()\n")
snek_device.write(snek_edit_win.text + '\x04')
snek_device.command("reset()\n")
snek_device.command("reset()\n", intr='')
snek_edit_win.changed = False

def snekde_load_file():
Expand Down Expand Up @@ -1016,7 +1016,7 @@ def run():
data = data[1:]
else:
break
snek_device.command(data)
snek_device.command(data,intr='')
prev_exit = False


Expand Down

0 comments on commit 9fe343f

Please sign in to comment.