Skip to content

Commit

Permalink
Merge branch '2.1.3-develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tocalvo committed Feb 8, 2017
2 parents 9f491c7 + 7dbe3bc commit 92f2f10
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions res/common/platformioWorkSpace/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ platform = atmelavr
framework = arduino
board = diecimilaatmega328

[env:mega]
platform = atmelavr
framework = arduino
board = megaatmega2560

[env:uno]
platform = atmelavr
framework = arduino
Expand Down
2 changes: 1 addition & 1 deletion res/common/web2board.version
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.1.2",
"version": "2.1.3",
"bitbloqLibs": {
"version": "0.1.2",
"librariesNames": [
Expand Down
16 changes: 11 additions & 5 deletions src/libs/CompilerUploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -134,14 +138,15 @@ 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:
return None
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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 92f2f10

Please sign in to comment.