Skip to content

Conversation

@haydenroche5
Copy link
Collaborator

@haydenroche5 haydenroche5 commented Aug 1, 2023

  • Rename all examples so that they have underscores instead of hyphens. .py files with hyphens in their names can't be imported.
  • Add a test/hitl/ directory with one test (so far): cpy_test.py. This test makes sure that cpy_example.py runs successfully on a CircuitPython host connected to a Notecard. I tested using a Notecarrier F and a Swan.
  • cpy_test.py relies on pyboard.py from MicroPython. I have added that file from MicroPython's master branch here.

Mat's Notes:

  • I piggy-backed this PR rather than add a separate one.
  • Added HIL workflows for MicroPython and CircuitPython (pretty heavy lift.)
  • Added pre-commit hook to catch all the petty things.
  • We can add a pre-commit hook to check if pyboard.py has changed from the latest version on github. (I have not done this, left as an exercise for the reader ;-P)

@haydenroche5 haydenroche5 requested a review from m-mcgowan August 1, 2023 23:10
@haydenroche5 haydenroche5 self-assigned this Aug 1, 2023
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how we want to support this dependency. Single file submodule? It really is a great tool, and it works well with both MicroPython and CircuitPython.

@haydenroche5 haydenroche5 force-pushed the hitl branch 3 times, most recently from 25373cc to 9c106bb Compare August 8, 2023 23:39
@m-mcgowan m-mcgowan self-assigned this Aug 10, 2023
@m-mcgowan
Copy link
Contributor

Copy link
Collaborator Author

@haydenroche5 haydenroche5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff @m-mcgowan!

exit 1
fi

exit 0 No newline at end of file
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline at end of file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added pre-commit checks to catch this.

- name: Make CircuitPython filesystem writeable to pyboard
if: ${{ matrix.lock_cpy_filesystem }}
run: |
timeout $USB_MSD_ATTACH_TIME bash test/scripts/wait_for_file.sh "$CPY_FS_CIRCUITPY"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this redundant since we already waited for the file to exist at line 104?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous step may not have run since it's conditional. But I want the check in the previous step to keep the check close to the behavior that affects it.

# only copy if it's changed or not present. After the device has reset, no further changes can be made
# until the filesystem is erased. This allows the workflow to be rerun flash_device=false
diff test/hitl/boot.py "$CPY_FS_CIRCUITPY/boot.py" || test/hitl/boot.py "$CPY_FS_CIRCUITPY"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should test/hitl/boot.py "$CPY_FS_CIRCUITPY" be cp test/hitl/boot.py "$CPY_FS_CIRCUITPY"?

default: true

jobs:
huzzah32:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be called test instead, to mirror hil-circuitpython.yml?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I had the same thought when I renamed it. The matrix parameters show up in the job run so no need to name it specifically.

exit 1
fi

exit 0 No newline at end of file
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline at EOF.

UART=2

"""
The SCL pin of the I2C bus connected to Notecard
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems slightly misplaced.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it up when making a pep8 pass through.

```
b'Performing initial setup\r\nMicroPython v1.20.0 on 2023-04-26; ESP32 module with ESP32\r\nType "help()" for more information.\r\n>>> '

INTERNALERROR>     pyb.enter_raw_repl()
INTERNALERROR>   File "/home/mat/runners/notecard-nbgl-carr_f-huzzah32-serial/_work/note-python/note-python/test/hitl/deps/pyboard.py", line 367, in enter_raw_repl
INTERNALERROR>     raise PyboardError("could not enter raw repl")
INTERNALERROR> pyboard.PyboardError: could not enter raw repl
```
Copy link
Contributor

@m-mcgowan m-mcgowan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave it to you to approve the final review.

exit 1
fi

exit 0 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added pre-commit checks to catch this.

- name: Make CircuitPython filesystem writeable to pyboard
if: ${{ matrix.lock_cpy_filesystem }}
run: |
timeout $USB_MSD_ATTACH_TIME bash test/scripts/wait_for_file.sh "$CPY_FS_CIRCUITPY"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous step may not have run since it's conditional. But I want the check in the previous step to keep the check close to the behavior that affects it.

default: true

jobs:
huzzah32:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I had the same thought when I renamed it. The matrix parameters show up in the job run so no need to name it specifically.

UART=2

"""
The SCL pin of the I2C bus connected to Notecard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it up when making a pep8 pass through.

@m-mcgowan
Copy link
Contributor

@m-mcgowan
Copy link
Contributor

Since Hayden is also an author for this PR, he cannot approve a review. Merging with offline approval from him.

@m-mcgowan m-mcgowan merged commit b50f499 into blues:main Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants