-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 532b716
Showing
41 changed files
with
9,082 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
env: | ||
MICROPYTHON_URL: "https://github.com/micropython/micropython/archive/refs/tags/v1.12.tar.gz" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pipenv' | ||
- name: Install pipenv | ||
run: pip install pipenv | ||
- name: Install dependencies | ||
run: pipenv sync --dev | ||
- name: Setup variables | ||
id: mpy-vars | ||
run: | | ||
URL_HASH=`echo -n "${MICROPYTHON_URL}" | sha1sum | cut -d " " -f 1` | ||
echo "URL_HASH=${URL_HASH}" | ||
echo "URL_HASH=${URL_HASH}" >> $GITHUB_OUTPUT | ||
BASE_FILE_NAME=`echo "${MICROPYTHON_URL}" | rev | cut -d "/" -f 1 | rev | sed -e "s/^v//"` | ||
echo "BASE_FILE_NAME=${BASE_FILE_NAME}" | ||
echo "BASE_FILE_NAME=${BASE_FILE_NAME}" >> $GITHUB_OUTPUT | ||
FILE_NAME="micropython-${BASE_FILE_NAME}" | ||
echo "FILE_NAME=${FILE_NAME}" | ||
echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_OUTPUT | ||
DIR_NAME=`echo $FILE_NAME | rev | cut -d "." -f 3- | rev` | ||
echo "DIR_NAME=${DIR_NAME}" | ||
echo "DIR_NAME=${DIR_NAME}" >> $GITHUB_OUTPUT | ||
USER_BIN="${HOME}/bin" | ||
echo "USER_BIN=${USER_BIN}" | ||
echo "USER_BIN=${USER_BIN}" >> $GITHUB_OUTPUT | ||
- name: Restore mpy-cross | ||
id: cache-mpy-cross | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.mpy-vars.outputs.USER_BIN }}/mpy-cross | ||
key: ${{ runner.os }}-mpy-cross-${{ steps.mpy-vars.outputs.URL_HASH }} | ||
- name: Compile mpy-cross | ||
if: steps.cache-mpy-cross.outputs.cache-hit != 'true' | ||
working-directory: ${{ runner.temp }} | ||
run: | | ||
curl -L "${MICROPYTHON_URL}" -o "${{ steps.mpy-vars.outputs.FILE_NAME }}" | ||
tar -xf "${{ steps.mpy-vars.outputs.FILE_NAME }}" | ||
cd "${{ steps.mpy-vars.outputs.DIR_NAME }}/mpy-cross" && make | ||
mkdir "${{ steps.mpy-vars.outputs.USER_BIN }}" | ||
cp mpy-cross "${{ steps.mpy-vars.outputs.USER_BIN }}" | ||
stat "${{ steps.mpy-vars.outputs.USER_BIN }}/mpy-cross" | ||
- name: Add path | ||
run: echo "${{ steps.mpy-vars.outputs.USER_BIN }}" >> $GITHUB_PATH | ||
- name: Build mpy | ||
run: pipenv run build | ||
- name: Create package | ||
run: pipenv run package | ||
- name: Rename package | ||
run: mv "./dist/package.zip" "./dist/m5-wattmeter-${{ github.ref_name }}.zip" | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: "./dist/m5-wattmeter-${{ github.ref_name }}.zip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Unit test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pipenv' | ||
- name: Install pipenv | ||
run: pip install pipenv | ||
- name: Install dependencies | ||
run: pipenv sync --dev | ||
- name: Run tests | ||
run: pipenv run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Update cache | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
MICROPYTHON_URL: "https://github.com/micropython/micropython/archive/refs/tags/v1.12.tar.gz" | ||
|
||
jobs: | ||
mpy-cross: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup variables | ||
id: mpy-vars | ||
run: | | ||
URL_HASH=`echo -n "${MICROPYTHON_URL}" | sha1sum | cut -d " " -f 1` | ||
echo "URL_HASH=${URL_HASH}" | ||
echo "URL_HASH=${URL_HASH}" >> $GITHUB_OUTPUT | ||
BASE_FILE_NAME=`echo "${MICROPYTHON_URL}" | rev | cut -d "/" -f 1 | rev | sed -e "s/^v//"` | ||
echo "BASE_FILE_NAME=${BASE_FILE_NAME}" | ||
echo "BASE_FILE_NAME=${BASE_FILE_NAME}" >> $GITHUB_OUTPUT | ||
FILE_NAME="micropython-${BASE_FILE_NAME}" | ||
echo "FILE_NAME=${FILE_NAME}" | ||
echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_OUTPUT | ||
DIR_NAME=`echo $FILE_NAME | rev | cut -d "." -f 3- | rev` | ||
echo "DIR_NAME=${DIR_NAME}" | ||
echo "DIR_NAME=${DIR_NAME}" >> $GITHUB_OUTPUT | ||
USER_BIN="${HOME}/bin" | ||
echo "USER_BIN=${USER_BIN}" | ||
echo "USER_BIN=${USER_BIN}" >> $GITHUB_OUTPUT | ||
- name: Restore mpy-cross | ||
id: cache-mpy-cross | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.mpy-vars.outputs.USER_BIN }}/mpy-cross | ||
key: ${{ runner.os }}-mpy-cross-${{ steps.mpy-vars.outputs.URL_HASH }} | ||
- name: Compile mpy-cross | ||
if: steps.cache-mpy-cross.outputs.cache-hit != 'true' | ||
working-directory: ${{ runner.temp }} | ||
run: | | ||
curl -L "${MICROPYTHON_URL}" -o "${{ steps.mpy-vars.outputs.FILE_NAME }}" | ||
tar -xf "${{ steps.mpy-vars.outputs.FILE_NAME }}" | ||
cd "${{ steps.mpy-vars.outputs.DIR_NAME }}/mpy-cross" && make | ||
mkdir "${{ steps.mpy-vars.outputs.USER_BIN }}" | ||
cp mpy-cross "${{ steps.mpy-vars.outputs.USER_BIN }}" | ||
stat "${{ steps.mpy-vars.outputs.USER_BIN }}/mpy-cross" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Takayuki Ogiso | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[scripts] | ||
test = 'bash -c "export PYTHONPATH=\"./wattmeter:$PYTHONPATH\"; python -m unittest discover -v -s tests"' | ||
build = 'bash -c "./scripts/concat.sh && ./scripts/mpy.sh"' | ||
package = './scripts/package.sh' |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
M5 Wattmeter | ||
----- | ||
|
||
M5 WattmeterはM5StickC Plusで消費電力量等を表示するアプリケーションです。 | ||
|
||
rin_ofumi氏製作の[Wi-SUN HATキット](https://kitto-yakudatsu.com/archives/7206)を使用するアプリケーションの実装のひとつです。 | ||
MicroPythonで実装されています。 | ||
|
||
<img src="https://user-images.githubusercontent.com/359700/231117382-a7e43c4f-b37d-44df-bb3f-8dd4244f88b5.jpg" width="400"> | ||
|
||
# 特徴 | ||
|
||
* フリッカーフリー表示 | ||
* 注意, 警告時に表示変更とビープ音 | ||
* 画面消灯のスケジュール指定 | ||
* 複数の画面表示方法 | ||
* Wi-Fi接続先を設定ファイルから指定可能 | ||
|
||
# 動作環境 | ||
|
||
* M5StickC Plus 1.1 | ||
* Wi-SUN HATキット | ||
* Wi-SUN対応無線モジュール ROHM BP35A1 | ||
* UIFlow_StickC_Plus v1.11.5 | ||
* (MicroPython 1.12) | ||
|
||
設置されている電力メーターが920MHz帯のWi-SUN規格の無線を使用するスマートメーターである必要があります。 | ||
|
||
# 使用方法 | ||
|
||
1. 電力会社にBルートの使用開始申請を行いID, パスワードを取得する | ||
2. 必要なハードウェアを揃えて組み立てる | ||
3. M5StickC PlusにUIFlow_StickC_Plusファームウェアを書き込む | ||
4. M5 Wattmeterパッケージを[ダウンロード](https://github.com/zuku/m5-wattmeter/releases/latest)する | ||
5. 取得したBルートID, パスワードと契約アンペア数をもとに設定ファイルを書き換える | ||
6. M5StickC PlusとコンピュータをUSB接続してパッケージ内の必要なファイルを転送する | ||
7. M5StickC PlusのAPPモードでM5 Wattmeterアプリケーションを起動する | ||
|
||
詳細についてはWikiの[準備](https://github.com/zuku/m5-wattmeter/wiki/Preparation)と[使用方法](https://github.com/zuku/m5-wattmeter/wiki/Usage)を参照してください。 | ||
|
||
# ライセンス | ||
|
||
M5 WattmeterにはMITライセンスが適用されます。 |
Oops, something went wrong.