From 7b267f9274b740dcdbf761dec7dc816ddc27f690 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Mon, 12 Jun 2023 08:13:22 +0200 Subject: [PATCH 1/4] add main and boot files to package.json --- package.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package.json b/package.json index 35ead1e..17f4f7d 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,14 @@ "wifi_manager/__init__.py", "github:brainelectronics/Micropython-ESP-WiFi-Manager/wifi_manager/__init__.py" ], + [ + "wifi_manager/boot.py", + "github:brainelectronics/Micropython-ESP-WiFi-Manager/boot.py" + ], + [ + "wifi_manager/main.py", + "github:brainelectronics/Micropython-ESP-WiFi-Manager/main.py" + ], [ "wifi_manager/version.py", "github:brainelectronics/Micropython-ESP-WiFi-Manager/wifi_manager/version.py" From 666d04e1698c75258c4e89423c13d44bc2fb41c3 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Mon, 12 Jun 2023 09:16:46 +0200 Subject: [PATCH 2/4] ignore boot and main files during package validation --- .github/workflows/test.yml | 3 ++- requirements-test.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6050564..2e95664 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,4 +58,5 @@ jobs: --package_file package.json \ --validate \ --ignore-version \ - --ignore-deps + --ignore-deps \ + --ignore-boot-main diff --git a/requirements-test.txt b/requirements-test.txt index 5e81484..6ac125e 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,5 +3,5 @@ flake8>=5.0.0,<6 coverage>=6.4.2,<7 nose2>=0.12.0,<1 -setup2upypackage>=0.3.0,<1 +setup2upypackage>=0.4.0,<1 -r simulation/requirements.txt From d4f275355ba8d63d7860a1c2feb97ba2feaa2505 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Mon, 12 Jun 2023 09:17:34 +0200 Subject: [PATCH 3/4] remove device specific dependencies from boot and main files --- boot.py | 24 ++++-------------------- main.py | 2 +- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/boot.py b/boot.py index cceee5c..2b0cba7 100644 --- a/boot.py +++ b/boot.py @@ -5,36 +5,20 @@ boot script, do initial stuff here, similar to the setup() function on Arduino """ -import esp import gc import network -import time +from time import sleep -# custom packages -from be_helpers.led_helper import Led - - -# set clock speed to 240MHz instead of default 160MHz -# machine.freq(240000000) - -# disable ESP os debug output -esp.osdebug(None) - -led = Led() -led.flash(amount=3, delay_ms=50) -led.turn_on() station = network.WLAN(network.STA_IF) if station.active() and station.isconnected(): station.disconnect() - time.sleep(1) + sleep(1) station.active(False) -time.sleep(1) +sleep(1) station.active(True) -led.turn_off() - # run garbage collector at the end to clean up gc.collect() -print('Finished booting') +print('Finished booting steps of MicroPython WiFiManager') diff --git a/main.py b/main.py index 83a19ae..e56c0e2 100644 --- a/main.py +++ b/main.py @@ -22,4 +22,4 @@ else: print('Successfully connected to a network :)') -print('Returning to REPL') +print('Finished booting steps of MicroPython WiFiManager') From fb6d02ec22fe41ef0248567e3d8ff4864e761d39 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Mon, 12 Jun 2023 09:19:25 +0200 Subject: [PATCH 4/4] add instructions to README to use mip installed boot and main files, see #32 and #33 --- README.md | 18 ++++++++++++++++++ changelog.md | 14 +++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00c720d..839f2bf 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ MicroPython WiFi Manager to configure and connect to networks - [Upload files to board](#upload-files-to-board) - [Install package](#install-package) - [General](#general) + - [Hook the WiFi Manager boot logic](#hook-the-wifi-manager-boot-logic) - [Specific version](#specific-version) - [Test version](#test-version) - [Manually](#manually) @@ -105,6 +106,23 @@ upip.install('micropython-esp-wifi-manager') # dependencies will be installed automatically ``` +#### Hook the WiFi Manager boot logic + +The `boot.py` and `main.py` files of this package are installed into `/lib` of +the MicroPython device by `mip`. They are fully functional and without any +other dependencies or MicroPython port specific commands. Simply add the +following line to the `boot.py` file of your device. + +```python +from wifi_manager import boot +``` + +And also add this line to your `main.py`, before your application code + +```python +from wifi_manager import main +``` + #### Specific version Install a specific, fixed package version of this lib on the MicroPython device diff --git a/changelog.md b/changelog.md index 1370167..cb233aa 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,17 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" ## Released +## [1.12.0] - 2023-06-12 +### Added +- Instructions for using this package `boot.py` and `main.py` files +- `boot.py` and `main.py` are part of `package.json` and are installed into `wifi_manager/`, see #32 and #33 + +### Changed +- Ignore boot and main files during `package.json` validation + +### Removed +- No device specific dependencies in `boot.py` to LED + ## [1.11.0] - 2023-05-27 ### Added - `package.json` file and installation instruction for `mip` usage, see #30 @@ -261,8 +272,9 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" - `sendfile` function implemented in same way as on Micropythons PicoWeb -[Unreleased]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager/compare/1.11.0...develop +[Unreleased]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager/compare/1.12.0...develop +[1.12.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.12.0 [1.11.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.11.0 [1.10.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.10.0 [1.9.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.9.0