From 4ea7e2f7025d47c5c2e250842cf40116fa99a215 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Thu, 15 Jun 2023 12:58:25 +0200 Subject: [PATCH 01/20] Update platformio_orig.ini nailed makuna rtc version to 2.3.7, since 2.4.0 does not compile --- platformio_orig.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index 34f685e5..d5842469 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -80,7 +80,7 @@ lib_deps_basic = greyrook/libpax @ ^1.1.0 https://github.com/SukkoPera/Arduino-Rokkit-Hash.git bblanchon/ArduinoJson @ ^6.21.2 - makuna/RTC @ ^2.3.7 + makuna/RTC @ 2.3.7 mathertel/OneButton @ ^2.0.3 lewisxhe/XPowersLib @ ^0.1.7 256dpi/MQTT @ ^2.5.1 @@ -140,4 +140,4 @@ platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/ build_flags = -include "src/hal/${sysenv.CI_HALFILE}" ; set by CI ${common.build_flags_all} -upload_protocol = esptool \ No newline at end of file +upload_protocol = esptool From d982fd5957154a9994ddeca2b809c61f90dd5c52 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sat, 24 Jun 2023 16:27:23 +0200 Subject: [PATCH 02/20] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd4b63e2..d189478e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -250,7 +250,7 @@ jobs: - name: Build and deploy for testboard env: PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} - run: pio remote -a prenzlpi run -t upload -r + run: pio remote -a prenzlpi run -t upload - name: Wait 120 seconds run: sleep 120s shell: bash From f373fa0b48dfd4711ccc60c50060c88cce74f750 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 24 Jun 2023 16:45:36 +0200 Subject: [PATCH 03/20] fix RTC lib compile issue --- include/globals.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/globals.h b/include/globals.h index 78e633b5..dc7316b9 100644 --- a/include/globals.h +++ b/include/globals.h @@ -6,6 +6,7 @@ // Time functions #ifdef HAS_RTC +#include #include #endif #include From 9cbd248d57d777d0b2b4165c2ccae8f567fd8a62 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 24 Jun 2023 16:46:07 +0200 Subject: [PATCH 04/20] update arduino-esp32 & RTC lib --- platformio_orig.ini | 4 ++-- platformio_orig_s3.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index d5842469..c2df2d70 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -55,7 +55,7 @@ extra_scripts = pre:src/build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h -platform_espressif32 = espressif32@6.3.1 +platform_espressif32 = espressif32@6.3.2 monitor_speed = 115200 upload_speed = 115200 ; set by build.py and taken from hal file lib_deps_lora = @@ -80,7 +80,7 @@ lib_deps_basic = greyrook/libpax @ ^1.1.0 https://github.com/SukkoPera/Arduino-Rokkit-Hash.git bblanchon/ArduinoJson @ ^6.21.2 - makuna/RTC @ 2.3.7 + makuna/RTC @ ^2.4.0 mathertel/OneButton @ ^2.0.3 lewisxhe/XPowersLib @ ^0.1.7 256dpi/MQTT @ ^2.5.1 diff --git a/platformio_orig_s3.ini b/platformio_orig_s3.ini index 0d43c89e..49f20cd5 100644 --- a/platformio_orig_s3.ini +++ b/platformio_orig_s3.ini @@ -18,7 +18,7 @@ extra_scripts = pre:src/build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h -platform_espressif32 = espressif32@6.3.1 +platform_espressif32 = espressif32@6.3.2 monitor_speed = 115200 upload_speed = 115200 ; set by build.py and taken from hal file lib_deps_all = From 3db86bc59e78aad25b980fb59dc553b90f38044d Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 24 Jun 2023 17:30:18 +0200 Subject: [PATCH 05/20] downgrade rTC lib to avoid compile issues --- platformio_orig.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index c2df2d70..562ddb77 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -80,7 +80,7 @@ lib_deps_basic = greyrook/libpax @ ^1.1.0 https://github.com/SukkoPera/Arduino-Rokkit-Hash.git bblanchon/ArduinoJson @ ^6.21.2 - makuna/RTC @ ^2.4.0 + makuna/RTC @ 2.3.7 mathertel/OneButton @ ^2.0.3 lewisxhe/XPowersLib @ ^0.1.7 256dpi/MQTT @ ^2.5.1 From f009417d331bdbd01d956336c663164f696a93e3 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sun, 25 Jun 2023 15:08:02 +0200 Subject: [PATCH 06/20] fix RTC lib bug --- include/gpsread.h | 1 - platformio_orig.ini | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/gpsread.h b/include/gpsread.h index 6eae7bb7..cb234eb1 100644 --- a/include/gpsread.h +++ b/include/gpsread.h @@ -4,7 +4,6 @@ #if (HAS_GPS) #include // library for parsing NMEA data -#include #include "timekeeper.h" #ifndef GPS_BAUDRATE diff --git a/platformio_orig.ini b/platformio_orig.ini index 562ddb77..c2df2d70 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -80,7 +80,7 @@ lib_deps_basic = greyrook/libpax @ ^1.1.0 https://github.com/SukkoPera/Arduino-Rokkit-Hash.git bblanchon/ArduinoJson @ ^6.21.2 - makuna/RTC @ 2.3.7 + makuna/RTC @ ^2.4.0 mathertel/OneButton @ ^2.0.3 lewisxhe/XPowersLib @ ^0.1.7 256dpi/MQTT @ ^2.5.1 From 6813f664ab2f027d344834543766d33edc93ecd4 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sun, 25 Jun 2023 17:27:52 +0200 Subject: [PATCH 07/20] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d189478e..bd4b63e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -250,7 +250,7 @@ jobs: - name: Build and deploy for testboard env: PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} - run: pio remote -a prenzlpi run -t upload + run: pio remote -a prenzlpi run -t upload -r - name: Wait 120 seconds run: sleep 120s shell: bash From d6d5debc191abefde6e569151d8794f3cee2ce89 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Tue, 27 Jun 2023 17:50:38 +0200 Subject: [PATCH 08/20] Update hardware.md --- docs/hardware.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/hardware.md b/docs/hardware.md index 57a8a588..5f7b9950 100644 --- a/docs/hardware.md +++ b/docs/hardware.md @@ -24,7 +24,7 @@ LoLin32lite + [LoraNode32-Lite shield](https://github.com/hallard/LoLin32-Lite-L - TTGO: [T-Wristband](https://www.aliexpress.com/item/4000527495064.html) - Generic ESP32 -*) supports microSD/TF-card for local logging of paxcounter data +*) supports microSD/TF-card for local logging of paxcounter data. SD/TF-card must be FAT32 formatted. Depending on board hardware following features are supported: @@ -73,4 +73,4 @@ By default, bluetooth sniffing is not started. If you enable bluetooth be aware ``` c linenums="29" title="paxcounter.conf" #define BLECOUNTER 1 - ``` \ No newline at end of file + ``` From 0f1ec1b01d6574d58cfc54eb20d6110e9224b51a Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Tue, 27 Jun 2023 17:52:37 +0200 Subject: [PATCH 09/20] Update index.md --- docs/configuration/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/configuration/index.md b/docs/configuration/index.md index 0ed00637..abcb78fa 100644 --- a/docs/configuration/index.md +++ b/docs/configuration/index.md @@ -112,7 +112,7 @@ This describes how to set up a mobile PaxCounter:
Follow all steps so far fo ## SD-card -Data can be stored on SD-card if the board provides an SD card interface, either with SPI or MMC mode. To enable this feature, specify interface mode and hardware pins in board's hal file (`src/hal/`): +Data can be stored on a FAT32 (pre-)formatted SD-card if the board provides an SD card interface, either with SPI or MMC mode. To enable this feature, specify interface mode and hardware pins in board's hal file (`src/hal/`): ```c #define HAS_SDCARD 1 // SD-card interface, using SPI mode @@ -149,4 +149,4 @@ Additionally, it's possible to redirect system console output to a plain text fi ```c linenums="16" title="src/paxcounter_orig.conf" --8<-- "src/paxcounter_orig.conf:16:16" -``` \ No newline at end of file +``` From 6f81fc34b5f7027a9e9a9cba3f81a67561f5fcc7 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Wed, 28 Jun 2023 14:52:19 +0200 Subject: [PATCH 10/20] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd4b63e2..d189478e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -250,7 +250,7 @@ jobs: - name: Build and deploy for testboard env: PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} - run: pio remote -a prenzlpi run -t upload -r + run: pio remote -a prenzlpi run -t upload - name: Wait 120 seconds run: sleep 120s shell: bash From ea5146e51eba5733c5e89c314d52fff7b4e7944c Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Wed, 28 Jun 2023 15:28:22 +0200 Subject: [PATCH 11/20] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d189478e..bd4b63e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -250,7 +250,7 @@ jobs: - name: Build and deploy for testboard env: PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} - run: pio remote -a prenzlpi run -t upload + run: pio remote -a prenzlpi run -t upload -r - name: Wait 120 seconds run: sleep 120s shell: bash From 76b0571ad0f1b0e69b4ff8b3f89aba412376b0b8 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Wed, 28 Jun 2023 21:35:51 +0200 Subject: [PATCH 12/20] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd4b63e2..d189478e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -250,7 +250,7 @@ jobs: - name: Build and deploy for testboard env: PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} - run: pio remote -a prenzlpi run -t upload -r + run: pio remote -a prenzlpi run -t upload - name: Wait 120 seconds run: sleep 120s shell: bash From 9422bc56414951d662b0246ce85d00156a59a83c Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Wed, 28 Jun 2023 21:50:22 +0200 Subject: [PATCH 13/20] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d189478e..bd4b63e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -250,7 +250,7 @@ jobs: - name: Build and deploy for testboard env: PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} - run: pio remote -a prenzlpi run -t upload + run: pio remote -a prenzlpi run -t upload -r - name: Wait 120 seconds run: sleep 120s shell: bash From aaea9d01b498dd7e8fdbc93a2124165bb98077ac Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 1 Jul 2023 17:38:44 +0200 Subject: [PATCH 14/20] move build.py to shared folder for remote agent --- {src => shared}/build.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {src => shared}/build.py (100%) diff --git a/src/build.py b/shared/build.py similarity index 100% rename from src/build.py rename to shared/build.py From 1e0dd55d9e84944716f46f32e6a9a3bb8a481e47 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 1 Jul 2023 17:39:31 +0200 Subject: [PATCH 15/20] remove -r option fpr remote agent --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd4b63e2..d189478e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -250,7 +250,7 @@ jobs: - name: Build and deploy for testboard env: PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} - run: pio remote -a prenzlpi run -t upload -r + run: pio remote -a prenzlpi run -t upload - name: Wait 120 seconds run: sleep 120s shell: bash From c73b1901376a26d46c5f838d5541bb7822ce74e1 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 1 Jul 2023 17:44:43 +0200 Subject: [PATCH 16/20] modify extra_scripts path --- platformio_orig.ini | 2 +- platformio_orig_s3.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index c2df2d70..d570de20 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -51,7 +51,7 @@ release_version = 3.6.0 ; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose debug_level = 3 -extra_scripts = pre:src/build.py +extra_scripts = pre:shared/build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h diff --git a/platformio_orig_s3.ini b/platformio_orig_s3.ini index 49f20cd5..06217797 100644 --- a/platformio_orig_s3.ini +++ b/platformio_orig_s3.ini @@ -14,7 +14,7 @@ release_version = 3.6.0 ; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose debug_level = 3 -extra_scripts = pre:src/build.py +extra_scripts = pre:shared/build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h From 2deaec1aed274a94de8da92da508cedece26d1f2 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 1 Jul 2023 18:32:33 +0200 Subject: [PATCH 17/20] move hal files from /src to /shared --- docs/configuration/index.md | 30 +++++----- docs/hardware.md | 2 +- platformio_orig.ini | 4 +- platformio_orig_s3.ini | 4 +- shared/build.py | 3 +- {src => shared}/hal/ebox.h | 0 {src => shared}/hal/eboxtube.h | 0 {src => shared}/hal/ecopower.h | 0 {src => shared}/hal/fipy.h | 68 +++++++++++----------- {src => shared}/hal/generic.h | 0 {src => shared}/hal/heltec.h | 0 {src => shared}/hal/heltecv2.h | 0 {src => shared}/hal/heltecv21.h | 0 {src => shared}/hal/lolin32lite.h | 0 {src => shared}/hal/lolin32litelora.h | 0 {src => shared}/hal/lolin32lora.h | 0 {src => shared}/hal/lopy.h | 0 {src => shared}/hal/lopy4.h | 0 {src => shared}/hal/m5core.h | 0 {src => shared}/hal/m5fire.h | 0 {src => shared}/hal/octopus32.h | 0 {src => shared}/hal/olimexpoeiso.h | 0 {src => shared}/hal/tinypico.h | 0 {src => shared}/hal/tinypicomatrix.h | 0 {src => shared}/hal/ttgobeam.h | 0 {src => shared}/hal/ttgobeam10.h | 0 {src => shared}/hal/ttgofox.h | 0 {src => shared}/hal/ttgotdisplay.h | 0 {src => shared}/hal/ttgotdisplays3.h | 0 {src => shared}/hal/ttgotdongledisplays3.h | 0 {src => shared}/hal/ttgotdongles3.h | 0 {src => shared}/hal/ttgotwristband.h | 0 {src => shared}/hal/ttgov1.h | 0 {src => shared}/hal/ttgov2.h | 0 {src => shared}/hal/ttgov21new.h | 0 {src => shared}/hal/ttgov21old.h | 0 {src => shared}/hal/wemos32matrix.h | 0 {src => shared}/hal/wemos32oled.h | 0 38 files changed, 56 insertions(+), 55 deletions(-) rename {src => shared}/hal/ebox.h (100%) rename {src => shared}/hal/eboxtube.h (100%) rename {src => shared}/hal/ecopower.h (100%) rename {src => shared}/hal/fipy.h (96%) rename {src => shared}/hal/generic.h (100%) rename {src => shared}/hal/heltec.h (100%) rename {src => shared}/hal/heltecv2.h (100%) rename {src => shared}/hal/heltecv21.h (100%) rename {src => shared}/hal/lolin32lite.h (100%) rename {src => shared}/hal/lolin32litelora.h (100%) rename {src => shared}/hal/lolin32lora.h (100%) rename {src => shared}/hal/lopy.h (100%) rename {src => shared}/hal/lopy4.h (100%) rename {src => shared}/hal/m5core.h (100%) rename {src => shared}/hal/m5fire.h (100%) rename {src => shared}/hal/octopus32.h (100%) rename {src => shared}/hal/olimexpoeiso.h (100%) rename {src => shared}/hal/tinypico.h (100%) rename {src => shared}/hal/tinypicomatrix.h (100%) rename {src => shared}/hal/ttgobeam.h (100%) rename {src => shared}/hal/ttgobeam10.h (100%) rename {src => shared}/hal/ttgofox.h (100%) rename {src => shared}/hal/ttgotdisplay.h (100%) rename {src => shared}/hal/ttgotdisplays3.h (100%) rename {src => shared}/hal/ttgotdongledisplays3.h (100%) rename {src => shared}/hal/ttgotdongles3.h (100%) rename {src => shared}/hal/ttgotwristband.h (100%) rename {src => shared}/hal/ttgov1.h (100%) rename {src => shared}/hal/ttgov2.h (100%) rename {src => shared}/hal/ttgov21new.h (100%) rename {src => shared}/hal/ttgov21old.h (100%) rename {src => shared}/hal/wemos32matrix.h (100%) rename {src => shared}/hal/wemos32oled.h (100%) diff --git a/docs/configuration/index.md b/docs/configuration/index.md index abcb78fa..e66f4aa6 100644 --- a/docs/configuration/index.md +++ b/docs/configuration/index.md @@ -14,24 +14,24 @@ You can add up to 3 user defined sensors. Insert your sensor's payload scheme in For these peripherals no additional code is needed. To activate configure them in the board's hal file before building the code. -See [`generic.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/hal/generic.h) for all options and for proper configuration of BME280/BME680. +See [`generic.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/hal/generic.h) for all options and for proper configuration of BME280/BME680. === "BME/ BMP Configuration" - ```c linenums="37" title="src/hal/generic.h" - --8<-- "src/hal/generic.h:37:49" + ```c linenums="37" title="shared/hal/generic.h" + --8<-- "shared/hal/generic.h:37:49" ``` === "SDS011 Configuration" - ```c linenums="51" title="src/hal/generic.h" - --8<-- "src/hal/generic.h:51:56" + ```c linenums="51" title="shared/hal/generic.h" + --8<-- "shared/hal/generic.h:51:56" ``` === "Custom Sensors Configuration" - ```c linenums="57" title="src/hal/generic.h" - --8<-- "src/hal/generic.h:57:60" + ```c linenums="57" title="shared/hal/generic.h" + --8<-- "shared/hal/generic.h:57:60" ``` === "Complete `generic.h`" - ```c linenums="1" title="src/hal/generic.h" - --8<-- "src/hal/generic.h" + ```c linenums="1" title="shared/hal/generic.h" + --8<-- "shared/hal/generic.h" ``` Output of user sensor data can be switched by user remote control command `0x14` sent to Port 2. @@ -77,10 +77,10 @@ Paxcounter can keep a time-of-day synced with external or on board time sources. --8<-- "src/paxcounter_orig.conf:88:88" ``` -Supported external time sources are GPS, LORAWAN network time and LORAWAN application timeserver time. Supported on board time sources are the RTC of ESP32 and a DS3231 RTC chip, both are kept sycned as fallback time sources. Time accuracy depends on board's time base which generates the pulse per second. Supported are GPS PPS, SQW output of RTC, and internal ESP32 hardware timer. Time base is selected by #defines in the board's hal file, see example in [`generic.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/hal/generic.h). +Supported external time sources are GPS, LORAWAN network time and LORAWAN application timeserver time. Supported on board time sources are the RTC of ESP32 and a DS3231 RTC chip, both are kept sycned as fallback time sources. Time accuracy depends on board's time base which generates the pulse per second. Supported are GPS PPS, SQW output of RTC, and internal ESP32 hardware timer. Time base is selected by #defines in the board's hal file, see example in [`generic.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/hal/generic.h). -```c linenums="87" title="src/hal/generic.h" ---8<-- "src/hal/generic.h:87:96" +```c linenums="87" title="shared/hal/generic.h" +--8<-- "shared/hal/generic.h:87:96" ``` @@ -112,7 +112,7 @@ This describes how to set up a mobile PaxCounter:
Follow all steps so far fo ## SD-card -Data can be stored on a FAT32 (pre-)formatted SD-card if the board provides an SD card interface, either with SPI or MMC mode. To enable this feature, specify interface mode and hardware pins in board's hal file (`src/hal/`): +Data can be stored on a FAT32 (pre-)formatted SD-card if the board provides an SD card interface, either with SPI or MMC mode. To enable this feature, specify interface mode and hardware pins in board's hal file (`shared/hal/`): ```c #define HAS_SDCARD 1 // SD-card interface, using SPI mode @@ -126,10 +126,10 @@ Data can be stored on a FAT32 (pre-)formatted SD-card if the board provides an S #define SDCARD_SCLK (14) ``` -This is an example of a board with MMC SD-card interface: [https://www.aliexpress.com/item/32915894264.html](https://www.aliexpress.com/item/32915894264.html). For this board use file [`src/hal/ttgov21new.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/hal/ttgov21new.h) and add the lines given above. +This is an example of a board with MMC SD-card interface: [https://www.aliexpress.com/item/32915894264.html](https://www.aliexpress.com/item/32915894264.html). For this board use file [`shared/hal/ttgov21new.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/hal/ttgov21new.h) and add the lines given above. Another approach would be this tiny board: [https://www.aliexpress.com/item/32424558182.html](https://www.aliexpress.com/item/32424558182.html) (needs 5V). -In this case you choose the correct file for your ESP32-board in the src/hal-directory and add the lines given above. Edit the pin numbers given in the example, according to your wiring. +In this case you choose the correct file for your ESP32-board in the shared/hal-directory and add the lines given above. Edit the pin numbers given in the example, according to your wiring. Data is written on SD-card to a single file. After 3 write operations the data is flushed to the disk to minimize flash write cycles. Thus, up to the last 3 records of data will get lost when the Paxcounter looses power during operation. diff --git a/docs/hardware.md b/docs/hardware.md index 5f7b9950..b50842b7 100644 --- a/docs/hardware.md +++ b/docs/hardware.md @@ -45,7 +45,7 @@ Depending on board hardware following features are supported: - SD-card (see section SD-card here) for logging pax data Target platform must be selected in `platformio.ini`.
-Hardware dependent settings (pinout etc.) are stored in board files in [/hal](https://github.com/cyberman54/ESP32-Paxcounter/tree/master/src/hal) directory. If you want to use a ESP32 board which is not yet supported, use hal file generic.h and tailor pin mappings to your needs. Pull requests for new boards welcome.
+Hardware dependent settings (pinout etc.) are stored in board files in [/shared/hal](https://github.com/cyberman54/ESP32-Paxcounter/tree/master/shared/hal) directory. If you want to use a ESP32 board which is not yet supported, use hal file generic.h and tailor pin mappings to your needs. Pull requests for new boards welcome.
### 3D printed cases Some 3D printable cases can be found (and, if wanted so, ordered) on Thingiverse, see diff --git a/platformio_orig.ini b/platformio_orig.ini index d570de20..7e3e308b 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -114,7 +114,7 @@ upload_speed = ${common.upload_speed} platform = ${common.platform_espressif32} lib_deps = ${common.lib_deps_all} build_flags = - -include "src/hal/${board.halfile}" + -include "shared/hal/${board.halfile}" ${common.build_flags_all} extra_scripts = ${common.extra_scripts} monitor_speed = ${common.monitor_speed} @@ -138,6 +138,6 @@ platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/ [env:ci] build_flags = - -include "src/hal/${sysenv.CI_HALFILE}" ; set by CI + -include "shared/hal/${sysenv.CI_HALFILE}" ; set by CI ${common.build_flags_all} upload_protocol = esptool diff --git a/platformio_orig_s3.ini b/platformio_orig_s3.ini index 06217797..04bcda67 100644 --- a/platformio_orig_s3.ini +++ b/platformio_orig_s3.ini @@ -53,7 +53,7 @@ upload_speed = ${common.upload_speed} platform = ${common.platform_espressif32} lib_deps = ${common.lib_deps_all} build_flags = - -include "src/hal/${board.halfile}" + -include "shared/hal/${board.halfile}" ${common.build_flags_all} extra_scripts = ${common.extra_scripts} monitor_speed = ${common.monitor_speed} @@ -64,6 +64,6 @@ upload_protocol = esptool [env:ci] build_flags = - -include "src/hal/${sysenv.CI_HALFILE}" ; set by CI + -include "shared/hal/${sysenv.CI_HALFILE}" ; set by CI ${common.build_flags_all} upload_protocol = esptool \ No newline at end of file diff --git a/shared/build.py b/shared/build.py index e6bd6b50..25fcc7d0 100644 --- a/shared/build.py +++ b/shared/build.py @@ -23,7 +23,8 @@ config.read("platformio.ini") srcdir = env.get("PROJECT_SRC_DIR") # get hal path -haldir = os.path.join (srcdir, "hal") +prjdir = env.get("PROJECT_DIR") +haldir = os.path.join (prjdir, "shared/hal") # check if hal file is present in source directory halconfig = config.get("board", "halfile") diff --git a/src/hal/ebox.h b/shared/hal/ebox.h similarity index 100% rename from src/hal/ebox.h rename to shared/hal/ebox.h diff --git a/src/hal/eboxtube.h b/shared/hal/eboxtube.h similarity index 100% rename from src/hal/eboxtube.h rename to shared/hal/eboxtube.h diff --git a/src/hal/ecopower.h b/shared/hal/ecopower.h similarity index 100% rename from src/hal/ecopower.h rename to shared/hal/ecopower.h diff --git a/src/hal/fipy.h b/shared/hal/fipy.h similarity index 96% rename from src/hal/fipy.h rename to shared/hal/fipy.h index dd8a5da5..4a6c6a42 100644 --- a/src/hal/fipy.h +++ b/shared/hal/fipy.h @@ -1,34 +1,34 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - -#ifndef _FIPY_H -#define _FIPY_H - -#include - -// Hardware related definitions for Pycom FiPy Board - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa - -#define CFG_sx1272_radio 1 -#define HAS_LED NOT_A_PIN // FiPy has no on board LED, so we use RGB LED -#define RGB_LED_COUNT 1 // we have 1 LED -#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT); -#define BOARD_HAS_PSRAM // use extra 4MB extern RAM - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) -#define LORA_RST LMIC_UNUSED_PIN -#define LORA_IRQ (23) // LoRa IRQ -#define LORA_IO1 (23) // Pin tied via diode to DIO0 -#define LORA_IO2 LMIC_UNUSED_PIN - -// select WIFI antenna (internal = onboard / external = u.fl socket) -#define HAS_ANTENNA_SWITCH GPIO_NUM_21 // pin for switching wifi antenna -#define WIFI_ANTENNA 0 // 0 = internal, 1 = external - -#endif +// clang-format off +// upload_speed 921600 +// board esp32dev + +#ifndef _FIPY_H +#define _FIPY_H + +#include + +// Hardware related definitions for Pycom FiPy Board + +#define HAS_LORA 1 // comment out if device shall not send data via LoRa + +#define CFG_sx1272_radio 1 +#define HAS_LED NOT_A_PIN // FiPy has no on board LED, so we use RGB LED +#define RGB_LED_COUNT 1 // we have 1 LED +#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT); +#define BOARD_HAS_PSRAM // use extra 4MB extern RAM + +// Pins for LORA chip SPI interface, reset line and interrupt lines +#define LORA_SCK (5) +#define LORA_CS (18) +#define LORA_MISO (19) +#define LORA_MOSI (27) +#define LORA_RST LMIC_UNUSED_PIN +#define LORA_IRQ (23) // LoRa IRQ +#define LORA_IO1 (23) // Pin tied via diode to DIO0 +#define LORA_IO2 LMIC_UNUSED_PIN + +// select WIFI antenna (internal = onboard / external = u.fl socket) +#define HAS_ANTENNA_SWITCH GPIO_NUM_21 // pin for switching wifi antenna +#define WIFI_ANTENNA 0 // 0 = internal, 1 = external + +#endif diff --git a/src/hal/generic.h b/shared/hal/generic.h similarity index 100% rename from src/hal/generic.h rename to shared/hal/generic.h diff --git a/src/hal/heltec.h b/shared/hal/heltec.h similarity index 100% rename from src/hal/heltec.h rename to shared/hal/heltec.h diff --git a/src/hal/heltecv2.h b/shared/hal/heltecv2.h similarity index 100% rename from src/hal/heltecv2.h rename to shared/hal/heltecv2.h diff --git a/src/hal/heltecv21.h b/shared/hal/heltecv21.h similarity index 100% rename from src/hal/heltecv21.h rename to shared/hal/heltecv21.h diff --git a/src/hal/lolin32lite.h b/shared/hal/lolin32lite.h similarity index 100% rename from src/hal/lolin32lite.h rename to shared/hal/lolin32lite.h diff --git a/src/hal/lolin32litelora.h b/shared/hal/lolin32litelora.h similarity index 100% rename from src/hal/lolin32litelora.h rename to shared/hal/lolin32litelora.h diff --git a/src/hal/lolin32lora.h b/shared/hal/lolin32lora.h similarity index 100% rename from src/hal/lolin32lora.h rename to shared/hal/lolin32lora.h diff --git a/src/hal/lopy.h b/shared/hal/lopy.h similarity index 100% rename from src/hal/lopy.h rename to shared/hal/lopy.h diff --git a/src/hal/lopy4.h b/shared/hal/lopy4.h similarity index 100% rename from src/hal/lopy4.h rename to shared/hal/lopy4.h diff --git a/src/hal/m5core.h b/shared/hal/m5core.h similarity index 100% rename from src/hal/m5core.h rename to shared/hal/m5core.h diff --git a/src/hal/m5fire.h b/shared/hal/m5fire.h similarity index 100% rename from src/hal/m5fire.h rename to shared/hal/m5fire.h diff --git a/src/hal/octopus32.h b/shared/hal/octopus32.h similarity index 100% rename from src/hal/octopus32.h rename to shared/hal/octopus32.h diff --git a/src/hal/olimexpoeiso.h b/shared/hal/olimexpoeiso.h similarity index 100% rename from src/hal/olimexpoeiso.h rename to shared/hal/olimexpoeiso.h diff --git a/src/hal/tinypico.h b/shared/hal/tinypico.h similarity index 100% rename from src/hal/tinypico.h rename to shared/hal/tinypico.h diff --git a/src/hal/tinypicomatrix.h b/shared/hal/tinypicomatrix.h similarity index 100% rename from src/hal/tinypicomatrix.h rename to shared/hal/tinypicomatrix.h diff --git a/src/hal/ttgobeam.h b/shared/hal/ttgobeam.h similarity index 100% rename from src/hal/ttgobeam.h rename to shared/hal/ttgobeam.h diff --git a/src/hal/ttgobeam10.h b/shared/hal/ttgobeam10.h similarity index 100% rename from src/hal/ttgobeam10.h rename to shared/hal/ttgobeam10.h diff --git a/src/hal/ttgofox.h b/shared/hal/ttgofox.h similarity index 100% rename from src/hal/ttgofox.h rename to shared/hal/ttgofox.h diff --git a/src/hal/ttgotdisplay.h b/shared/hal/ttgotdisplay.h similarity index 100% rename from src/hal/ttgotdisplay.h rename to shared/hal/ttgotdisplay.h diff --git a/src/hal/ttgotdisplays3.h b/shared/hal/ttgotdisplays3.h similarity index 100% rename from src/hal/ttgotdisplays3.h rename to shared/hal/ttgotdisplays3.h diff --git a/src/hal/ttgotdongledisplays3.h b/shared/hal/ttgotdongledisplays3.h similarity index 100% rename from src/hal/ttgotdongledisplays3.h rename to shared/hal/ttgotdongledisplays3.h diff --git a/src/hal/ttgotdongles3.h b/shared/hal/ttgotdongles3.h similarity index 100% rename from src/hal/ttgotdongles3.h rename to shared/hal/ttgotdongles3.h diff --git a/src/hal/ttgotwristband.h b/shared/hal/ttgotwristband.h similarity index 100% rename from src/hal/ttgotwristband.h rename to shared/hal/ttgotwristband.h diff --git a/src/hal/ttgov1.h b/shared/hal/ttgov1.h similarity index 100% rename from src/hal/ttgov1.h rename to shared/hal/ttgov1.h diff --git a/src/hal/ttgov2.h b/shared/hal/ttgov2.h similarity index 100% rename from src/hal/ttgov2.h rename to shared/hal/ttgov2.h diff --git a/src/hal/ttgov21new.h b/shared/hal/ttgov21new.h similarity index 100% rename from src/hal/ttgov21new.h rename to shared/hal/ttgov21new.h diff --git a/src/hal/ttgov21old.h b/shared/hal/ttgov21old.h similarity index 100% rename from src/hal/ttgov21old.h rename to shared/hal/ttgov21old.h diff --git a/src/hal/wemos32matrix.h b/shared/hal/wemos32matrix.h similarity index 100% rename from src/hal/wemos32matrix.h rename to shared/hal/wemos32matrix.h diff --git a/src/hal/wemos32oled.h b/shared/hal/wemos32oled.h similarity index 100% rename from src/hal/wemos32oled.h rename to shared/hal/wemos32oled.h From b09934e76e536987854b55b14111b2fa9ff17195 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 1 Jul 2023 19:11:35 +0200 Subject: [PATCH 18/20] move all user configurable files to shared dir --- .github/workflows/build.yml | 38 ++++++++++++------------- .gitignore | 6 ++-- docs/configuration/custom-sensors.md | 8 +++--- docs/configuration/index.md | 20 ++++++------- docs/getting-started.md | 42 ++++++++++++++-------------- docs/payloadformat.md | 6 ++-- platformio_orig.ini | 2 +- platformio_orig_s3.ini | 2 +- shared/build.py | 24 ++++++++-------- {src => shared}/lmic_config.h | 0 {src => shared}/loraconf_sample.h | 2 +- {src => shared}/ota_sample.conf | 0 {src => shared}/paxcounter_orig.conf | 0 src/lorawan.cpp | 2 +- 14 files changed, 77 insertions(+), 75 deletions(-) rename {src => shared}/lmic_config.h (100%) rename {src => shared}/loraconf_sample.h (98%) rename {src => shared}/ota_sample.conf (100%) rename {src => shared}/paxcounter_orig.conf (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d189478e..d4d87f2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,9 +92,9 @@ jobs: - name: Copy of necessary files run: | cp platformio_orig.ini platformio.ini - cp src/loraconf_sample.h src/loraconf.h - cp src/ota_sample.conf src/ota.conf - cp src/paxcounter_orig.conf src/paxcounter.conf + cp shared/loraconf_sample.h shared/loraconf.h + cp shared/ota_sample.conf shared/ota.conf + cp shared/paxcounter_orig.conf shared/paxcounter.conf - name: Clean run: pio run -t clean -e ci - name: Run PlatformIO CI for ${{ matrix.board }} @@ -143,9 +143,9 @@ jobs: - name: Copy of necessary files run: | cp platformio_orig.ini platformio.ini - cp src/loraconf_sample.h src/loraconf.h - cp src/ota_sample.conf src/ota.conf - cp src/paxcounter_orig.conf src/paxcounter.conf + cp shared/loraconf_sample.h shared/loraconf.h + cp shared/ota_sample.conf shared/ota.conf + cp shared/paxcounter_orig.conf shared/paxcounter.conf - name: Clean run: pio run -t clean -e ci - name: Run PlatformIO CI for ${{ matrix.board }} @@ -197,9 +197,9 @@ jobs: - name: Copy of necessary files run: | cp platformio_orig_s3.ini platformio.ini - cp src/loraconf_sample.h src/loraconf.h - cp src/ota_sample.conf src/ota.conf - cp src/paxcounter_orig.conf src/paxcounter.conf + cp shared/loraconf_sample.h shared/loraconf.h + cp shared/ota_sample.conf shared/ota.conf + cp shared/paxcounter_orig.conf shared/paxcounter.conf - name: Clean run: pio run -t clean -e ci - name: Run PlatformIO CI for ${{ matrix.board }} @@ -235,18 +235,18 @@ jobs: - name: Prepare config files for test run: | cp platformio_orig.ini platformio.ini - cp src/loraconf_sample.h src/loraconf.h - cp src/ota_sample.conf src/ota.conf - cp src/paxcounter_orig.conf src/paxcounter.conf + cp shared/loraconf_sample.h shared/loraconf.h + cp shared/ota_sample.conf shared/ota.conf + cp shared/paxcounter_orig.conf shared/paxcounter.conf # apply test credentials to loraconf.h - sed -i "s/APPEUI\[8\] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};/${{ secrets.APPEUI }}/" "src/loraconf.h" - sed -i "s/APPKEY\[16\] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};/${{ secrets.APPKEY }}/" "src/loraconf.h" + sed -i "s/APPEUI\[8\] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};/${{ secrets.APPEUI }}/" "shared/loraconf.h" + sed -i "s/APPKEY\[16\] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};/${{ secrets.APPKEY }}/" "shared/loraconf.h" # apply test credentials to ota.conf - sed -i "/OTA_WIFI_SSID/c OTA_WIFI_SSID = ${{ secrets.OTA_WIFI_SSID }}" "src/ota.conf" - sed -i "/OTA_WIFI_PASS/c OTA_WIFI_PASS = ${{ secrets.OTA_WIFI_PASS }}" "src/ota.conf" - sed -i "/PAXEXPRESS_USER/c PAXEXPRESS_USER = ${{ secrets.PAXEXPRESS_USER }}" "src/ota.conf" - sed -i "/PAXEXPRESS_REPO/c PAXEXPRESS_REPO = ${{ secrets.PAXEXPRESS_REPO }}" "src/ota.conf" - sed -i "/PAXEXPRESS_API_TOKEN/c PAXEXPRESS_API_TOKEN = ${{ secrets.PAXEXPRESS_API_TOKEN }}" "src/ota.conf" + sed -i "/OTA_WIFI_SSID/c OTA_WIFI_SSID = ${{ secrets.OTA_WIFI_SSID }}" "shared/ota.conf" + sed -i "/OTA_WIFI_PASS/c OTA_WIFI_PASS = ${{ secrets.OTA_WIFI_PASS }}" "shared/ota.conf" + sed -i "/PAXEXPRESS_USER/c PAXEXPRESS_USER = ${{ secrets.PAXEXPRESS_USER }}" "shared/ota.conf" + sed -i "/PAXEXPRESS_REPO/c PAXEXPRESS_REPO = ${{ secrets.PAXEXPRESS_REPO }}" "shared/ota.conf" + sed -i "/PAXEXPRESS_API_TOKEN/c PAXEXPRESS_API_TOKEN = ${{ secrets.PAXEXPRESS_API_TOKEN }}" "shared/ota.conf" - name: Build and deploy for testboard env: PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} diff --git a/.gitignore b/.gitignore index fa273fab..0bd3a0b4 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ .vscode/.browse.c_cpp.db* .clang_complete .gcc-flags.json -src/loraconf.h -src/ota.conf +shared/loraconf.h +shared/ota.conf platformio.ini -src/paxcounter.conf +shared/paxcounter.conf diff --git a/docs/configuration/custom-sensors.md b/docs/configuration/custom-sensors.md index 6f8516dc..12c96914 100644 --- a/docs/configuration/custom-sensors.md +++ b/docs/configuration/custom-sensors.md @@ -14,23 +14,23 @@ The following exampls show how to add a custom temperature and humidty sensor. To use a custom sensor you first have to enable the Sensor which you want to use. For this you have to edit or add `HAS_SENSOR_1` in either the `paxcounter.conf` or the `hal` file of your board. === "Activate Sensor 1" - ```c linenums="132" title="src/paxcounter_orig.conf" + ```c linenums="132" title="shared/paxcounter_orig.conf" #define HAS_SENSOR_1 1 ``` === "Activate Sensor 2" - ```c linenums="132" title="src/paxcounter_orig.conf" + ```c linenums="132" title="shared/paxcounter_orig.conf" #define HAS_SENSOR_2 1 ``` === "Activate Sensor 3" - ```c linenums="132" title="src/paxcounter_orig.conf" + ```c linenums="132" title="shared/paxcounter_orig.conf" #define HAS_SENSOR_3 1 ``` You might also add a constant for your custom sensor in the `paxcounter.conf` file. This is optional but can be used to identify the sensor type. -```c linenums="133" title="src/paxcounter_orig.conf" +```c linenums="133" title="shared/paxcounter_orig.conf" #define HAS_GY21 1 // (1) ``` diff --git a/docs/configuration/index.md b/docs/configuration/index.md index e66f4aa6..55091431 100644 --- a/docs/configuration/index.md +++ b/docs/configuration/index.md @@ -51,8 +51,8 @@ Output of sensor and peripheral data is internally switched by a bitmask registe \*) GPS data can also be combined with paxcounter payload on port 1, `#define GPSPORT 1` in paxcounter.conf to enable -```c linenums="102" title="src/paxcounter_orig.conf" ---8<-- "src/paxcounter_orig.conf:102:102" +```c linenums="102" title="shared/paxcounter_orig.conf" +--8<-- "shared/paxcounter_orig.conf:102:102" ``` @@ -60,8 +60,8 @@ Output of sensor and peripheral data is internally switched by a bitmask registe Paxcounter supports a battery friendly power saving mode. In this mode the device enters deep sleep, after all data is polled from all sensors and the dataset is completeley sent through all user configured channels (LORAWAN / SPI / MQTT / SD-Card). Set `#define SLEEPCYCLE` in paxcounter.conf to enable power saving mode and to specify the duration of a sleep cycle. -```c linenums="20" title="src/paxcounter_orig.conf" ---8<-- "src/paxcounter_orig.conf:20:20" +```c linenums="20" title="shared/paxcounter_orig.conf" +--8<-- "shared/paxcounter_orig.conf:20:20" ``` @@ -73,8 +73,8 @@ Paxcounter supports a battery friendly power saving mode. In this mode the devic Paxcounter can keep a time-of-day synced with external or on board time sources. Set `#define TIME_SYNC_INTERVAL` in `paxcounter.conf` to enable time sync. -```c linenums="88" title="src/paxcounter_orig.conf" ---8<-- "src/paxcounter_orig.conf:88:88" +```c linenums="88" title="shared/paxcounter_orig.conf" +--8<-- "shared/paxcounter_orig.conf:88:88" ``` Supported external time sources are GPS, LORAWAN network time and LORAWAN application timeserver time. Supported on board time sources are the RTC of ESP32 and a DS3231 RTC chip, both are kept sycned as fallback time sources. Time accuracy depends on board's time base which generates the pulse per second. Supported are GPS PPS, SQW output of RTC, and internal ESP32 hardware timer. Time base is selected by #defines in the board's hal file, see example in [`generic.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/hal/generic.h). @@ -100,8 +100,8 @@ Paxcounter can be used to sync a wall clock which has a DCF77 or IF482 time tele This describes how to set up a mobile PaxCounter:
Follow all steps so far for preparing the device, selecting the packed payload format. In `paxcounter.conf` set `PAYLOAD_OPENSENSEBOX` to `1`. -```c linenums="60" title="src/paxcounter_orig.conf" ---8<-- "src/paxcounter_orig.conf:60:60" +```c linenums="60" title="shared/paxcounter_orig.conf" +--8<-- "shared/paxcounter_orig.conf:60:60" ``` Register a new sensebox on [https://opensensemap.org/](https://opensensemap.org). In the sensor configuration select "TheThingsNetwork" and set decoding profile to "LoRa serialization". Enter your TTN Application and Device ID. Setup decoding option using: @@ -147,6 +147,6 @@ If you want to change this, modify `src/sdcard.cpp` and `include/sdcard.h`. Additionally, it's possible to redirect system console output to a plain text file on SD card. This can be useful for debugging headless devices in the field. In `paxcounter.conf` set `SDLOGGING` to `1`. -```c linenums="16" title="src/paxcounter_orig.conf" ---8<-- "src/paxcounter_orig.conf:16:16" +```c linenums="16" title="shared/paxcounter_orig.conf" +--8<-- "shared/paxcounter_orig.conf:16:16" ``` diff --git a/docs/getting-started.md b/docs/getting-started.md index c2e09a8d..da03ef58 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -41,15 +41,15 @@ Edit `platformio_orig.ini` (for ESP32 CPU based boards) *or* `platformio_orig_s3 ## paxcounter.conf -Edit `src/paxcounter_orig.conf` and tailor settings in this file according to your needs and use case. Please take care of the duty cycle regulations of the LoRaWAN network you're going to use. Copy or rename to `src/paxcounter.conf`. +Edit `shared/paxcounter_orig.conf` and tailor settings in this file according to your needs and use case. Please take care of the duty cycle regulations of the LoRaWAN network you're going to use. Copy or rename to `shared/paxcounter.conf`. === "Copy" ``` bash - cp src/paxcounter_orig.conf src/paxcounter.conf + cp shared/paxcounter_orig.conf shared/paxcounter.conf ``` === "Rename" ``` bash - mv src/paxcounter_orig.conf src/paxcounter.conf + mv shared/paxcounter_orig.conf shared/paxcounter.conf ``` @@ -58,52 +58,52 @@ Edit `src/paxcounter_orig.conf` and tailor settings in this file according to yo If your device has a **real time clock** it can be updated by either LoRaWAN network or GPS time, according to settings *TIME_SYNC_INTERVAL* and *TIME_SYNC_LORAWAN* in `paxcounter.conf`. ```c linenums="85" title="paxcounter.conf" ---8<-- "src/paxcounter_orig.conf:85:85" +--8<-- "shared/paxcounter_orig.conf:85:85" ``` -## src/lmic_config.h -Edit `src/lmic_config.h` and tailor settings in this file according to your country and device hardware. Please take care of national regulations when selecting the frequency band for LoRaWAN. +## shared/lmic_config.h +Edit `shared/lmic_config.h` and tailor settings in this file according to your country and device hardware. Please take care of national regulations when selecting the frequency band for LoRaWAN. -```c linenums="9" title="national regulations in src/lmic_config.h " ---8<-- "src/lmic_config.h:9:18" +```c linenums="9" title="national regulations in shared/lmic_config.h " +--8<-- "shared/lmic_config.h:9:18" ``` -## src/loraconf.h -Create file `src/loraconf.h` using the template [src/loraconf_sample.h](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/loraconf_sample.h) and adjust settings to use your personal values. To join the network and activate your paxcounter, you must configure either OTAA or ABP join method. You should use OTAA, whenever possible. To understand the differences of the two methods, [this article](https://www.thethingsnetwork.org/docs/devices/registration.html) may be useful. +## shared/loraconf.h +Create file `shared/loraconf.h` using the template [shared/loraconf_sample.h](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/loraconf_sample.h) and adjust settings to use your personal values. To join the network and activate your paxcounter, you must configure either OTAA or ABP join method. You should use OTAA, whenever possible. To understand the differences of the two methods, [this article](https://www.thethingsnetwork.org/docs/devices/registration.html) may be useful. === "Copy" ``` bash - cp src/loraconf_sample.h src/loraconf.h + cp shared/loraconf_sample.h shared/loraconf.h ``` === "Rename" ``` bash - mv src/loraconf_sample.h src/loraconf.h + mv shared/loraconf_sample.h shared/loraconf.h ``` -To configure OTAA, leave `#define LORA_ABP` deactivated (commented). To use ABP, activate (uncomment) `#define LORA_ABP` in the file `src/loraconf.h`. -The file `src/loraconf_sample.h` contains more information about the values to provide. +To configure OTAA, leave `#define LORA_ABP` deactivated (commented). To use ABP, activate (uncomment) `#define LORA_ABP` in the file `shared/loraconf.h`. +The file `shared/loraconf_sample.h` contains more information about the values to provide. === "Activate OTAA (Default), Deactivate ABP" - ``` c linenums="18" title="src/loraconf.h" - --8<-- "src/loraconf_sample.h:18:18" + ``` c linenums="18" title="shared/loraconf.h" + --8<-- "shared/loraconf_sample.h:18:18" ``` === "Deactivate OTAA, Activate ABP" - ``` c linenums="18" title="src/loraconf.h" + ``` c linenums="18" title="shared/loraconf.h" #define LORA_ABP ``` -## src/ota.conf -Create file `src/ota.conf` using the template [src/ota_sample.conf](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/ota_sample.conf) and enter your WIFI network & key. These settings are used for downloading updates via WiFi, either from a remote https server, or locally via WebUI. If you want to use a remote server, you need a PAX.express repository. Enter your PAX.express credentials in ota.conf. If you don't need wireless firmware updates just rename ota.sample.conf to ota.conf. +## shared/ota.conf +Create file `shared/ota.conf` using the template [shared/ota_sample.conf](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/ota_sample.conf) and enter your WIFI network & key. These settings are used for downloading updates via WiFi, either from a remote https server, or locally via WebUI. If you want to use a remote server, you need a PAX.express repository. Enter your PAX.express credentials in ota.conf. If you don't need wireless firmware updates just rename ota.sample.conf to ota.conf. === "Copy" ``` bash - cp src/ota_sample.conf src/ota.conf + cp shared/ota_sample.conf shared/ota.conf ``` === "Rename" ``` bash - mv src/ota_sample.conf src/ota.conf + mv shared/ota_sample.conf shared/ota.conf ``` # Building diff --git a/docs/payloadformat.md b/docs/payloadformat.md index 18dbd8fb..393ce2a4 100644 --- a/docs/payloadformat.md +++ b/docs/payloadformat.md @@ -1,7 +1,7 @@ # Payload format -You can select different payload formats in [`paxcounter.conf`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/paxcounter_orig.conf): +You can select different payload formats in [`paxcounter.conf`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/paxcounter_orig.conf): - ***Plain*** uses big endian format and generates json fields, e.g. useful for TTN console @@ -10,8 +10,8 @@ You can select different payload formats in [`paxcounter.conf`](https://github.c - [***CayenneLPP***](https://developers.mydevices.com/cayenne/docs/lora/#lora-cayenne-low-power-payload) generates MyDevices Cayenne readable fields -```c linenums="20" title="src/paxcounter_orig.conf" ---8<-- "src/paxcounter_orig.conf:20:20" +```c linenums="20" title="shared/paxcounter_orig.conf" +--8<-- "shared/paxcounter_orig.conf:20:20" ``` diff --git a/platformio_orig.ini b/platformio_orig.ini index 7e3e308b..58de5052 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -93,7 +93,7 @@ lib_deps_all = ${common.lib_deps_sensors} ${common.lib_deps_ledmatrix} build_flags_all = - -include "src/paxcounter.conf" + -include "shared/paxcounter.conf" '-D CORE_DEBUG_LEVEL=${common.debug_level}' '-D LOG_LOCAL_LEVEL=${common.debug_level}' '-D PROGVERSION="${common.release_version}"' diff --git a/platformio_orig_s3.ini b/platformio_orig_s3.ini index 04bcda67..b7c45e6a 100644 --- a/platformio_orig_s3.ini +++ b/platformio_orig_s3.ini @@ -32,7 +32,7 @@ lib_deps_all = 256dpi/MQTT @ ^2.5.1 ricmoo/QRCode @ ^0.0.1 build_flags_all = - -include "src/paxcounter.conf" + -include "shared/paxcounter.conf" '-D CORE_DEBUG_LEVEL=${common.debug_level}' '-D LOG_LOCAL_LEVEL=${common.debug_level}' '-D PROGVERSION="${common.release_version}"' diff --git a/shared/build.py b/shared/build.py index 25fcc7d0..33955b88 100644 --- a/shared/build.py +++ b/shared/build.py @@ -19,12 +19,14 @@ env = DefaultEnvironment() config = configparser.ConfigParser() config.read("platformio.ini") -# get platformio source path -srcdir = env.get("PROJECT_SRC_DIR") +# get platformio project directory +prjdir = env.get("PROJECT_DIR") + +# get platformio shared path +shareddir = os.path.join (prjdir, "shared") # get hal path -prjdir = env.get("PROJECT_DIR") -haldir = os.path.join (prjdir, "shared/hal") +haldir = os.path.join (prjdir, "shared\hal") # check if hal file is present in source directory halconfig = config.get("board", "halfile") @@ -43,23 +45,23 @@ if os.path.isfile(halconfigfile) and os.access(halconfigfile, os.R_OK): else: sys.exit("Missing file " + halconfigfile + ", please create it! Aborting.") -# check if lmic config file is present in source directory +# check if lmic config file is present in shared directory lmicconfig = config.get("common", "lmicconfigfile") -lmicconfigfile = os.path.join (srcdir, lmicconfig) +lmicconfigfile = os.path.join (shareddir, lmicconfig) if os.path.isfile(lmicconfigfile) and os.access(lmicconfigfile, os.R_OK): print("Parsing LMIC configuration from " + lmicconfigfile) else: sys.exit("Missing file " + lmicconfigfile + ", please create it! Aborting.") -# check if lora key file is present in source directory -lorakeyfile = os.path.join (srcdir, config.get("common", "lorakeyfile")) +# check if lora key file is present in shared directory +lorakeyfile = os.path.join (shareddir, config.get("common", "lorakeyfile")) if os.path.isfile(lorakeyfile) and os.access(lorakeyfile, os.R_OK): print("Parsing LORAWAN keys from " + lorakeyfile) else: sys.exit("Missing file " + lorakeyfile + ", please create it! Aborting.") -# check if ota key file is present in source directory -otakeyfile = os.path.join (srcdir, config.get("common", "otakeyfile")) +# check if ota key file is present in shared directory +otakeyfile = os.path.join (shareddir, config.get("common", "otakeyfile")) if os.path.isfile(otakeyfile) and os.access(otakeyfile, os.R_OK): print("Parsing OTA keys from " + otakeyfile) else: @@ -114,7 +116,7 @@ env.Append(BUILD_FLAGS=[ u'-DPAXEXPRESS_REPO=\\"' + mykeys["PAXEXPRESS_REPO"] + '\\"', u'-DPAXEXPRESS_PACKAGE=\\"' + package + '\\"', u'-DARDUINO_LMIC_PROJECT_CONFIG_H=' + lmicconfig, - u'-I \"' + srcdir + '\"' + u'-I \"' + shareddir + '\"' ]) # function for pushing new firmware to paxexpress storage using API diff --git a/src/lmic_config.h b/shared/lmic_config.h similarity index 100% rename from src/lmic_config.h rename to shared/lmic_config.h diff --git a/src/loraconf_sample.h b/shared/loraconf_sample.h similarity index 98% rename from src/loraconf_sample.h rename to shared/loraconf_sample.h index 093d73aa..4f367600 100644 --- a/src/loraconf_sample.h +++ b/shared/loraconf_sample.h @@ -7,7 +7,7 @@ * LMIC LoRaWAN configuration * * Read the values from TTN console (or whatever applies), insert them here, - * and rename this file to src/loraconf.h + * and rename this file to shared/loraconf.h * * You can configure OTAA or ABP Activation. In order to use ABP, uncomment * (enable) the following line, but you should only do so, if you have good diff --git a/src/ota_sample.conf b/shared/ota_sample.conf similarity index 100% rename from src/ota_sample.conf rename to shared/ota_sample.conf diff --git a/src/paxcounter_orig.conf b/shared/paxcounter_orig.conf similarity index 100% rename from src/paxcounter_orig.conf rename to shared/paxcounter_orig.conf diff --git a/src/lorawan.cpp b/src/lorawan.cpp index a8ca9547..6fafcd14 100644 --- a/src/lorawan.cpp +++ b/src/lorawan.cpp @@ -266,7 +266,7 @@ esp_err_t lmic_init(void) { // This tells LMIC to make the receive windows bigger, in case your clock is // faster or slower. This causes the transceiver to be earlier switched on, // so consuming more power. You may sharpen (reduce) CLOCK_ERROR_PERCENTAGE -// in src/lmic_config.h if you are limited on battery. +// in shared/lmic_config.h if you are limited on battery. #ifdef CLOCK_ERROR_PROCENTAGE LMIC_setClockError(CLOCK_ERROR_PROCENTAGE * MAX_CLOCK_ERROR / 1000); #endif From e5bfa0a4b7503c9945c5fc5dae938fe5e18c8a08 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 1 Jul 2023 19:15:29 +0200 Subject: [PATCH 19/20] build.py: fix hal path --- shared/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/build.py b/shared/build.py index 33955b88..1840a1fa 100644 --- a/shared/build.py +++ b/shared/build.py @@ -26,7 +26,7 @@ prjdir = env.get("PROJECT_DIR") shareddir = os.path.join (prjdir, "shared") # get hal path -haldir = os.path.join (prjdir, "shared\hal") +haldir = os.path.join (prjdir, "shared/hal") # check if hal file is present in source directory halconfig = config.get("board", "halfile") From ad35df9f883bb9ae54d6a2aa5444b3b8e55092db Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 1 Jul 2023 19:18:45 +0200 Subject: [PATCH 20/20] build.py fix hal dir --- shared/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/build.py b/shared/build.py index 1840a1fa..0261f910 100644 --- a/shared/build.py +++ b/shared/build.py @@ -26,7 +26,7 @@ prjdir = env.get("PROJECT_DIR") shareddir = os.path.join (prjdir, "shared") # get hal path -haldir = os.path.join (prjdir, "shared/hal") +haldir = os.path.join (shareddir, "hal") # check if hal file is present in source directory halconfig = config.get("board", "halfile")