Compare commits

..

115 commits

Author SHA1 Message Date
Peter Buchegger d97a929848
Update README.md 2025-09-14 14:34:52 +02:00
Peter Buchegger 9617b11a29
Merge pull request #141 from lora-aprs/platformio_dependabot/ArduinoJson/7.0.4
Bump ArduinoJson from 6.21.3 to 7.0.4
2024-06-02 16:06:05 +00:00
Peter Buchegger 42b48e4590
Merge pull request #150 from lora-aprs/platformio_dependabot/espressif32/6.7.0
Bump espressif32 from 6.4.0 to 6.7.0
2024-06-02 16:05:56 +00:00
Peter Buchegger 0ad62b2067
Merge pull request #151 from lora-aprs/platformio_dependabot/TinyGPSPlus/1.1.0
Bump TinyGPSPlus from 1.0.3 to 1.1.0
2024-06-02 16:05:45 +00:00
Peter Buchegger 31c82ceda7
Merge pull request #153 from lora-aprs/peterus-patch-1
Update buid_check.yml
2024-06-02 16:03:04 +00:00
Peter Buchegger 995fd8b8bf
Update buid_check.yml 2024-06-02 18:01:23 +02:00
Peter Buchegger 38efc5de1e
Merge branch 'master' into platformio_dependabot/TinyGPSPlus/1.1.0 2024-06-02 17:40:21 +02:00
Peter Buchegger 2b88658daf
Merge branch 'master' into platformio_dependabot/espressif32/6.7.0 2024-06-02 17:39:56 +02:00
Peter Buchegger ee1368f7ba
Merge branch 'master' into platformio_dependabot/ArduinoJson/7.0.4 2024-06-02 17:39:34 +02:00
Peter Buchegger 9e8e283e29
Merge pull request #147 from lora-aprs/platformio_dependabot/Adafruit_SSD1306/2.5.10
Bump Adafruit SSD1306 from 2.5.7 to 2.5.10
2024-06-02 17:37:50 +02:00
Peter Buchegger 3a2e0f8e57
Merge branch 'master' into platformio_dependabot/Adafruit_SSD1306/2.5.10 2024-06-02 17:36:10 +02:00
Peter Buchegger 2626f9d1f8
Merge pull request #126 from lora-aprs/platformio_dependabot/Adafruit_GFX_Library/1.11.9
Bump Adafruit GFX Library from 1.11.7 to 1.11.9
2024-06-02 17:35:13 +02:00
Peter Buchegger 9587b58822
Merge branch 'master' into platformio_dependabot/Adafruit_GFX_Library/1.11.9 2024-06-02 17:33:24 +02:00
Peter Buchegger 1ce2a760c3
Merge pull request #152 from lora-aprs/platformio_dependabot/XPowersLib/0.2.4
Bump XPowersLib from 0.1.8 to 0.2.4
2024-06-02 17:25:26 +02:00
root 3fbb68d9ea Bump XPowersLib to 0.2.4 2024-06-02 00:26:29 +00:00
root d98c5fdd09 Bump TinyGPSPlus to 1.1.0 2024-05-22 00:24:01 +00:00
root 761412dbf7 Bump espressif32 to 6.7.0 2024-05-15 00:24:09 +00:00
root e571d96331 Bump Adafruit SSD1306 to 2.5.10 2024-05-03 00:23:41 +00:00
root f889c52b56 Bump ArduinoJson to 7.0.4 2024-03-13 00:23:20 +00:00
Peter Buchegger 72c33cbf9f
Merge pull request #132 from lora-aprs/fix_current_speed_bug
fix division by zero (current speed)
2023-11-25 19:19:59 +01:00
Peter Buchegger 04287e4e1f fix division by zero 2023-11-25 19:17:34 +01:00
root 4bed05d498 Bump Adafruit GFX Library to 1.11.9 2023-10-11 00:22:40 +00:00
Peter Buchegger cdee7e75cd
Merge pull request #122 from lora-aprs/axp2101_fix
quick fix for axp2101 charging
2023-09-18 14:07:27 +02:00
Peter Buchegger c4e39cb214 quick fix for axp2101 charging 2023-09-18 14:05:00 +02:00
Peter Buchegger 293ca3378f
Merge pull request #118 from lora-aprs/platformio_dependabot/ArduinoJson/6.21.3
Bump ArduinoJson from 6.21.2 to 6.21.3
2023-09-11 21:38:44 +02:00
Peter Buchegger 872132d1b7
Merge branch 'master' into platformio_dependabot/ArduinoJson/6.21.3 2023-09-11 21:36:57 +02:00
Peter Buchegger dc7dcaf083
Merge pull request #119 from lora-aprs/platformio_dependabot/espressif32/6.4.0
Bump espressif32 from 6.3.2 to 6.4.0
2023-09-11 21:36:41 +02:00
root 95ca590cb2 Bump espressif32 to 6.4.0 2023-09-11 19:32:24 +00:00
root 634f8d492f Bump ArduinoJson to 6.21.3 2023-09-11 19:32:21 +00:00
Peter Buchegger ff0b8a655f
Merge pull request #117 from lora-aprs/peterus-patch-1
bump version
2023-09-10 18:54:31 +02:00
Peter Buchegger 84645e8476
Update README.md 2023-09-10 18:52:07 +02:00
Peter Buchegger 16a74ba536
bump version 2023-09-10 18:49:13 +02:00
Peter Buchegger eda125b79a
Merge pull request #116 from lora-aprs/AXP2101_improvments
some improvements regarding AXP2101
2023-09-10 15:54:46 +02:00
Peter Buchegger af4827cfff
Merge branch 'master' into AXP2101_improvments 2023-09-10 15:52:54 +02:00
Peter Buchegger ceda1518e9 some improvements regarding AXP2101 2023-09-10 15:52:41 +02:00
Peter Buchegger 4d3826a983
Merge pull request #108 from lora-aprs/platformio_dependabot/Adafruit_GFX_Library/1.11.7
Bump Adafruit GFX Library from 1.11.5 to 1.11.7
2023-09-09 23:28:58 +02:00
Peter Buchegger 7dddd24dcd
Merge branch 'master' into platformio_dependabot/Adafruit_GFX_Library/1.11.7 2023-09-09 23:27:10 +02:00
Peter Buchegger 14cf4ee73a
Merge pull request #107 from lora-aprs/platformio_dependabot/espressif32/6.3.2
Bump espressif32 from 6.0.1 to 6.3.2
2023-09-09 23:26:02 +02:00
Peter Buchegger 92b64097d9
Merge branch 'master' into platformio_dependabot/Adafruit_GFX_Library/1.11.7 2023-09-09 23:25:23 +02:00
Peter Buchegger 5eccb95413
Merge pull request #109 from lora-aprs/platformio_dependabot/ArduinoJson/6.21.3
Bump ArduinoJson from 6.21.2 to 6.21.3
2023-09-09 23:24:45 +02:00
Peter Buchegger 65eb0bb8d4
Merge branch 'master' into platformio_dependabot/espressif32/6.3.2 2023-09-09 23:24:07 +02:00
Peter Buchegger ec6f5c87ba
Merge branch 'master' into platformio_dependabot/Adafruit_GFX_Library/1.11.7 2023-09-09 23:23:13 +02:00
Peter Buchegger a9966b60e9
Merge branch 'master' into platformio_dependabot/ArduinoJson/6.21.3 2023-09-09 23:22:32 +02:00
Peter Buchegger 95f44fa99d
Merge pull request #115 from lora-aprs/add_t-beam-AXP2101
add T-Beam v1.2 AXP2101
2023-09-09 23:21:14 +02:00
Peter Buchegger b638d95153 add T-Beam v1.2 AXP2101 2023-09-09 23:13:48 +02:00
root 5bb22e36c4 Bump ArduinoJson to 6.21.3 2023-07-24 00:26:01 +00:00
root 5e428b7286 Bump Adafruit GFX Library to 1.11.7 2023-07-19 00:46:12 +00:00
root eaf6fa7dce Bump espressif32 to 6.3.2 2023-07-06 00:29:09 +00:00
Peter Buchegger 91319291b1
Merge pull request #100 from lora-aprs/platformio_dependabot/ArduinoJson/6.21.2 2023-04-16 07:52:35 +02:00
root ecee2c654b Bump ArduinoJson to 6.21.2 2023-04-13 00:21:32 +00:00
Peter Buchegger 22838b95fa
Merge pull request #98 from lora-aprs/some-fixes
fix nocall check
2023-03-26 15:31:41 +02:00
Peter Buchegger f8376a6985 fix nocall check 2023-03-26 15:29:41 +02:00
Peter Buchegger 33c205e268
Merge pull request #87 from tomkukral/linux-steps 2023-03-17 08:51:52 +01:00
Peter Buchegger c935fcf9e3
Merge branch 'master' into linux-steps 2023-03-17 08:49:40 +01:00
Peter Buchegger 53ab5b2628
Merge pull request #96 from lora-aprs/peterus-patch-2 2023-03-17 08:48:46 +01:00
Peter Buchegger e072b83746
Update dependabot.yml 2023-03-12 06:42:42 +01:00
Tomáš Kukrál 5c4edabea6
Merge branch 'master' into linux-steps 2023-03-07 09:21:46 +01:00
Peter Buchegger 3c7ab4d970
Merge pull request #94 from zejdlikt/hotfix-logging-message-zejdlikt 2023-02-23 07:15:18 +01:00
Tomas Zejdlik 71d1b9fb5e String Object needs to be converted to C-style null terminated string in loggng function 2023-02-22 23:21:54 +01:00
Peter Buchegger 4d6bdb226c
Merge pull request #93 from lora-aprs/peterus-patch-1
Update dependabot.yml
2023-02-18 10:14:22 +01:00
Peter Buchegger a9ecf54e3e
Update dependabot.yml 2023-02-18 10:12:12 +01:00
Peter Buchegger e9842ea011
Merge pull request #90 from lora-aprs/platformio_dependabot/ArduinoJson/6.20.1
Bump ArduinoJson from 6.20.0 to 6.20.1
2023-02-15 22:17:40 +01:00
Peter Buchegger e9476cc265
Merge branch 'master' into platformio_dependabot/ArduinoJson/6.20.1 2023-02-15 22:15:43 +01:00
Peter Buchegger 45d9f9e1d0
Merge pull request #91 from lora-aprs/platformio_dependabot/espressif32/6.0.1
Bump espressif32 from 6.0.0 to 6.0.1
2023-02-15 21:08:53 +01:00
root 4b6caf55e6 Bump espressif32 to 6.0.1 2023-02-15 20:05:43 +00:00
root 22efdb6798 Bump ArduinoJson to 6.20.1 2023-02-15 20:05:40 +00:00
Peter Buchegger f10229b0a7
Merge pull request #84 from lora-aprs/platformio_dependabot/Adafruit_GFX_Library/1.11.5
Bump Adafruit GFX Library to 1.11.5
2023-01-21 13:54:07 +01:00
Peter Buchegger 8d04e5ccef
Merge branch 'master' into platformio_dependabot/Adafruit_GFX_Library/1.11.5 2023-01-21 13:52:12 +01:00
Peter Buchegger 5a49cba1d4
Merge pull request #78 from lora-aprs/platformio_dependabot/espressif32/6.0.0
Bump espressif32 to 6.0.0
2023-01-21 13:51:59 +01:00
Peter Buchegger f55892bd98
Merge branch 'master' into platformio_dependabot/espressif32/6.0.0 2023-01-21 13:49:14 +01:00
Peter Buchegger 879e39bd9e
Merge pull request #83 from lora-aprs/platformio_dependabot/esp-logger/1.0.0
Bump esp-logger to 1.0.0
2023-01-21 13:48:53 +01:00
Peter Buchegger 8202f72016 update logger calls 2023-01-21 13:47:05 +01:00
Peter Buchegger 4aa7d93b34
Merge branch 'master' into platformio_dependabot/esp-logger/1.0.0 2023-01-21 13:16:05 +01:00
Peter Buchegger 4b215d1371
Merge pull request #88 from lora-aprs/peterus-patch-1
Update dependabot.yml
2023-01-21 13:02:09 +01:00
Peter Buchegger b772240bbf
Update dependabot.yml 2023-01-21 12:59:42 +01:00
Peter Buchegger 0d41962f74
Merge branch 'master' into platformio_dependabot/espressif32/6.0.0 2023-01-21 12:50:29 +01:00
Peter Buchegger 23e1724e3b
Merge pull request #79 from lora-aprs/platformio_dependabot/LoRa/0.8.0
Bump LoRa to 0.8.0
2023-01-21 12:50:22 +01:00
Peter Buchegger b93ae774d1
Merge branch 'master' into platformio_dependabot/esp-logger/1.0.0 2023-01-21 12:50:15 +01:00
Peter Buchegger 48708ce3ea
Merge branch 'master' into platformio_dependabot/Adafruit_GFX_Library/1.11.5 2023-01-21 12:49:53 +01:00
Peter Buchegger 3c6e75c266
Merge branch 'master' into platformio_dependabot/LoRa/0.8.0 2023-01-21 12:48:54 +01:00
Peter Buchegger fc4ffc8561
Merge pull request #82 from lora-aprs/platformio_dependabot/Adafruit_SSD1306/2.5.7
Bump Adafruit SSD1306 to 2.5.7
2023-01-21 12:44:39 +01:00
Peter Buchegger 9e6bbcc286
Update platformio.ini 2023-01-21 12:43:09 +01:00
Tomáš Kukrál 01dd36946a add steps to install on linux
This may help some users to easily upload firmware to the board.
2023-01-20 22:31:31 +01:00
Peter Buchegger e1d965a0e9
Merge branch 'master' into platformio_dependabot/Adafruit_SSD1306/2.5.7 2023-01-20 17:20:38 +01:00
Peter Buchegger a5a3c6c88b
Merge branch 'master' into platformio_dependabot/esp-logger/1.0.0 2023-01-20 17:18:28 +01:00
Peter Buchegger 8e083cc9d0
Merge pull request #86 from lora-aprs/platformio_dependabot/AXP202X_Library/1.1.3
Bump AXP202X_Library to 1.1.3
2023-01-20 17:17:06 +01:00
Peter Buchegger d246fffe86
Merge branch 'master' into platformio_dependabot/AXP202X_Library/1.1.3 2023-01-20 17:15:23 +01:00
Peter Buchegger 0bac0c2d1d
Merge pull request #85 from lora-aprs/platformio_dependabot/TinyGPSPlus/1.0.3
Bump TinyGPSPlus to 1.0.3
2023-01-20 17:12:31 +01:00
Peter Buchegger 81d64326a3
Merge branch 'master' into platformio_dependabot/TinyGPSPlus/1.0.3 2023-01-20 17:10:52 +01:00
Peter Buchegger 9db47506d1
Merge pull request #77 from lora-aprs/platformio_dependabot/ArduinoJson/6.20.0
Bump ArduinoJson to 6.20.0
2023-01-20 17:02:02 +01:00
Peter Buchegger 049265f53b
Merge branch 'master' into platformio_dependabot/ArduinoJson/6.20.0 2023-01-20 17:00:14 +01:00
root 8cfd67a6ba Bump AXP202X_Library to 1.1.3 2023-01-20 15:56:56 +00:00
root ab3dbd44df Bump TinyGPSPlus to 1.0.3 2023-01-20 15:56:52 +00:00
root c520e2c841 Bump Adafruit GFX Library to 1.11.5 2023-01-20 15:56:49 +00:00
root b89010b422 Bump esp-logger to 1.0.0 2023-01-20 15:56:46 +00:00
root df63b8039b Bump Adafruit SSD1306 to 2.5.7 2023-01-20 15:56:39 +00:00
Peter Buchegger 7865cd570b
Merge pull request #81 from lora-aprs/peterus-patch-1
Update dependabot.yml
2023-01-20 16:37:31 +01:00
Peter Buchegger f70c67d456
Update dependabot.yml 2023-01-20 16:35:51 +01:00
Peter Buchegger 719cf1b5c2
Merge pull request #80 from lora-aprs/peterus-patch-1
Update dependabot.yml
2023-01-20 16:29:43 +01:00
Peter Buchegger a51e5de3cb
Update dependabot.yml 2023-01-20 16:27:49 +01:00
root a8f69daf87 Bump LoRa to 0.8.0 2023-01-20 14:35:41 +00:00
root 16beaadcec Bump espressif32 to 6.0.0 2023-01-20 14:09:05 +00:00
root 160c4882c0 Bump ArduinoJson to 6.20.0 2023-01-20 14:09:00 +00:00
Peter Buchegger 6a5e115754
Merge pull request #76 from lora-aprs/peterus-patch-1
Create dependabot.yml
2023-01-20 15:02:52 +01:00
Peter Buchegger 2b36c7bc01
Create dependabot.yml 2023-01-20 15:00:56 +01:00
Peter Buchegger 0d07288fb7
Merge pull request #71 from folkertvanheusden/master 2022-08-21 13:46:57 +02:00
folkert van heusden 3f6e01669e log GPS state (fix) 2022-08-21 13:41:23 +02:00
Peter Buchegger 780ad4ed6e
Merge pull request #66 from dahuafschmied/master
colon as time separator, more space between date and time
2022-07-06 11:34:33 +02:00
dahuafschmied 906b3d7c5c Update LoRa_APRS_Tracker.cpp 2022-07-03 15:22:14 +02:00
dahuafschmied 93d606fe0b colon as time separator, more space between date and time
for better readability
2022-06-30 23:34:22 +02:00
Peter Buchegger c78da085d5
Merge pull request #63 from lora-aprs/decoder-lib-update
update decoder lib
2022-05-25 22:28:10 +02:00
Peter Buchegger 241dda2898 update decoder lib 2022-05-13 21:46:38 +02:00
Peter Buchegger ea6ba8ca73
Merge pull request #62 from lora-aprs/sbias-master
Sbias master
2022-05-13 21:38:02 +02:00
Peter Buchegger c19402f967 Merge branch 'master' of https://github.com/sbias/LoRa_APRS_Tracker into sbias-master 2022-05-13 20:32:38 +02:00
Sascha Bias 5623096732 handle change-led in in process-loop 2021-09-11 11:52:16 +02:00
12 changed files with 413 additions and 105 deletions

View file

@ -12,7 +12,7 @@ AlignOperands: Align
AlignTrailingComments: true AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false
AllowShortEnumsOnASingleLine: false AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
@ -24,8 +24,8 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true BinPackArguments: false
BinPackParameters: true BinPackParameters: false
BraceWrapping: BraceWrapping:
AfterCaseLabel: false AfterCaseLabel: false
AfterClass: false AfterClass: false
@ -54,7 +54,7 @@ BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true BreakStringLiterals: true
ColumnLimit: 500 ColumnLimit: 200
CommentPragmas: '^ IWYU pragma:' CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerAllOnOneLineOrOnePerLine: false

View file

@ -8,6 +8,7 @@ on:
pull_request: pull_request:
branches: branches:
- master - master
merge_group:
jobs: jobs:
build: build:

19
.github/workflows/dependabot.yml vendored Normal file
View file

@ -0,0 +1,19 @@
name: PlatformIO Dependabot
on:
workflow_dispatch:
schedule:
# Runs every day at 00:00
- cron: '0 0 * * *'
jobs:
dependabot:
runs-on: ubuntu-latest
name: run PlatformIO Dependabot
steps:
- name: Checkout
uses: actions/checkout@v3
- name: run PlatformIO Dependabot
uses: peterus/platformio_dependabot@v1
with:
github_token: ${{ secrets.DEPENDABOT_PAT }}

View file

@ -1,3 +1,14 @@
# Status update September 2025
Over the past year, my focus has shifted to other projects, and Ive decided its time to close the chapter on this one. I will no longer provide updates or support, and the repository will be archived.
This project has been a fun journey, and Id like to thank everyone who used, contributed, or shared feedback along the way. Your interest and support kept it alive far longer than I originally expected.
If youre looking for a great alternative, I recommend [CA2RXU LoRa APRS Tracker/Station](https://github.com/richonguzman/LoRa_APRS_Tracker).
73,
OE5BPA
# LoRa APRS Tracker # LoRa APRS Tracker
The LoRa APRS Tracker will work with very cheep hardware which you can buy from amazon, ebay or aliexpress. The LoRa APRS Tracker will work with very cheep hardware which you can buy from amazon, ebay or aliexpress.
@ -10,7 +21,8 @@ Try it out and be part of the APRS network.
You can use one of the Lora32 boards: You can use one of the Lora32 boards:
* TTGO T-Beam V0.7 (433MHz SX1278) * TTGO T-Beam V0.7 (433MHz SX1278)
* TTGO T-Beam V1 (433MHz SX1278) * TTGO T-Beam V1.0 and V1.1 (433MHz SX1278)
* TTGO T-Beam V1.2 AXP2101 (433MHz SX1278)
This boards cost around 30 Euros, they are very cheap but perfect for an LoRa iGate. This boards cost around 30 Euros, they are very cheap but perfect for an LoRa iGate.
Keep in minde: you need a 433MHz version! Keep in minde: you need a 433MHz version!
@ -30,6 +42,7 @@ The best success is to use PlatformIO (and it is the only platform where I can s
* When installed click 'the ant head' on the left and choose import the project on the right. * When installed click 'the ant head' on the left and choose import the project on the right.
* Just open the folder and you can compile the Firmware. * Just open the folder and you can compile the Firmware.
### Configuration ### Configuration
* You can find all nessesary settings to change for your configuration in **data/tracker.json**. * You can find all nessesary settings to change for your configuration in **data/tracker.json**.
@ -37,6 +50,23 @@ The best success is to use PlatformIO (and it is the only platform where I can s
* To upload it to your board you have to do this via **Upload File System image** in PlatformIO! * To upload it to your board you have to do this via **Upload File System image** in PlatformIO!
* To find the 'Upload File System image' click the PlatformIO symbol (the little alien) on the left side, choos your configuration, click on 'Platform' and search for 'Upload File System image'. * To find the 'Upload File System image' click the PlatformIO symbol (the little alien) on the left side, choos your configuration, click on 'Platform' and search for 'Upload File System image'.
#### Step on console
You may not need to use PlatformIO because compilation and configuration can be done via console.
```
# switch to virtual env, for example using pipenv
pipenv shell
# install platformio
pipenv install platformio
# upload to board
pio run -t upload
```
## LoRa iGate ## LoRa iGate
Look at my other project: a [LoRa iGate](https://github.com/peterus/LoRa_APRS_iGate) Look at my other project: a [LoRa iGate](https://github.com/peterus/LoRa_APRS_iGate)

View file

@ -2,27 +2,31 @@
default_envs = ttgo-t-beam-v1 default_envs = ttgo-t-beam-v1
[env] [env]
platform = espressif32 @ 3.0.0 platform = espressif32 @ 6.7.0
framework = arduino framework = arduino
lib_ldf_mode = deep+ lib_ldf_mode = deep+
monitor_speed = 115200 monitor_speed = 115200
monitor_filters = esp32_exception_decoder monitor_filters = esp32_exception_decoder
lib_deps = lib_deps =
adafruit/Adafruit GFX Library @ 1.7.5 adafruit/Adafruit GFX Library @ 1.11.9
adafruit/Adafruit SSD1306 @ 2.4.0 adafruit/Adafruit SSD1306 @ 2.5.10
bblanchon/ArduinoJson @ 6.17.0 bblanchon/ArduinoJson @ 7.0.4
lewisxhe/AXP202X_Library @ 1.1.2 lewisxhe/XPowersLib @ 0.2.4
sandeepmistry/LoRa @ 0.7.2 sandeepmistry/LoRa @ 0.8.0
peterus/APRS-Decoder-Lib @ 0.0.5 peterus/APRS-Decoder-Lib @ 0.0.6
mikalhart/TinyGPSPlus @ 1.0.2 mikalhart/TinyGPSPlus @ 1.1.0
paulstoffregen/Time @ 1.6 paulstoffregen/Time @ 1.6
shaggydog/OneButton @ 1.5.0 shaggydog/OneButton @ 1.5.0
peterus/esp-logger @ 0.0.1 peterus/esp-logger @ 1.0.0
check_tool = cppcheck check_tool = cppcheck
check_flags = check_flags =
cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK
check_skip_packages = yes check_skip_packages = yes
[env:ttgo-t-beam-AXP2101-v1_2]
board = ttgo-t-beam
build_flags = -Werror -Wall -DTTGO_T_Beam_V1_2
[env:ttgo-t-beam-v1] [env:ttgo-t-beam-v1]
board = ttgo-t-beam board = ttgo-t-beam
build_flags = -Werror -Wall -DTTGO_T_Beam_V1_0 build_flags = -Werror -Wall -DTTGO_T_Beam_V1_0

View file

@ -13,12 +13,21 @@
#include "pins.h" #include "pins.h"
#include "power_management.h" #include "power_management.h"
#define VERSION "22.19.0" #define VERSION "23.36.01"
logging::Logger logger;
Configuration Config; Configuration Config;
BeaconManager BeaconMan; BeaconManager BeaconMan;
PowerManagement powerManagement; #ifdef TTGO_T_Beam_V1_0
AXP192 axp;
PowerManagement *powerManagement = &axp;
#endif
#ifdef TTGO_T_Beam_V1_2
AXP2101 axp;
PowerManagement *powerManagement = &axp;
#endif
OneButton userButton = OneButton(BUTTON_PIN, true, true); OneButton userButton = OneButton(BUTTON_PIN, true, true);
HardwareSerial ss(1); HardwareSerial ss(1);
@ -62,22 +71,22 @@ static void toggle_display() {
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2)
Wire.begin(SDA, SCL); Wire.begin(SDA, SCL);
if (!powerManagement.begin(Wire)) { if (powerManagement->begin(Wire)) {
logPrintlnI("AXP192 init done!"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "PMU", "init done!");
} else { } else {
logPrintlnE("AXP192 init failed!"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "PMU", "init failed!");
} }
powerManagement.activateLoRa(); powerManagement->activateLoRa();
powerManagement.activateOLED(); powerManagement->activateOLED();
powerManagement.activateGPS(); powerManagement->activateGPS();
powerManagement.activateMeasurement(); powerManagement->activateMeasurement();
#endif #endif
delay(500); delay(500);
logPrintlnI("LoRa APRS Tracker by OE5BPA (Peter Buchegger)"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "LoRa APRS Tracker by OE5BPA (Peter Buchegger)");
logPrintlnI("Version: " VERSION); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Version: " VERSION);
setup_display(); setup_display();
show_display("OE5BPA", "LoRa APRS Tracker", "by Peter Buchegger", "Version: " VERSION, 2000); show_display("OE5BPA", "LoRa APRS Tracker", "by Peter Buchegger", "Version: " VERSION, 2000);
@ -105,9 +114,9 @@ void setup() {
} }
userButton.attachDoubleClick(toggle_display); userButton.attachDoubleClick(toggle_display);
logPrintlnI("Smart Beacon is " + getSmartBeaconState()); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Smart Beacon is: %s", getSmartBeaconState());
show_display("INFO", "Smart Beacon is " + getSmartBeaconState(), 1000); show_display("INFO", "Smart Beacon is " + getSmartBeaconState(), 1000);
logPrintlnI("setup done..."); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "setup done...");
delay(500); delay(500);
} }
@ -131,8 +140,19 @@ void loop() {
bool gps_time_update = gps.time.isUpdated(); bool gps_time_update = gps.time.isUpdated();
bool gps_loc_update = gps.location.isUpdated(); bool gps_loc_update = gps.location.isUpdated();
static bool gps_loc_update_valid = false;
static time_t nextBeaconTimeStamp = -1; static time_t nextBeaconTimeStamp = -1;
if (gps_loc_update != gps_loc_update_valid) {
gps_loc_update_valid = gps_loc_update;
if (gps_loc_update) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Loop", "GPS fix state went to VALID");
} else {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Loop", "GPS fix state went to INVALID");
}
}
static double currentHeading = 0; static double currentHeading = 0;
static double previousHeading = 0; static double previousHeading = 0;
static unsigned int rate_limit_message_text = 0; static unsigned int rate_limit_message_text = 0;
@ -165,13 +185,14 @@ void loop() {
static bool BatteryIsConnected = false; static bool BatteryIsConnected = false;
static String batteryVoltage = ""; static String batteryVoltage = "";
static String batteryChargeCurrent = ""; static String batteryChargeCurrent = "";
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2)
static unsigned int rate_limit_check_battery = 0; static unsigned int rate_limit_check_battery = 0;
if (!(rate_limit_check_battery++ % 60)) if (!(rate_limit_check_battery++ % 60)) {
BatteryIsConnected = powerManagement.isBatteryConnect(); BatteryIsConnected = powerManagement->isBatteryConnect();
}
if (BatteryIsConnected) { if (BatteryIsConnected) {
batteryVoltage = String(powerManagement.getBatteryVoltage(), 2); batteryVoltage = String(powerManagement->getBatteryVoltage(), 2);
batteryChargeCurrent = String(powerManagement.getBatteryChargeDischargeCurrent(), 0); batteryChargeCurrent = String(powerManagement->getBatteryChargeDischargeCurrent(), 0);
} }
#endif #endif
@ -203,7 +224,8 @@ void loop() {
if (send_update && gps_loc_update) { if (send_update && gps_loc_update) {
send_update = false; send_update = false;
nextBeaconTimeStamp = now() + (BeaconMan.getCurrentBeaconConfig()->smart_beacon.active ? BeaconMan.getCurrentBeaconConfig()->smart_beacon.slow_rate : (BeaconMan.getCurrentBeaconConfig()->timeout * SECS_PER_MIN)); nextBeaconTimeStamp =
now() + (BeaconMan.getCurrentBeaconConfig()->smart_beacon.active ? BeaconMan.getCurrentBeaconConfig()->smart_beacon.slow_rate : (BeaconMan.getCurrentBeaconConfig()->timeout * SECS_PER_MIN));
APRSMessage msg; APRSMessage msg;
String lat; String lat;
@ -267,16 +289,19 @@ void loop() {
aprsmsg += BeaconMan.getCurrentBeaconConfig()->message; aprsmsg += BeaconMan.getCurrentBeaconConfig()->message;
} }
if (BatteryIsConnected) { if (BatteryIsConnected) {
aprsmsg += " - _Bat.: " + batteryVoltage + "V - Cur.: " + batteryChargeCurrent + "mA"; aprsmsg += " - Bat.: " + batteryVoltage + "V";
#ifdef TTGO_T_Beam_V1_0
aprsmsg += " - Cur.: " + batteryChargeCurrent + "mA";
#endif
} }
if (BeaconMan.getCurrentBeaconConfig()->enhance_precision) { if (BeaconMan.getCurrentBeaconConfig()->enhance_precision) {
aprsmsg += " " + dao; aprsmsg += " " + dao;
} }
msg.getAPRSBody()->setData(aprsmsg); msg.getBody()->setData(aprsmsg);
String data = msg.encode(); String data = msg.encode();
logPrintlnD(data); logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, "Loop", "%s", data.c_str());
show_display("<< TX >>", data); show_display("<< TX >>", data);
if (Config.ptt.active) { if (Config.ptt.active) {
@ -309,7 +334,20 @@ void loop() {
if (gps_time_update) { if (gps_time_update) {
show_display(BeaconMan.getCurrentBeaconConfig()->callsign, createDateString(now()) + " " + createTimeString(now()), String("Sats: ") + gps.satellites.value() + " HDOP: " + gps.hdop.hdop(), String("Nxt Bcn: ") + (BeaconMan.getCurrentBeaconConfig()->smart_beacon.active ? "~" : "") + createTimeString(nextBeaconTimeStamp), BatteryIsConnected ? (String("Bat: ") + batteryVoltage + "V, " + batteryChargeCurrent + "mA") : "Powered via USB", String("Smart Beacon: " + getSmartBeaconState())); show_display(BeaconMan.getCurrentBeaconConfig()->callsign,
createDateString(now()) + " " + createTimeString(now()),
String("Sats: ") + gps.satellites.value() + " HDOP: " + gps.hdop.hdop(),
String("Next Bcn: ") + (BeaconMan.getCurrentBeaconConfig()->smart_beacon.active ? "~" : "") + createTimeString(nextBeaconTimeStamp),
BatteryIsConnected ? (String("Bat: ") + batteryVoltage + "V, " + batteryChargeCurrent + "mA") : "Powered via USB",
String("Smart Beacon: " + getSmartBeaconState()));
Serial.println(BeaconMan.getCurrentBeaconConfig()->callsign);
Serial.println(createDateString(now()) + " " + createTimeString(now()));
Serial.println(String("Sats: ") + gps.satellites.value() + " HDOP: " + gps.hdop.hdop());
Serial.println(String("Next Bcn: ") + (BeaconMan.getCurrentBeaconConfig()->smart_beacon.active ? "~" : "") + createTimeString(nextBeaconTimeStamp));
Serial.println(BatteryIsConnected ? (String("Bat: ") + batteryVoltage + "V, " + batteryChargeCurrent + "mA") : "Powered via USB");
Serial.println(String("Smart Beacon: " + getSmartBeaconState()));
Serial.println();
if (BeaconMan.getCurrentBeaconConfig()->smart_beacon.active) { if (BeaconMan.getCurrentBeaconConfig()->smart_beacon.active) {
// Change the Tx internal based on the current speed // Change the Tx internal based on the current speed
@ -329,13 +367,20 @@ void loop() {
would lead to decrease of beacon rate in between 5 to 20 km/h. what would lead to decrease of beacon rate in between 5 to 20 km/h. what
is even below the slow speed rate. is even below the slow speed rate.
*/ */
txInterval = min(BeaconMan.getCurrentBeaconConfig()->smart_beacon.slow_rate, BeaconMan.getCurrentBeaconConfig()->smart_beacon.fast_speed * BeaconMan.getCurrentBeaconConfig()->smart_beacon.fast_rate / curr_speed) * 1000; if (curr_speed == 0) {
curr_speed = 1;
}
txInterval = min(BeaconMan.getCurrentBeaconConfig()->smart_beacon.slow_rate,
BeaconMan.getCurrentBeaconConfig()->smart_beacon.fast_speed * BeaconMan.getCurrentBeaconConfig()->smart_beacon.fast_rate / curr_speed) *
1000;
} }
} }
} }
if ((Config.debug == false) && (millis() > 5000 && gps.charsProcessed() < 10)) { if ((Config.debug == false) && (millis() > 5000 && gps.charsProcessed() < 10)) {
logPrintlnE("No GPS frames detected! Try to reset the GPS Chip with this " logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR,
"GPS",
"No GPS frames detected! Try to reset the GPS Chip with this "
"firmware: https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset"); "firmware: https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset");
show_display("No GPS frames detected!", "Try to reset the GPS Chip", "https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset", 2000); show_display("No GPS frames detected!", "Try to reset the GPS Chip", "https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset", 2000);
} }
@ -345,10 +390,13 @@ void load_config() {
ConfigurationManagement confmg("/tracker.json"); ConfigurationManagement confmg("/tracker.json");
Config = confmg.readConfiguration(); Config = confmg.readConfiguration();
BeaconMan.loadConfig(Config.beacons); BeaconMan.loadConfig(Config.beacons);
if (BeaconMan.getCurrentBeaconConfig()->callsign == "NOCALL-10") { if (BeaconMan.getCurrentBeaconConfig()->callsign == "NOCALL-7") {
logPrintlnE("You have to change your settings in 'data/tracker.json' and " logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR,
"Config",
"You have to change your settings in 'data/tracker.json' and "
"upload it via \"Upload File System image\"!"); "upload it via \"Upload File System image\"!");
show_display("ERROR", "You have to change your settings in 'data/tracker.json' and " show_display("ERROR",
"You have to change your settings in 'data/tracker.json' and "
"upload it via \"Upload File System image\"!"); "upload it via \"Upload File System image\"!");
while (true) { while (true) {
} }
@ -356,16 +404,15 @@ void load_config() {
} }
void setup_lora() { void setup_lora() {
logPrintlnI("Set SPI pins!"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "Set SPI pins!");
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
logPrintlnI("Set LoRa pins!"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "Set LoRa pins!");
LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ); LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ);
long freq = Config.lora.frequencyTx; long freq = Config.lora.frequencyTx;
logPrintI("frequency: "); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "frequency: %d", freq);
logPrintlnI(String(freq));
if (!LoRa.begin(freq)) { if (!LoRa.begin(freq)) {
logPrintlnE("Starting LoRa failed!"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "LoRa", "Starting LoRa failed!");
show_display("ERROR", "Starting LoRa failed!"); show_display("ERROR", "Starting LoRa failed!");
while (true) { while (true) {
} }
@ -376,7 +423,7 @@ void setup_lora() {
LoRa.enableCrc(); LoRa.enableCrc();
LoRa.setTxPower(Config.lora.power); LoRa.setTxPower(Config.lora.power);
logPrintlnI("LoRa init done!"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "LoRa init done!");
show_display("INFO", "LoRa init done!", 2000); show_display("INFO", "LoRa init done!", 2000);
} }
@ -486,7 +533,7 @@ String createDateString(time_t t) {
} }
String createTimeString(time_t t) { String createTimeString(time_t t) {
return String(padding(hour(t), 2) + "." + padding(minute(t), 2) + "." + padding(second(t), 2)); return String(padding(hour(t), 2) + ":" + padding(minute(t), 2) + ":" + padding(second(t), 2));
} }
String getSmartBeaconState() { String getSmartBeaconState() {

View file

@ -7,12 +7,14 @@
#include "configuration.h" #include "configuration.h"
extern logging::Logger logger;
ConfigurationManagement::ConfigurationManagement(String FilePath) : mFilePath(FilePath) { ConfigurationManagement::ConfigurationManagement(String FilePath) : mFilePath(FilePath) {
if (!SPIFFS.begin(true)) { if (!SPIFFS.begin(true)) {
logPrintlnE("Mounting SPIFFS was not possible. Trying to format SPIFFS..."); logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Configuration", "Mounting SPIFFS was not possible. Trying to format SPIFFS...");
SPIFFS.format(); SPIFFS.format();
if (!SPIFFS.begin()) { if (!SPIFFS.begin()) {
logPrintlnE("Formating SPIFFS was not okay!"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Configuration", "Formatting SPIFFS was not okay!");
} }
} }
} }
@ -21,14 +23,14 @@ ConfigurationManagement::ConfigurationManagement(String FilePath) : mFilePath(Fi
Configuration ConfigurationManagement::readConfiguration() { Configuration ConfigurationManagement::readConfiguration() {
File file = SPIFFS.open(mFilePath); File file = SPIFFS.open(mFilePath);
if (!file) { if (!file) {
logPrintlnE("Failed to open file for reading..."); logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Configuration", "Failed to open file for reading...");
return Configuration(); return Configuration();
} }
DynamicJsonDocument data(2048); DynamicJsonDocument data(2048);
DeserializationError error = deserializeJson(data, file); DeserializationError error = deserializeJson(data, file);
if (error) { if (error) {
logPrintlnE("Failed to read file, using default configuration."); logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Configuration", "Failed to read file, using default configuration.");
} }
file.close(); file.close();
@ -89,7 +91,7 @@ Configuration ConfigurationManagement::readConfiguration() {
void ConfigurationManagement::writeConfiguration(Configuration conf) { void ConfigurationManagement::writeConfiguration(Configuration conf) {
File file = SPIFFS.open(mFilePath, "w"); File file = SPIFFS.open(mFilePath, "w");
if (!file) { if (!file) {
logPrintlnE("Failed to open file for writing..."); logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Configuration", "Failed to open file for writing...");
return; return;
} }
DynamicJsonDocument data(2048); DynamicJsonDocument data(2048);

View file

@ -7,6 +7,8 @@
#include "display.h" #include "display.h"
#include "pins.h" #include "pins.h"
extern logging::Logger logger;
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST); Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST);
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
@ -18,7 +20,7 @@ void setup_display() {
Wire.begin(OLED_SDA, OLED_SCL); Wire.begin(OLED_SDA, OLED_SCL);
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) {
logPrintlnE("SSD1306 allocation failed"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "SSD1306", "allocation failed!");
while (true) { while (true) {
} }
} }
@ -35,12 +37,9 @@ void setup_display() {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void display_toggle(bool toggle) { void display_toggle(bool toggle) {
logPrintI("Toggling display: ");
if (toggle) { if (toggle) {
logPrintlnI("On");
display.ssd1306_command(SSD1306_DISPLAYON); display.ssd1306_command(SSD1306_DISPLAYON);
} else { } else {
logPrintlnI("Off");
display.ssd1306_command(SSD1306_DISPLAYOFF); display.ssd1306_command(SSD1306_DISPLAYOFF);
} }
} }

View file

@ -16,7 +16,7 @@
#define GPS_TX 12 #define GPS_TX 12
#endif #endif
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2)
#define GPS_RX 12 #define GPS_RX 12
#define GPS_TX 34 #define GPS_TX 34
#endif #endif

View file

@ -1,72 +1,218 @@
#include <XPowersAXP192.tpp>
#include <XPowersAXP2101.tpp>
#include "power_management.h" #include "power_management.h"
// cppcheck-suppress uninitMemberVar AXP192::AXP192() {
PowerManagement::PowerManagement() {
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
bool PowerManagement::begin(TwoWire &port) { bool AXP192::begin(TwoWire &port) {
bool result = axp.begin(port, AXP192_SLAVE_ADDRESS); _pmu = new XPowersAXP192(port);
if (!result) { if (!_pmu->init()) {
axp.setDCDC1Voltage(3300); delete _pmu;
_pmu = 0;
return false;
} }
return result;
// lora radio power channel
_pmu->setPowerChannelVoltage(XPOWERS_LDO2, 3300);
// oled module power channel,
// disable it will cause abnormal communication between boot and AXP power supply,
// do not turn it off
_pmu->setPowerChannelVoltage(XPOWERS_DCDC1, 3300);
// gnss module power channel - now turned on in setGpsPower
_pmu->setPowerChannelVoltage(XPOWERS_LDO3, 3300);
// protected oled power source
//_pmu->setProtectedChannel(XPOWERS_DCDC1);
// protected esp32 power source
_pmu->setProtectedChannel(XPOWERS_DCDC3);
// disable not use channel
_pmu->disablePowerOutput(XPOWERS_DCDC2);
// disable all axp chip interrupt
_pmu->disableIRQ(XPOWERS_AXP192_ALL_IRQ);
// Set constant current charging current
_pmu->setChargerConstantCurr(XPOWERS_AXP192_CHG_CUR_780MA);
// Set up the charging voltage
_pmu->setChargeTargetVoltage(XPOWERS_AXP192_CHG_VOL_4V2);
_pmu->setChargingLedMode(XPOWERS_CHG_LED_CTRL_CHG);
return true;
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::activateLoRa() { void AXP192::activateLoRa() {
axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); _pmu->enablePowerOutput(XPOWERS_LDO2);
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::deactivateLoRa() { void AXP192::deactivateLoRa() {
axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF); _pmu->disablePowerOutput(XPOWERS_LDO2);
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::activateGPS() { void AXP192::activateGPS() {
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); _pmu->enablePowerOutput(XPOWERS_LDO3);
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::deactivateGPS() { void AXP192::deactivateGPS() {
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF); _pmu->disablePowerOutput(XPOWERS_LDO3);
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::activateOLED() { void AXP192::activateOLED() {
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); _pmu->enablePowerOutput(XPOWERS_DCDC1);
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::decativateOLED() { void AXP192::deactivateOLED() {
axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF); _pmu->disablePowerOutput(XPOWERS_DCDC1);
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::activateMeasurement() { void AXP192::activateMeasurement() {
axp.adc1Enable(AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, true); _pmu->enableBattVoltageMeasure();
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::deactivateMeasurement() { void AXP192::deactivateMeasurement() {
axp.adc1Enable(AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, false); _pmu->disableBattVoltageMeasure();
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
double PowerManagement::getBatteryVoltage() { double AXP192::getBatteryVoltage() {
return axp.getBattVoltage() / 1000.0; return _pmu->getBattVoltage() / 1000.0;
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
double PowerManagement::getBatteryChargeDischargeCurrent() { double AXP192::getBatteryChargeDischargeCurrent() {
if (axp.isChargeing()) { if (isCharging()) {
return axp.getBattChargeCurrent(); return ((XPowersAXP192 *)_pmu)->getBatteryChargeCurrent();
} }
return -1.0 * axp.getBattDischargeCurrent(); return -1.0 * ((XPowersAXP192 *)_pmu)->getBattDischargeCurrent();
} }
bool PowerManagement::isBatteryConnect() { bool AXP192::isBatteryConnect() {
return axp.isBatteryConnect(); return _pmu->isBatteryConnect();
}
bool AXP192::isCharging() {
return _pmu->isCharging();
}
AXP2101::AXP2101() {
}
// cppcheck-suppress unusedFunction
bool AXP2101::begin(TwoWire &port) {
_pmu = new XPowersAXP2101(port);
if (!_pmu->init()) {
delete _pmu;
_pmu = 0;
return false;
}
// Unuse power channel
_pmu->disablePowerOutput(XPOWERS_DCDC2);
_pmu->disablePowerOutput(XPOWERS_DCDC3);
_pmu->disablePowerOutput(XPOWERS_DCDC4);
_pmu->disablePowerOutput(XPOWERS_DCDC5);
_pmu->disablePowerOutput(XPOWERS_ALDO1);
_pmu->disablePowerOutput(XPOWERS_ALDO4);
_pmu->disablePowerOutput(XPOWERS_BLDO1);
_pmu->disablePowerOutput(XPOWERS_BLDO2);
_pmu->disablePowerOutput(XPOWERS_DLDO1);
_pmu->disablePowerOutput(XPOWERS_DLDO2);
// GNSS RTC PowerVDD 3300mV
_pmu->setPowerChannelVoltage(XPOWERS_VBACKUP, 3300);
_pmu->enablePowerOutput(XPOWERS_VBACKUP);
// LoRa VDD 3300mV
_pmu->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
_pmu->enablePowerOutput(XPOWERS_ALDO2);
// GNSS VDD 3300mV
_pmu->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
_pmu->enablePowerOutput(XPOWERS_ALDO3);
// disable all axp chip interrupt
_pmu->disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
// Set constant current charging current
_pmu->setChargerConstantCurr(XPOWERS_AXP2101_CHG_CUR_800MA);
// Set up the charging voltage
_pmu->setChargeTargetVoltage(XPOWERS_AXP2101_CHG_VOL_4V2);
_pmu->setChargingLedMode(XPOWERS_CHG_LED_CTRL_CHG);
return true;
}
// cppcheck-suppress unusedFunction
void AXP2101::activateLoRa() {
_pmu->enablePowerOutput(XPOWERS_ALDO2);
}
// cppcheck-suppress unusedFunction
void AXP2101::deactivateLoRa() {
_pmu->disablePowerOutput(XPOWERS_ALDO2);
}
// cppcheck-suppress unusedFunction
void AXP2101::activateGPS() {
_pmu->enablePowerOutput(XPOWERS_ALDO3);
}
// cppcheck-suppress unusedFunction
void AXP2101::deactivateGPS() {
_pmu->disablePowerOutput(XPOWERS_ALDO3);
}
// cppcheck-suppress unusedFunction
void AXP2101::activateOLED() {
_pmu->enablePowerOutput(XPOWERS_DCDC1);
}
// cppcheck-suppress unusedFunction
void AXP2101::deactivateOLED() {
_pmu->disablePowerOutput(XPOWERS_DCDC1);
}
// cppcheck-suppress unusedFunction
void AXP2101::activateMeasurement() {
_pmu->enableBattVoltageMeasure();
}
// cppcheck-suppress unusedFunction
void AXP2101::deactivateMeasurement() {
_pmu->disableBattVoltageMeasure();
}
// cppcheck-suppress unusedFunction
double AXP2101::getBatteryVoltage() {
return _pmu->getBattVoltage() / 1000.0;
}
// cppcheck-suppress unusedFunction
double AXP2101::getBatteryChargeDischargeCurrent() {
return 0.0;
}
bool AXP2101::isBatteryConnect() {
return _pmu->isBatteryConnect();
}
bool AXP2101::isCharging() {
return _pmu->isCharging();
} }

View file

@ -1,12 +1,43 @@
#ifndef POWER_MANAGEMENT_H_ #ifndef POWER_MANAGEMENT_H_
#define POWER_MANAGEMENT_H_ #define POWER_MANAGEMENT_H_
#include <Arduino.h> #include <Wire.h>
#include <axp20x.h> #include <XPowersLibInterface.hpp>
class PowerManagement { class PowerManagement {
public: public:
PowerManagement(); ~PowerManagement() {
}
virtual bool begin(TwoWire &port) = 0;
virtual void activateLoRa() = 0;
virtual void deactivateLoRa() = 0;
virtual void activateGPS() = 0;
virtual void deactivateGPS() = 0;
virtual void activateOLED() = 0;
virtual void deactivateOLED() = 0;
virtual void activateMeasurement() = 0;
virtual void deactivateMeasurement() = 0;
virtual double getBatteryVoltage() = 0;
virtual double getBatteryChargeDischargeCurrent() = 0;
virtual bool isBatteryConnect() = 0;
virtual bool isCharging() = 0;
protected:
XPowersLibInterface *_pmu = 0;
};
class AXP192 : public PowerManagement {
public:
AXP192();
bool begin(TwoWire &port); bool begin(TwoWire &port);
void activateLoRa(); void activateLoRa();
@ -16,7 +47,10 @@ public:
void deactivateGPS(); void deactivateGPS();
void activateOLED(); void activateOLED();
void decativateOLED(); void deactivateOLED();
void enableChgLed();
void disableChgLed();
void activateMeasurement(); void activateMeasurement();
void deactivateMeasurement(); void deactivateMeasurement();
@ -25,9 +59,35 @@ public:
double getBatteryChargeDischargeCurrent(); double getBatteryChargeDischargeCurrent();
bool isBatteryConnect(); bool isBatteryConnect();
bool isCharging();
};
private: class AXP2101 : public PowerManagement {
AXP20X_Class axp; public:
AXP2101();
bool begin(TwoWire &port);
void activateLoRa();
void deactivateLoRa();
void activateGPS();
void deactivateGPS();
void activateOLED();
void deactivateOLED();
void enableChgLed();
void disableChgLed();
void activateMeasurement();
void deactivateMeasurement();
double getBatteryVoltage();
double getBatteryChargeDischargeCurrent();
bool isBatteryConnect();
bool isCharging();
}; };
#endif #endif