Skip to content

Commit

Permalink
Merge 826b71a into 538f7d0
Browse files Browse the repository at this point in the history
  • Loading branch information
brainelectronics authored Jun 12, 2023
2 parents 538f7d0 + 826b71a commit 4e04f63
Show file tree
Hide file tree
Showing 11 changed files with 292 additions and 190 deletions.
2 changes: 0 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ exclude =
.idea
.bak
# custom scripts, not being part of the distribution
libs_external
sdist_upip.py
setup.py
nextion/ulogging.py

# Provide a comma-separated list of glob patterns to add to the list of excluded ones.
# extend-exclude =
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ jobs:
- name: Test build package
run: |
twine check dist/*
# - name: Validate mip package file
# run: |
# upy-package \
# --setup_file setup.py \
# --package_changelog_file changelog.md \
# --package_file package.json \
# --validate
- name: Validate mip package file
run: |
upy-package \
--setup_file setup.py \
--package_changelog_file changelog.md \
--package_file package.json \
--validate \
--ignore-version
48 changes: 28 additions & 20 deletions QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,46 @@ esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART erase_flash
esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART --baud 921600 write_flash -z 0x1000 esp32spiram-20220117-v1.18.bin
```

### Install package on board with pip
### Install package

```bash
rshell -p /dev/tty.SLAB_USBtoUART --editor nano
Connect the MicroPython device to a network (if possible)

```python
import network
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect('SSID', 'PASSWORD')
station.isconnected()
```

Inside the rshell
Install the latest package version of this lib on the MicroPython device

```bash
cp examples/progressbar/main.py /pyboard
cp examples/boot.py /pyboard
repl
```python
import mip
mip.install("github:brainelectronics/micropython-nextion")
```

Inside the REPL
For MicroPython versions below 1.19.1 use the `upip` package instead of `mip`

```python
import machine
import network
import time
import upip
upip.install('micropython-nextion')
```

station = network.WLAN(network.STA_IF)
station.active(True)
station.connect('SSID', 'PASSWORD')
time.sleep(1)
print('Device connected to network: {}'.format(station.isconnected()))
### Copy example file

upip.install('micropython-nextion')
Copy one of the provided example `main.py` files to the MicroPython device.

print('Installation completed')
machine.soft_reset()
```bash
rshell --port /dev/tty.SLAB_USBtoUART --editor nano
```

Perform the following command inside the `rshell` to copy the Progressbar example to the MicroPython device.

```bash
cp examples/progressbar/main.py /pyboard
cp examples/boot.py /pyboard
repl
```

<!-- Links -->
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pip install -r requirements.txt

## Setup

### Install package with upip
### Install package

Connect the MicroPython device to a network (if possible)

Expand Down
18 changes: 17 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
-->

## Released
## [0.16.0] - 2023-06-12
### Added
- Validate `package.json` file with every test workflow run but without version validation
- Basic setup instructions added to docs examples file

### Changed
- Update `nextion/ulogging.py` to [version 0.5 of micropython-lib](https://github.com/micropython/micropython-lib/blob/7128d423c2e7c0309ac17a1e6ba873b909b24fcc/python-stdlib/logging/logging.py)

### Removed
- Outdated and unused `libs_external` folder with `ulogging.py`
- `libs_external` and `nextion/ulogging.py` removed from `.flake8` exclude list

### Fixed
- Installation instructions in Quickstart document are using `mip`

## [0.15.3] - 2023-05-17
### Fixed
- Publish releases to PyPi again as `micropython-nextion`, see #35
Expand Down Expand Up @@ -229,8 +244,9 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
- [Example HMI file](examples/everything.HMI) to be used for all examples

<!-- Links -->
[Unreleased]: https://github.com/brainelectronics/micropython-nextion/compare/0.15.3...develop
[Unreleased]: https://github.com/brainelectronics/micropython-nextion/compare/0.16.0...develop

[0.16.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.16.0
[0.15.3]: https://github.com/brainelectronics/micropython-nextion/tree/0.15.3
[0.15.2]: https://github.com/brainelectronics/micropython-nextion/tree/0.15.2
[0.15.1]: https://github.com/brainelectronics/micropython-nextion/tree/0.15.1
Expand Down
20 changes: 20 additions & 0 deletions docs/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ Usage examples of this `micropython-nextion` library
An example of all implemented functionalities can be found at the
[MicroPython Nextion examples folder][ref-micropython-nextion-examples]

## Setup Nextion

```python
from nextion import NexHardware

# define communication pins for Nextion display
tx_pin = 21
rx_pin = 22

# create Nextion hardware interface
nh = NexHardware(rx_pin=rx_pin, tx_pin=tx_pin)

# init nextion communication interface
nh.nexInit()

# modify text field "t0" showing "newtxt" by default
cmd = 't0.txt="asdf"'
nh.sendCommand(cmd)
```

## Special hints

### Access object on a non active page
Expand Down
13 changes: 0 additions & 13 deletions examples/boot_wifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"""

# system packages
import esp
import gc
import machine
import network
Expand All @@ -20,15 +19,6 @@
# import machine
# machine.freq(240000000)

# disable ESP os debug output
esp.osdebug(None)

# set pin D4 as output (blue LED)
led_pin = machine.Pin(4, machine.Pin.OUT)

# turn onboard LED on
led_pin.value(1)

station = network.WLAN(network.STA_IF)
if station.active() and station.isconnected():
station.disconnect()
Expand Down Expand Up @@ -75,9 +65,6 @@

print('Created Accesspoint: {}'.format(accesspoint_name))

# turn onboard LED off
led_pin.value(0)

print('Restart cause: {}'.format(machine.reset_cause()))

# run garbage collector at the end to clean up
Expand Down
94 changes: 0 additions & 94 deletions libs_external/ulogging.py

This file was deleted.

Loading

0 comments on commit 4e04f63

Please sign in to comment.