Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ESP32 Example - Backport from matthias-bs/BresserWeatherSensorTTN with fixes and additional features #211

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9871f07
Removed Serial.print() calls
matthias-bs Mar 7, 2023
89ef701
Changed cMyLoRaWAN to inherit from Arduino_LoRaWAN_network
matthias-bs Mar 7, 2023
303ed62
Reverted last change
matthias-bs Mar 7, 2023
a169dda
Create CI.yml
matthias-bs Mar 8, 2023
9fd1da6
Update CI.yml
matthias-bs Mar 8, 2023
c6d936f
Update CI.yml
matthias-bs Mar 8, 2023
3af4287
Add files via upload
matthias-bs May 12, 2023
7f92211
Backport from matthias-bs/BresserWeatherSensorTTN
matthias-bs Sep 5, 2023
932fb29
Update library.properties
matthias-bs Sep 5, 2023
48ea48c
Update library.json
matthias-bs Sep 5, 2023
83fdd90
Update Arduino_LoRaWAN.h
matthias-bs Sep 5, 2023
8dad4b7
Update README.md
matthias-bs Sep 5, 2023
058f446
Update LICENSE
matthias-bs Sep 5, 2023
298944d
Merge branch 'master' into esp32_example_new
matthias-bs Sep 5, 2023
f72442d
Update CI.yml
matthias-bs Sep 5, 2023
13ac812
Update CI.yml
matthias-bs Sep 5, 2023
a6665b0
Added code for energy saving modes & generic ADC usage
matthias-bs Sep 7, 2023
6160281
Update CI.yml
matthias-bs Sep 7, 2023
6beb26e
Update CI.yml
matthias-bs Sep 7, 2023
74fa4ea
Added documentation
matthias-bs Sep 8, 2023
f6700e1
Merge branch 'esp32_example_new' of https://github.com/matthias-bs/ar…
matthias-bs Sep 8, 2023
1a2e735
Minor changes
matthias-bs Sep 8, 2023
60ebf62
Minor changes
matthias-bs Sep 8, 2023
9bd8a90
Updated screenshots to Arduino v2.2.1
matthias-bs Sep 8, 2023
eb89fb4
Added pin definitions for FIREBEETLE_COVER_LORA
matthias-bs Sep 10, 2023
e15c49b
Merge branch 'esp32_example_new' of https://github.com/matthias-bs/ar…
matthias-bs Sep 10, 2023
d2d5658
Fixed comment
matthias-bs Sep 10, 2023
770f3e8
Fixed saving of sleep_interval/sleep_interval_long to preferences
matthias-bs Oct 4, 2023
ce52cad
Update
matthias-bs Oct 10, 2023
33cc297
Added RP2040
matthias-bs Oct 10, 2023
723395b
Changed format string
matthias-bs Oct 10, 2023
6925013
Fixed compiler warnings
matthias-bs Oct 10, 2023
b2cc1f2
Updated
matthias-bs Oct 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:

build:
strategy:
matrix:
board:
- esp32:esp32:esp32:DebugLevel=none
- esp32:esp32:esp32:DebugLevel=verbose
#- esp32:esp32:firebeetle32
#- esp32:esp32:ttgo-lora32:Revision=TTGO_LoRa32_V1
#- esp32:esp32:ttgo-lora32:Revision=TTGO_LoRa32_V2
#- esp32:esp32:ttgo-lora32:Revision=TTGO_LoRa32_v21new
#- esp32:esp32:heltec_wireless_stick:PSRAM=disabled
#- esp32:esp32:featheresp32
#- esp32:esp32:adafruit_feather_esp32s2
- rp2040:rp2040:adafruit_feather:dbgport=Serial
runs-on: ubuntu-latest
name: ${{ matrix.board }}
env:
GH_TOKEN: ${{ github.token }}
run-build: ${{ contains(matrix.board, 'esp32:esp32') || contains(matrix.board, 'rp2040:rp2040') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.board)) }}

steps:
- name: Install arduino-cli
if: ${{ env.run-build == 'true' }}
run:
|
mkdir -p ~/.local/bin
echo "~/.local/bin" >> $GITHUB_PATH
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=~/.local/bin sh

- name: Get platform name
if: ${{ env.run-build == 'true' }}
uses: jungwinter/split@v2
id: split
with:
msg: ${{ matrix.board }}
separator: ':'

- name: Prepare platform-specific settings
if: ${{ env.run-build == 'true' }}
id: prep
run:
|
# common settings - no extra options, skip nothing, all warnings
echo "skip-pattern='simple_sensor_bme280'" >> $GITHUB_OUTPUT
echo "warnings='all'" >> $GITHUB_OUTPUT

# platform-dependent settings - extra board options, board index URLs, skip patterns etc.
if [[ "${{ contains(matrix.board, 'esp32:esp32') }}" == "true" ]]; then
# ESP32
python -m pip install pyserial
echo "index-url=--additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" >> $GITHUB_OUTPUT
elif [[ "${{ contains(matrix.board, 'rp2040:rp2040') }}" == "true" ]]; then
# RP2040
echo "index-url=--additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" >> $GITHUB_OUTPUT
fi

- name: Install libraries
if: ${{ env.run-build == 'true' }}
run:
|
declare -a required_libs=(
"MCCI LoRaWAN LMIC [email protected]"
"MCCI Arduino LoRaWAN [email protected]"
"MCCI Arduino Development Kit [email protected]"
"LoRa [email protected]"
"[email protected]"
"[email protected]"
"[email protected]")
for i in "${required_libs[@]}"
do
arduino-cli lib install "$i"
done

- name: Install platform
if: ${{ env.run-build == 'true' }}
run:
|
arduino-cli core update-index ${{ format('{0}', steps.prep.outputs.index-url) }}
arduino-cli core install ${{ format('{0}:{1} {2}', steps.split.outputs._0, steps.split.outputs._1, steps.prep.outputs.index-url) }}

- name: Checkout repository
if: ${{ env.run-build == 'true' }}
uses: actions/checkout@v3

- name: Customizing lmic_project_config.h (LMIC_ENABLE_DeviceTimeReq)
if: ${{ env.run-build == 'true' }}
run:
|
echo "#define LMIC_ENABLE_DeviceTimeReq 1" >> /home/runner/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/project_config/lmic_project_config.h
# Fix for linker error with Arduino core for ESP32 v2.0.x as suggested in https://github.com/mcci-catena/arduino-lmic/issues/714#issuecomment-822051171
echo "#define hal_init LMICHAL_init" >> /home/runner/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/project_config/lmic_project_config.h

- name: Copy secrets.h from secrets.h.template
if: ${{ env.run-build == 'true' }}
run:
|
pwd
ls
cp /home/runner/work/arduino-lorawan/arduino-lorawan/examples/arduino_lorawan_esp32_example/secrets.h.template \
/home/runner/work/arduino-lorawan/arduino-lorawan/examples/arduino_lorawan_esp32_example/secrets.h

- name: Build sketch
if: ${{ env.run-build == 'true' }}
run:
|
#for example in $(find $PWD/examples -name '*.ino' | sort); do
# modified to compile a singe sketch (instead of a library's examples)
for example in $(find $PWD -name '*.ino' | sort); do
# check whether to skip this sketch
if [ ! -z '${{ steps.prep.outputs.skip-pattern }}' ] && [[ ${example} =~ ${{ steps.prep.outputs.skip-pattern }} ]]; then
# skip sketch
echo -e "\n\033[1;33mSkipped ${example##*/} (matched with ${{ steps.prep.outputs.skip-pattern }})\033[0m";
else
# build sketch
echo -e "\n\033[1;33mBuilding ${example##*/} ... \033[0m";
arduino-cli compile --libraries /home/runner/work/arduino-lorawan --fqbn ${{ matrix.board }}${{ steps.prep.outputs.options }} $example --warnings=${{ steps.prep.outputs.warnings }}

if [ $? -ne 0 ]; then
echo -e "\033[1;31m${example##*/} build FAILED\033[0m\n";
exit 1;
else
echo -e "\033[1;32m${example##*/} build PASSED\033[0m\n";
fi
fi
done
22 changes: 22 additions & 0 deletions examples/arduino_lorawan_esp32_example/DEBUG_OUTPUT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Debug Output Configuration in Arduino IDE

## ESP32

1. Select appropriate (USB-)serial port for your board

![Arduino_IDE-Tools_Port](https://github.com/matthias-bs/BresserWeatherSensorTTN/assets/83612361/be496bf8-89ce-4db5-b1bf-c88a7f5e99cb)

**or**

![Arduino_IDE-Select_Other_Board_and_Port](https://github.com/matthias-bs/BresserWeatherSensorTTN/assets/83612361/ac847f23-4fe6-4111-929f-ac6d36cb8a53)

2. Select desired debug level

![Arduino_IDE-Tools_CoreDebugLevel](https://github.com/matthias-bs/BresserWeatherSensorTTN/assets/83612361/72a8b1d9-8d39-41fc-9658-78b432b73d56)

This passes the define `CORE_DEBUG_LEVEL`to the compiler accordingly.

Refer to the following for some background information
* https://thingpulse.com/esp32-logging/
* https://www.mischianti.org/2020/09/20/esp32-manage-multiple-serial-and-logging-for-debugging-3/
* https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-log.h
Loading