Skip to content

Commit

Permalink
[node-yun-http] Add PlatformIO and CI/GHA configurations
Browse files Browse the repository at this point in the history
Also, remove previous Makefile-based build system.
  • Loading branch information
amotl committed May 26, 2023
1 parent 8642d68 commit 9d8b556
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 254 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/platformio-ci.yaml
Expand Up @@ -47,6 +47,7 @@ jobs:
node-wifi-mqtt: ${{ steps.changes.outputs.node-wifi-mqtt }}
node-esp8266-generic: ${{ steps.changes.outputs.node-esp8266-generic }}
node-esp32-generic: ${{ steps.changes.outputs.node-esp32-generic }}
node-yun-http: ${{ steps.changes.outputs.node-yun-http }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
Expand All @@ -63,6 +64,8 @@ jobs:
- 'node-esp8266-generic/**'
node-esp32-generic:
- 'node-esp32-generic/**'
node-yun-http:
- 'node-yun-http/**'
build:
needs: changes
Expand Down Expand Up @@ -123,3 +126,8 @@ jobs:
if: ${{ needs.changes.outputs.node-esp32-generic == 'true' }}
run: |
pio run --project-dir node-esp32-generic
- name: Build node-yun-http
if: ${{ needs.changes.outputs.node-yun-http == 'true' }}
run: |
pio run --project-dir node-yun-http
1 change: 0 additions & 1 deletion node-yun-http/.gitignore
@@ -1 +0,0 @@
Makefile
64 changes: 0 additions & 64 deletions node-yun-http/Libraries.mk

This file was deleted.

15 changes: 15 additions & 0 deletions node-yun-http/Makefile
@@ -0,0 +1,15 @@
$(eval venvpath := .venv)
$(eval python := $(venvpath)/bin/python)
$(eval pip := $(venvpath)/bin/pip)
$(eval pio := $(venvpath)/bin/pio)


build: setup-virtualenv
$(pio) run

upload: setup-virtualenv
$(pio) run --target upload --upload-port=${MCU_PORT}

setup-virtualenv:
@test -e $(python) || python3 -m venv $(venvpath)
$(pip) install platformio
87 changes: 0 additions & 87 deletions node-yun-http/Makefile-Linux.mk

This file was deleted.

90 changes: 0 additions & 90 deletions node-yun-http/Makefile-OSX.mk

This file was deleted.

33 changes: 21 additions & 12 deletions node-yun-http/README.rst
Expand Up @@ -7,6 +7,7 @@
################
Mois sensor node
################

.. highlight:: bash

.. tip::
Expand All @@ -18,11 +19,13 @@ Mois sensor node
************
Introduction
************

This firmware powers the `Mois Box`_, based on the `Arduino Yún Shield`_-compatible `Dragino Yun Shield v2.4`_.
Telemetry data is transmitted to a `custom PHP receiver program <https://github.com/bee-mois/beescale/blob/master/add_line2.php>`_
over HTTP using the `Yún HTTP Client`_ from the `Bridge Library for Yún devices`_. It is also stored locally on a SD card.
The most recent firmware version is always available at `node-yun-http.ino`_.


.. figure:: https://ptrace.hiveeyes.org/2017-03-21_mois-node-yun-http.jpg
:alt: Mois Box with electronics
:width: 450px
Expand Down Expand Up @@ -78,8 +81,8 @@ Configure firmware
==================
.. highlight:: c++

Have a look at the source code `node-yun-http.ino`_ and adapt
feature flags and setting variables according to your environment:
Have a look at the source code `node-yun-http.ino`_ and adapt feature flags and setting
variables according to your environment.

Configure load cell calibration settings::

Expand All @@ -93,32 +96,38 @@ Configure load cell calibration settings::

.. tip::

Read about :ref:`scale-adjust-firmware` to get these values.
Read about :ref:`scale-adjust-firmware` to determine those values.


*****
Build
*****

.. highlight:: bash

Build for AVR
=============
The build system is based on `Arduino-Makefile`_, a Makefile for Arduino projects.
The build system is based on `PlatformIO`_, which will install toolchains and build
your customized firmware without efforts. All you need is a Python installation.

::

# Select appropriate Makefile
ln -s Makefile-Linux.mk Makefile

# Build firmware
make
make build

.. note::

If you need to build for different targets, or if you want to modernize your dependencies,
you may want to adjust the ``platformio.ini`` file, to match your needs.

.. note:: You might want to adjust the appropriate Makefile to match your environment.
In order to make changes to the firmware, edit the ``node-yun-http.ino`` file, and
invoke ``make build`` to build it again.


Upload to MCU
-------------
=============
::

export MCU_PORT=/dev/ttyUSB0
make upload


.. _PlatformIO: https://platformio.org/
27 changes: 27 additions & 0 deletions node-yun-http/platformio.ini
@@ -0,0 +1,27 @@
; PlatformIO Project Configuration File for Mois sensor node
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/en/latest/projectconf/

[platformio]
src_dir = .

monitor_speed = 115200

[common]
lib_deps =
../libraries/ADS1231
adafruit/Adafruit TSL2591 Library@1.4.3
adafruit/DHT sensor library@1.4.4
arduino-libraries/Bridge@1.7.0
milesburton/DallasTemperature@3.11.0
paulstoffregen/OneWire@2.3.5
robtillaart/RunningMedian@0.3.7
watterott/digitalWriteFast@1.0.0

[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps =
${common.lib_deps}

0 comments on commit 9d8b556

Please sign in to comment.