Skip to content

Commit

Permalink
Ready for release v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicanor Romero Venier committed Feb 3, 2016
1 parent 867517b commit 66db502
Show file tree
Hide file tree
Showing 4 changed files with 14,394 additions and 38 deletions.
13 changes: 9 additions & 4 deletions bq_firmware_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ def _init_loggers(self):

console_handler = logging.StreamHandler()
console_handler.setFormatter(logging_formatter)
console_handler.setLevel(logging.DEBUG)
console_handler.setLevel(logging.ERROR)
self.logger.addHandler(console_handler)

self.logger.setLevel(logging.DEBUG)
self.logger.setLevel(logging.ERROR)
rot_handler = logging.handlers.RotatingFileHandler("bq_firmware_updater.log", maxBytes=10*1024*1024, backupCount=10)
rot_handler.setFormatter(logging_formatter)
rot_handler.setLevel(logging.DEBUG)
rot_handler.setLevel(logging.ERROR)
self.logger.addHandler(rot_handler)

def start_gui(self):
Expand Down Expand Up @@ -543,13 +543,16 @@ def _flash_firmware(self, e=None):
def _flash_worker(self):
if platform.system() == "Windows":
avrdude_filename = "avrdude.exe"
avrdude_conf_filename = "avrdude_windows.conf"
elif platform.system() == "Linux":
avrdude_filename = "avrdude"
avrdude_conf_filename = "avrdude_linux.conf"

avrdude_path = os.path.join(self._get_resources_path(), "utils", avrdude_filename)
avrdude_conf_path = os.path.join(self._get_resources_path(), "utils", avrdude_conf_filename)
working_dir = os.path.dirname(os.path.abspath(avrdude_path))
hex_path = os.path.abspath(self.temp_hex_file_path)
avrdude_command = [avrdude_path, "-v", "-p", "m2560", "-c", "wiring", "-P", self.printer_serial_port, "-U", "flash:w:" + hex_path + ":i", "-D"]
avrdude_command = [avrdude_path, "-v", "-p", "m2560", "-c", "wiring", "-P", self.printer_serial_port, "-C", avrdude_conf_path, "-U", "flash:w:" + hex_path + ":i", "-D"]

self.logger.debug("Running %r in %s" % (' '.join(avrdude_command), working_dir))

Expand All @@ -561,6 +564,8 @@ def _flash_worker(self):
import subprocess
p = subprocess.Popen(' '.join(avrdude_command), shell=True)

time.sleep(5) # To make sure the command has been executed

while p.poll() is None:
if time.time() - init_time > flash_timeout:
e_msg = "Timeout"
Expand Down
69 changes: 35 additions & 34 deletions bq_firmware_updater.spec
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
# -*- mode: python -*-

block_cipher = None

files_to_add = [('./images/*', 'images/'),
('./utils/avrdude', 'utils/'),
('./utils/avrdude.exe', 'utils/'),
('./utils/avrdude.conf', 'utils/'),
('./utils/libusb0.dll', 'utils/')]

a = Analysis(['bq_firmware_updater.py'],
pathex=['C:\\Users\\startic1\\Documents\\bqFirmwareUpdater'],
binaries=None,
datas=files_to_add,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='BQ Firmware Updater',
debug=False,
strip=False,
upx=True,
console=False,
icon="images\\32.ico")
# -*- mode: python -*-

block_cipher = None

files_to_add = [('./images/*', 'images/'),
('./utils/avrdude', 'utils/'),
('./utils/avrdude.exe', 'utils/'),
('./utils/avrdude_linux.conf', 'utils/'),
('./utils/avrdude_windows.conf', 'utils/'),
('./utils/libusb0.dll', 'utils/')]

a = Analysis(['bq_firmware_updater.py'],
pathex=['C:\\Users\\startic1\\Documents\\bqFirmwareUpdater'],
binaries=None,
datas=files_to_add,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='BQ Firmware Updater',
debug=False,
strip=False,
upx=True,
console=False,
icon="images\\32.ico")
Loading

0 comments on commit 66db502

Please sign in to comment.