diff --git a/requirements.txt b/requirements.txt index ea91cf0..ad5293a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ glob2 pyserial flexmock pyinstaller==3.0.0; sys_platform != 'darwin' -pyinstaller==3.1.1; sys_platform == 'darwin' +pyinstaller==3.2.1; sys_platform == 'darwin' setuptools==19.2; sys_platform != 'darwin' setuptools==20.1.1; sys_platform == 'darwin' lockfile diff --git a/res/common/platformioWorkSpace/platformio.ini b/res/common/platformioWorkSpace/platformio.ini index 28d245e..b39a362 100644 --- a/res/common/platformioWorkSpace/platformio.ini +++ b/res/common/platformioWorkSpace/platformio.ini @@ -6,6 +6,11 @@ platform = atmelavr framework = arduino board = diecimilaatmega328 +[env:mega] +platform = atmelavr +framework = arduino +board = megaatmega2560 + [env:uno] platform = atmelavr framework = arduino diff --git a/res/common/web2board.version b/res/common/web2board.version index 3be7aed..7229ba7 100644 --- a/res/common/web2board.version +++ b/res/common/web2board.version @@ -1,5 +1,5 @@ { - "version": "2.1.2", + "version": "2.1.3", "bitbloqLibs": { "version": "0.1.2", "librariesNames": [ diff --git a/src/libs/CompilerUploader.py b/src/libs/CompilerUploader.py index 473220e..c1c4c28 100755 --- a/src/libs/CompilerUploader.py +++ b/src/libs/CompilerUploader.py @@ -5,6 +5,10 @@ import os import subprocess from datetime import timedelta, datetime +from UserList import UserList as _UserList +from UserString import UserString as _UserString +import UserList +import UserString from libs import utils from libs.Decorators.Asynchronous import asynchronous @@ -36,7 +40,7 @@ def __init__(self, error, *args): # class CompilerUploader: __global_compiler_uploader_holder = {} - DEFAULT_BOARD = "bt328" + DEFAULT_BOARD = "mega" def __init__(self, board=DEFAULT_BOARD): self.lastPortUsed = None @@ -100,10 +104,10 @@ def _call_avrdude(args): return output, err @asynchronous() - def _check_port(self, port, mcu, baud_rate): + def _check_port(self, port, mcu, baud_rate, protocol="arduino"): try: log.debug("Checking port: {}".format(port)) - args = "-P " + port + " -p " + mcu + " -b " + str(baud_rate) + " -c arduino" + args = "-P " + port + " -p " + mcu + " -b " + str(baud_rate) + " -c " + protocol output, err = self._call_avrdude(args) log.debug("{2}: {0}, {1}".format(output, err, port)) return 'Device signature =' in output or 'Device signature =' in err @@ -134,6 +138,7 @@ def _run(self, code, upload=False, upload_port=None, get_hex_string=False): def _search_board_port(self): mcu = self.build_options["boardData"]["build"]["mcu"] + protocol = self.build_options["boardData"]["upload"]["protocol"] baud_rate = self.build_options["boardData"]["upload"]["speed"] available_ports = self.get_available_ports() if len(available_ports) <= 0: @@ -141,7 +146,7 @@ def _search_board_port(self): log.info("Found available ports: {}".format(available_ports)) port_futures_dict = {} for port in available_ports: - port_futures_dict[port] = self._check_port(port, mcu, baud_rate) + port_futures_dict[port] = self._check_port(port, mcu, baud_rate, protocol) watchdog = datetime.now() while datetime.now() - watchdog < timedelta(seconds=30) and len(port_futures_dict) > 0: @@ -182,8 +187,9 @@ def upload(self, code, upload_port=None): def upload_avr_hex(self, hex_file_path, upload_port=None): port = upload_port if upload_port is not None else self.get_port() mcu = self.build_options["boardData"]["build"]["mcu"] + protocol = self.build_options["boardData"]["upload"]["protocol"] baud_rate = str(self.build_options["boardData"]["upload"]["speed"]) - args = "-V -P " + port + " -p " + mcu + " -b " + baud_rate + " -c arduino -D -U flash:w:" + hex_file_path + ":i" + args = "-V -P " + port + " -p " + mcu + " -b " + baud_rate + " -c " + protocol + " -D -U flash:w:" + hex_file_path + ":i" output, err = self._call_avrdude(args) ok_text = "bytes of flash written" result_ok = ok_text in output or ok_text in err