@@ -77,7 +77,7 @@ class Firmware(object): | |||||
if progress_callback is not None: | if progress_callback is not None: | ||||
progress_callback(Firmware.STAGE_UPLOADING) | progress_callback(Firmware.STAGE_UPLOADING) | ||||
time.sleep(0.05) | |||||
time.sleep(0.0) | |||||
def read_until(pattern, timeout=0.0): | def read_until(pattern, timeout=0.0): | ||||
""" | """ | ||||
@@ -134,10 +134,12 @@ class Firmware(object): | |||||
stage_callback(Firmware.STAGE_WAITING) | stage_callback(Firmware.STAGE_WAITING) | ||||
time.sleep(1) | time.sleep(1) | ||||
time.sleep(1) | |||||
# Reboot the device and wait for the boot loader. | # Reboot the device and wait for the boot loader. | ||||
stage_callback(Firmware.STAGE_BOOT) | stage_callback(Firmware.STAGE_BOOT) | ||||
dev.write("=") | dev.write("=") | ||||
read_until('!boot', timeout=15.0) | |||||
read_until('......', timeout=15.0) | |||||
# Get ourselves into the boot loader and wait for indication | # Get ourselves into the boot loader and wait for indication | ||||
# that it's ready for the firmware upload. | # that it's ready for the firmware upload. | ||||
@@ -75,14 +75,15 @@ def upload_usb(): | |||||
dev = pyad2usb.ad2usb.devices.USBDevice() | dev = pyad2usb.ad2usb.devices.USBDevice() | ||||
dev.open(no_reader_thread=True) | dev.open(no_reader_thread=True) | ||||
pyad2usb.ad2usb.util.Firmware.upload(dev, 'tmp/ademcoemu_V2_2a_6.hex', handle_firmware) | |||||
#pyad2usb.ad2usb.util.Firmware.upload(dev, 'tmp/ademcoemu_V2_2a_6.hex', handle_firmware) | |||||
dev.close() | dev.close() | ||||
def upload_serial(): | def upload_serial(): | ||||
dev = pyad2usb.ad2usb.devices.SerialDevice(interface='/dev/ttyUSB2') | |||||
dev = pyad2usb.ad2usb.devices.SerialDevice(interface='/dev/ttyUSB0') | |||||
dev.open() | |||||
dev.open(no_reader_thread=True) | |||||
pyad2usb.ad2usb.util.Firmware.upload(dev, 'tmp/ademcoemu_V2_2a_6.hex', handle_firmware) | pyad2usb.ad2usb.util.Firmware.upload(dev, 'tmp/ademcoemu_V2_2a_6.hex', handle_firmware) | ||||
#pyad2usb.ad2usb.util.Firmware.upload(dev, 'tmp/ademcoemu-V2-2a-5-beta20-C4.hex', handle_firmware) | |||||
dev.close() | dev.close() | ||||
def upload_usb_serial(): | def upload_usb_serial(): | ||||