Skip to content

Commit

Permalink
apio upload: Fixed a bug when uploading with fomu
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Mar 19, 2024
1 parent 0d93171 commit 45e4365
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@
//-- Testing the TinyFPGA board
"cwd": "${workspaceFolder}/test-examples/TinyFPGA-BX/01-LED-ON"
},
{
"name": "Upload (Fomu)",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"args": ["upload"],
"console": "internalConsole",
"justMyCode": true,
//-- Change to the folder with the example to test
//-- Testing the TinyFPGA board
"cwd": "${workspaceFolder}/test-examples/fomu/temp-Blinky"
},
{
"name": "Upload (Blackice)",
"type": "debugpy",
Expand Down
15 changes: 15 additions & 0 deletions apio/managers/scons.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,9 +991,21 @@ def _execute_scons(self, command: str, variables: list, board: str) -> int:

@staticmethod
def _on_stdout(line):

# ---- Fomu output processing BEGIN
#pattern_fomu = r"^Download\s*\[=*\]\s\d{1,3}%"
pattern_fomu = r"^Download\s*\[=*"
match = re.search(pattern_fomu, line)
if match:
# -- Delete the previous line
print(CURSOR_UP + ERASE_LINE, end="")
# ---- Fomu output processing END

fgcol = "green" if "is up to date" in line else None
fgcol = "green" if match else fgcol
click.secho(line, fg=fgcol)


@staticmethod
def _on_stderr(line: str):
"""Callback function. It is called when the running command
Expand Down Expand Up @@ -1042,6 +1054,9 @@ def _on_stderr(line: str):
# -- Delete the previous line
print(CURSOR_UP + ERASE_LINE, end="")
# ------- Iceprog output processing END




# -- Print the line (In YELLOW)
# -- In case of error print it in RED
Expand Down

0 comments on commit 45e4365

Please sign in to comment.