Skip to content

Commit

Permalink
여러개의 ESP32 칩을 병렬적으로 업데이트 가능하도록 코드 수정 (#23)
Browse files Browse the repository at this point in the history
* Fix README.md badge

* Fix: error of window closing when exception occur (#7)

* Fix ESP delimeter error: add time sleep(0.1)

* Add exception catch hook & Remove comments

* Fix progress bar percent decimals

* Fix version info rstrip

* Add popup window when exception occurred

* Remove print json used for debugging

* Change name of exception hook method & Add icon and error text to popup

* Add detailed text about exception traceback & Resize of window

* Add exit and report button to popup & Rename class and method of popup

* Add popup error message for exceptions in thread

* Change names of methods to show meanings of roles

* Fix convention of long line

* Add popup message for reconnection error & set level of error

* Add popup message of reconnection error

* Change line continuation annotation \ -> ()

* Refactor statement using if else to switch with dict

* Refactor hard coded numbers to constant variables

* Refactor import _thread to _thread._ExceptHookArgs as _th._exc

* Refactor to meet convention tests

* Remove report error button and restart button

* Remove whitespace and comment unused lines to meet the conventions

* Remove blank line to meet the conventions

* Fix _thread._ExceptHookArgs issue

* Remove unused import

* Send packet to turn interpreter off

* Notify user when turning interpreter off

* Remove unused lines

* Temporally comment out restart button

* Update PRT

* Translate issue_templates to Korean

* Change path to STM32 firmwares

* Remove redundant lines in ESP32 Updater

* Use excepthook again to show popup

* Remove unused import in gui_firmware_updater

* Add black code checker and put it in the actions workflow

* Add black check and apply it to the code (#17)

* Add configurations for black and flake8

* Apply formatter black

* Fix flake8 configuration of git actions

* Apply black formatting

* Remove black formatting

* Add isort check and apply it to the code (#16)

Co-authored-by: Jemin Yeon <[email protected]>

* Implement an inferface for modi_firmware_updater (#19)

* Implement an inferface for modi_firmware_updater

* Refactor according to flake8

* Remove black check

Co-authored-by: Jemin Yeon <[email protected]>

* Remove black from requirements.txt and following configurations

* Add a line to handle bootloaded MODI network module

* Implement list_ports check

* Change text for warning

* Push internal work

* Escape ports loop once connected

* Refactor code according to flake8 convention

Co-authored-by: Jemin Yeon <[email protected]>
Co-authored-by: Jemin Yeon <[email protected]>
  • Loading branch information
3 people authored Jul 1, 2021
1 parent be77642 commit 0857b5b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
4 changes: 3 additions & 1 deletion modi_firmware_updater/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def check_option(*options):
# All commands should be defined here in advance
opts, args = getopt(
sys.argv[1:], 'nbm',
['update_network', 'update_network_base', 'update_modules']
[
'update_network', 'update_network_base', 'update_modules',
]
)
# Exit program if an invalid option has been entered
except GetoptError as err:
Expand Down
13 changes: 11 additions & 2 deletions modi_firmware_updater/core/esp32_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,17 @@ def __init__(self):
modi_ports = list_modi_ports()
if not modi_ports:
raise serial.SerialException("No MODI port is connected")
super().__init__(modi_ports[0].device, timeout=0.1, baudrate=921600)
print(f"Connecting to MODI network module at {modi_ports[0].device}")
for modi_port in modi_ports:
try:
super().__init__(
modi_port.device, timeout=0.1, baudrate=921600
)
except Exception:
print('Next network module')
continue
else:
break
print(f"Connecting to MODI network module at {modi_port.device}")

self.__address = [0x1000, 0x8000, 0xD000, 0x10000, 0xD0000]
self.file_path = [
Expand Down
6 changes: 3 additions & 3 deletions modi_firmware_updater/gui_firmware_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def write(self, s, color="black"):
@staticmethod
def __is_redundant_line(line):
return (
line.startswith("\rUpdating")
or line.startswith("\rFirmware Upload: [")
or len(line) < 3
line.startswith("\rUpdating") or
line.startswith("\rFirmware Upload: [") or
len(line) < 3
)


Expand Down
5 changes: 3 additions & 2 deletions modi_firmware_updater/util/connection_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ def __is_modi_port(port):
or (port.vid == 0x2FDE and port.pid == 0x2)
or (port.vid == 0x483 and port.pid == 0x5740)
)

return [port for port in stl.comports() if __is_modi_port(port)]
modi_ports = [port for port in stl.comports() if __is_modi_port(port)]
print(f'{len(modi_ports)} number of network module(s) exist(s)')
return modi_ports


def is_on_pi() -> bool:
Expand Down

0 comments on commit 0857b5b

Please sign in to comment.