Add a Microdot AP example and mpremote instructions for device tests.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# Device tests
|
||||
|
||||
These scripts run **on the board** with MicroPython, not on the host. Use [mpremote](https://docs.micropython.org/en/latest/reference/mpremote.html) from the repo root (`pipenv sync` first).
|
||||
|
||||
Replace `PORT` with your serial device, e.g. `/dev/ttyACM0` or `/dev/ttyUSB0`. List ports with `ls /dev/ttyACM* /dev/ttyUSB*` or `pipenv run mpremote connect list`.
|
||||
|
||||
## Stop the main app first
|
||||
|
||||
If `src/main.py` is already on the board it starts on boot and will fight the tests (Wi‑Fi, I2C, LEDs). Interrupt it, then run the test:
|
||||
|
||||
```
|
||||
pipenv run mpremote connect PORT
|
||||
```
|
||||
|
||||
In the REPL press `Ctrl-C` until you get `>>>`. Leave that session, or use a second command as below.
|
||||
|
||||
## Copy libraries (needed for Microdot / LSM6DS3)
|
||||
|
||||
`mpremote run` only uploads the one test file. Anything it `import`s must already live on the board.
|
||||
|
||||
```
|
||||
pipenv run mpremote connect PORT fs cp -r lib :
|
||||
```
|
||||
|
||||
Same as `pipenv run ./dev.py PORT lib`.
|
||||
|
||||
## Run a test
|
||||
|
||||
From the **repo root**:
|
||||
|
||||
```
|
||||
pipenv run mpremote connect PORT run test/leds.py
|
||||
pipenv run mpremote connect PORT run test/lsm6ds3_test.py
|
||||
pipenv run mpremote connect PORT run test/ap_microdot.py
|
||||
```
|
||||
|
||||
`run` copies the file to the device, executes it, and streams stdout. `Ctrl-C` stops it.
|
||||
|
||||
## Access-point + Microdot (`ap_microdot.py`)
|
||||
|
||||
Starts a soft-AP (`led-test`, open by default) and a small HTTP app.
|
||||
|
||||
1. Upload `lib` (so `microdot` imports).
|
||||
2. `pipenv run mpremote connect PORT run test/ap_microdot.py`
|
||||
3. Join the `led-test` Wi‑Fi network from a phone or laptop.
|
||||
4. Open `http://192.168.4.1/` (plain text hello) or `http://192.168.4.1/ping` (JSON).
|
||||
|
||||
SSID/password are at the top of `ap_microdot.py`. Default AP address on ESP32 is `192.168.4.1`.
|
||||
|
||||
## Other useful mpremote commands
|
||||
|
||||
```
|
||||
pipenv run mpremote connect PORT # REPL
|
||||
pipenv run mpremote connect PORT fs ls : # list board files
|
||||
pipenv run mpremote connect PORT fs cp test/leds.py : # copy a file onto the board
|
||||
pipenv run mpremote connect PORT exec "import leds" # run a file already on the board
|
||||
```
|
||||
|
||||
If the port is already in use (another `mpremote`, serial monitor, or `dev.py follow`), disconnect that first.
|
||||
Reference in New Issue
Block a user