Skip to content

Commit

Permalink
Merge pull request #35 from brainelectronics/bugfix/prepare-ned-reduc…
Browse files Browse the repository at this point in the history
…ed-memory-usage

Prepare ned reduced memory usage PR
  • Loading branch information
brainelectronics authored Jun 16, 2023
2 parents d911e69 + 185310e commit f38cb22
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,17 @@ upip.install('micropython-esp-wifi-manager')
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.
following line to the `boot.py` file of your device. *The following commands
are not working if this package got installed by `upip`*

```python
from wifi_manager import boot
import wifi_manager.boot
```

And also add this line to your `main.py`, before your application code

```python
from wifi_manager import main
import wifi_manager.main
```

#### Specific version
Expand Down
11 changes: 10 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
<!-- ## [Unreleased] -->

## Released
## [1.12.1] - 2023-06-16
### Added
- `pkg_resources` to `setup.py` and `package.json` as version 0.2.1 to prepare #33

### Fixed
- Instructions for using this package `boot.py` and `main.py` files in README
- `microdot` added to the simulation requirements

## [1.12.0] - 2023-06-12
### Added
- Instructions for using this package `boot.py` and `main.py` files
Expand Down Expand Up @@ -272,8 +280,9 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
- `sendfile` function implemented in same way as on Micropythons PicoWeb

<!-- Links -->
[Unreleased]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager/compare/1.12.0...develop
[Unreleased]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager/compare/1.12.1...develop

[1.12.1]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.12.1
[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
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
"utemplate/source.py",
"github:brainelectronics/Micropython-ESP-WiFi-Manager/utemplate/source.py"
],
[
"pkg_resources/pkg_resources.py",
"github:brainelectronics/Micropython-ESP-WiFi-Manager/pkg_resources/pkg_resources.py"
],
[
"static/css/bootstrap.min.css",
"github:brainelectronics/Micropython-ESP-WiFi-Manager/static/css/bootstrap.min.css"
Expand Down Expand Up @@ -82,7 +86,8 @@
]
],
"deps": [
["github:brainelectronics/micropython-modules", "develop"]
["github:brainelectronics/micropython-modules", "develop"],
["pkg_resources", "0.2.1"]
],
"version": "1.11.0"
}
28 changes: 28 additions & 0 deletions pkg_resources/pkg_resources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import uio

c = {}


def resource_stream(package, resource):
if package not in c:
try:
if package:
p = __import__(package + ".R", None, None, True)
else:
p = __import__("R")
c[package] = p.R
except ImportError:
if package:
p = __import__(package)
d = p.__path__
else:
d = "."
# if d[0] != "/":
# import uos
# d = uos.getcwd() + "/" + d
c[package] = d + "/"

p = c[package]
if isinstance(p, dict):
return uio.BytesIO(p[resource])
return open(p + resource, "rb")
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'wifi_manager',
'microdot',
'utemplate',
'pkg_resources',
],
# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages. See:
Expand Down
1 change: 1 addition & 0 deletions simulation/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ jinja2>=3.0.2,<4
PyYAML>=5.4.1,<6
netifaces>=0.11.0,<1
pycrypto>=2.6.1,<3
microdot>=1.2.4,<2

0 comments on commit f38cb22

Please sign in to comment.