kopia lustrzana https://github.com/lora-aprs/LoRa_APRS_iGate
Merge e6e946dc37
into 696db24838
commit
4edd06529c
|
@ -7,6 +7,9 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Compile Firmware
|
name: Compile Firmware
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
boards: [heltec-v1, tlora-v1, tbeam, t_internet_poe, heltec-v3, tlora-v2, heltec-v2_0, tbeam-s3-core, tbeam_axp2101]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
|
@ -27,12 +30,12 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Build PlatformIO Project
|
- name: Build PlatformIO Project
|
||||||
run: pio run
|
run: pio run -e ${{ matrix.boards }}
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: firmware
|
name: firmware
|
||||||
path: .pio/build/lora_board/firmware.bin
|
path: .pio/build/**/firmware.bin
|
||||||
|
|
||||||
formatting-check:
|
formatting-check:
|
||||||
name: Formatting Check
|
name: Formatting Check
|
||||||
|
@ -68,7 +71,7 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Run PlatformIO Check
|
- name: Run PlatformIO Check
|
||||||
run: pio check --fail-on-defect high --fail-on-defect medium --fail-on-defect low -e lora_board
|
run: pio check --fail-on-defect high --fail-on-defect medium --fail-on-defect low
|
||||||
|
|
||||||
cppcheck-docker:
|
cppcheck-docker:
|
||||||
name: Run cppcheck in Docker
|
name: Run cppcheck in Docker
|
||||||
|
@ -89,14 +92,14 @@ jobs:
|
||||||
name: Cppcheck Report
|
name: Cppcheck Report
|
||||||
path: output
|
path: output
|
||||||
|
|
||||||
hw_testing:
|
# hw_testing:
|
||||||
name: Hardware Testing
|
# name: Hardware Testing
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
steps:
|
# steps:
|
||||||
- uses: convictional/trigger-workflow-and-wait@v1.6.5
|
# - uses: convictional/trigger-workflow-and-wait@v1.6.5
|
||||||
with:
|
# with:
|
||||||
owner: peterus
|
# owner: peterus
|
||||||
repo: ESP-Boards
|
# repo: ESP-Boards
|
||||||
github_token: ${{ secrets.PAT }}
|
# github_token: ${{ secrets.PAT }}
|
||||||
workflow_file_name: lora_aprs_igate.yml
|
# workflow_file_name: lora_aprs_igate.yml
|
||||||
github_user: peterus
|
# github_user: peterus
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
"streambuf": "cpp",
|
"streambuf": "cpp",
|
||||||
"cinttypes": "cpp",
|
"cinttypes": "cpp",
|
||||||
"utility": "cpp",
|
"utility": "cpp",
|
||||||
"typeinfo": "cpp"
|
"typeinfo": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"string_view": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
; Common settings for ESP targes, mixin with extends = esp32_base
|
||||||
|
[esp32_base]
|
||||||
|
extends = arduino_base
|
||||||
|
platform = platformio/espressif32 @ 6.3.2
|
||||||
|
|
||||||
|
build_src_filter =
|
||||||
|
${arduino_base.build_src_filter}
|
||||||
|
|
||||||
|
upload_speed = 921600
|
||||||
|
monitor_filters = esp32_exception_decoder
|
||||||
|
|
||||||
|
;board_build.filesystem = littlefs
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
${arduino_base.build_flags}
|
||||||
|
-Wall
|
||||||
|
; -Wextra
|
||||||
|
-Isrc/platform/esp32
|
||||||
|
-std=c++2a
|
||||||
|
-DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
|
||||||
|
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||||
|
-DAXP_DEBUG_PORT=Serial
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${arduino_base.lib_deps}
|
|
@ -0,0 +1,2 @@
|
||||||
|
[esp32s3_base]
|
||||||
|
extends = esp32_base
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "esp32s3_out.ld"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": [
|
||||||
|
"-DBOARD_HAS_PSRAM",
|
||||||
|
"-DLILYGO_TBEAM_S3_CORE",
|
||||||
|
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||||
|
"-DARDUINO_RUNNING_CORE=1",
|
||||||
|
"-DARDUINO_EVENT_RUNNING_CORE=1"
|
||||||
|
],
|
||||||
|
"f_cpu": "240000000L",
|
||||||
|
"f_flash": "80000000L",
|
||||||
|
"flash_mode": "qio",
|
||||||
|
"hwids": [
|
||||||
|
[
|
||||||
|
"0X303A",
|
||||||
|
"0x1001"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "tbeam-s3-core"
|
||||||
|
},
|
||||||
|
"connectivity": [
|
||||||
|
"wifi"
|
||||||
|
],
|
||||||
|
"debug": {
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"arduino"
|
||||||
|
],
|
||||||
|
"name": "LilyGo TBeam-S3-Core",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "8MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 8388608,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"url": "http://www.lilygo.cn/",
|
||||||
|
"vendor": "LilyGo"
|
||||||
|
}
|
|
@ -9,17 +9,50 @@
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = lora_board
|
;default_envs = tbeam
|
||||||
|
;default_envs = tbeam-s3-core
|
||||||
|
;default_envs = heltec-v1
|
||||||
|
;default_envs = heltec-v2_0
|
||||||
|
;default_envs = heltec-v2_1
|
||||||
|
;default_envs = tlora-v1
|
||||||
|
;default_envs = tlora_v1_3
|
||||||
|
;default_envs = tlora-v2
|
||||||
|
;default_envs = tlora-v2-1-1_6
|
||||||
|
|
||||||
|
extra_configs =
|
||||||
|
arch/*/*.ini
|
||||||
|
variants/*/platformio.ini
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
platform = espressif32 @ 6.4.0
|
;extra_scripts = bin/platformio-custom.py
|
||||||
framework = arduino
|
|
||||||
lib_ldf_mode = deep+
|
build_flags =
|
||||||
|
-Wl,-Map,.pio/build/output.map
|
||||||
|
-DRADIOLIB_EXCLUDE_CC1101
|
||||||
|
-DRADIOLIB_EXCLUDE_NRF24
|
||||||
|
-DRADIOLIB_EXCLUDE_RF69
|
||||||
|
-DRADIOLIB_EXCLUDE_SX1231
|
||||||
|
-DRADIOLIB_EXCLUDE_SI443X
|
||||||
|
-DRADIOLIB_EXCLUDE_RFM2X
|
||||||
|
-DRADIOLIB_EXCLUDE_RFM9X
|
||||||
|
-DRADIOLIB_EXCLUDE_SX128X
|
||||||
|
-DRADIOLIB_EXCLUDE_AFSK
|
||||||
|
-DRADIOLIB_EXCLUDE_AX25
|
||||||
|
-DRADIOLIB_EXCLUDE_HELLSCHREIBER
|
||||||
|
-DRADIOLIB_EXCLUDE_MORSE
|
||||||
|
-DRADIOLIB_EXCLUDE_RTTY
|
||||||
|
-DRADIOLIB_EXCLUDE_SSTV
|
||||||
|
-DRADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||||
|
-DRADIOLIB_EXCLUDE_BELL
|
||||||
|
-DRADIOLIB_EXCLUDE_PAGER
|
||||||
|
-DRADIOLIB_EXCLUDE_FSK4
|
||||||
|
-DRADIOLIB_EXCLUDE_APRS
|
||||||
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_raw = yes
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
bblanchon/ArduinoJson @ 6.21.4
|
bblanchon/ArduinoJson @ 6.21.4
|
||||||
lewisxhe/AXP202X_Library @ 1.1.3
|
lewisxhe/XPowersLib @ 0.1.8
|
||||||
peterus/APRS-Decoder-Lib @ 0.0.6
|
peterus/APRS-Decoder-Lib @ 0.0.6
|
||||||
peterus/esp-logger @ 1.0.0
|
peterus/esp-logger @ 1.0.0
|
||||||
peterus/ESP-FTP-Server-Lib @ 0.14.1
|
peterus/ESP-FTP-Server-Lib @ 0.14.1
|
||||||
|
@ -27,23 +60,20 @@ lib_deps =
|
||||||
mikalhart/TinyGPSPlus @ 1.0.3
|
mikalhart/TinyGPSPlus @ 1.0.3
|
||||||
shaggydog/OneButton @ 1.5.0
|
shaggydog/OneButton @ 1.5.0
|
||||||
jgromes/RadioLib @ 6.3.0
|
jgromes/RadioLib @ 6.3.0
|
||||||
|
|
||||||
check_tool = cppcheck
|
check_tool = cppcheck
|
||||||
check_flags = cppcheck: --std=c++20 --suppress=*:*.pio\* --inline-suppr --suppress=unusedFunction --suppress=shadowFunction:*TimeLib.cpp --suppress=unreadVariable:*TimeLib.cpp --suppress=badBitmaskCheck:*project_configuration.cpp
|
|
||||||
check_skip_packages = yes
|
check_skip_packages = yes
|
||||||
|
check_flags =
|
||||||
|
--suppressions-list=suppressions.txt
|
||||||
|
--inline-suppr
|
||||||
|
|
||||||
test_build_src = yes
|
test_build_src = yes
|
||||||
# activate for OTA Update, use the CALLSIGN from is-cfg.json as upload_port:
|
|
||||||
#upload_protocol = espota
|
|
||||||
#upload_port = <CALLSIGN>.local
|
|
||||||
|
|
||||||
[env:lora_board]
|
[arduino_base]
|
||||||
board = esp32doit-devkit-v1
|
framework = arduino
|
||||||
build_flags = -Werror -Wall -DUNITY_INCLUDE_PRINT_FORMATTED
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
|
||||||
[env:lora_v3_board]
|
build_flags = ${env.build_flags} -Os
|
||||||
board = heltec_wifi_lora_32_V3
|
build_src_filter = ${env.build_src_filter} -<platform/portduino/>
|
||||||
build_flags = -Werror -Wall -DUNITY_INCLUDE_PRINT_FORMATTED
|
debug_init_break = tbreak setup
|
||||||
|
|
||||||
[env:lora_board_debug]
|
|
||||||
board = esp32doit-devkit-v1
|
|
||||||
build_flags = -Werror -Wall -DCORE_DEBUG_LEVEL=5 -DUNITY_INCLUDE_PRINT_FORMATTED
|
|
||||||
build_type = debug
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include "Board.h"
|
||||||
|
|
||||||
|
String getBoardName() {
|
||||||
|
#if defined(HELTEC_V1)
|
||||||
|
return "Heltec V1";
|
||||||
|
#elif defined(HELTEC_V2_0)
|
||||||
|
return "Heltec V2";
|
||||||
|
#elif defined(HELTEC_V3)
|
||||||
|
return "Heltec V3";
|
||||||
|
#elif defined(T_INTERNET_POE)
|
||||||
|
return "T-Internet PoE";
|
||||||
|
#elif defined(TBEAM_V10)
|
||||||
|
return "T-Beam V1.0 and V1.1";
|
||||||
|
#elif defined(TBEAM_V12_AXP2101)
|
||||||
|
return "T-Beam V1.2 AXP2101";
|
||||||
|
#elif defined(TBEAM_S3_CORE)
|
||||||
|
return "T-Beam S3 Core";
|
||||||
|
#elif defined(TLORA_V1)
|
||||||
|
return "T-LoRa32 V1";
|
||||||
|
#elif defined(TLORA_V2)
|
||||||
|
return "T-LoRa32 V2";
|
||||||
|
#else
|
||||||
|
#error "Board not defined!"
|
||||||
|
#endif
|
||||||
|
return "";
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef BOARD_H_
|
||||||
|
#define BOARD_H_
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
String getBoardName();
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,165 +0,0 @@
|
||||||
#include "BoardFinder.h"
|
|
||||||
#include "PowerManagement/power_management.h"
|
|
||||||
#include <logger.h>
|
|
||||||
|
|
||||||
#define MODULE_NAME "BoardFinder"
|
|
||||||
|
|
||||||
OledPins::OledPins(int8_t sda, int8_t scl, int8_t reset, int8_t addr) : Sda(sda), Scl(scl), Reset(reset), Addr(addr) {
|
|
||||||
}
|
|
||||||
|
|
||||||
LoraPins::LoraPins(int8_t sck, int8_t miso, int8_t mosi, int8_t cs, int8_t reset, int8_t irq, LoraModem modem) : Sck(sck), Miso(miso), Mosi(mosi), CS(cs), Reset(reset), IRQ(irq), Modem(modem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
GpsPins::GpsPins(int8_t rx, int8_t tx) : Rx(rx), Tx(tx) {
|
|
||||||
}
|
|
||||||
|
|
||||||
EthernetPins::EthernetPins(int8_t mdc, int8_t mdio, int8_t nreset, int8_t addr, int8_t power, eth_clock_mode_t clk, eth_phy_type_t type) : MDC(mdc), MDIO(mdio), nReset(nreset), Addr(addr), Power(power), CLK(clk), Type(type) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonPins::ButtonPins(int8_t pin) : Pin(pin) {
|
|
||||||
}
|
|
||||||
|
|
||||||
BoardConfig::BoardConfig(String name, BoardType type, OledPins oled, LoraPins lora, GpsPins gps, EthernetPins ethernet, ButtonPins button, bool needcheckpowerchip, bool powercheckstatus) : Name(name), Type(type), Oled(oled), Lora(lora), Gps(gps), Ethernet(ethernet), Button(button), needCheckPowerChip(needcheckpowerchip), powerCheckStatus(powercheckstatus) {
|
|
||||||
}
|
|
||||||
|
|
||||||
BoardFinder::BoardFinder(const std::list<BoardConfig const *> &boardConfigs) : _boardConfigs(boardConfigs) {
|
|
||||||
}
|
|
||||||
|
|
||||||
BoardConfig const *BoardFinder::searchBoardConfig(logging::Logger &logger) {
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "looking for a board config.");
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "searching for OLED...");
|
|
||||||
|
|
||||||
for (BoardConfig const *boardconf : _boardConfigs) {
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, MODULE_NAME, "trying board config: %s", boardconf->Name.c_str());
|
|
||||||
if (boardconf->needCheckPowerChip && checkPowerConfig(boardconf, logger) == boardconf->powerCheckStatus) {
|
|
||||||
PowerManagement powerManagement;
|
|
||||||
Wire.begin(boardconf->Oled.Sda, boardconf->Oled.Scl);
|
|
||||||
powerManagement.begin(Wire);
|
|
||||||
powerManagement.activateOLED();
|
|
||||||
Wire.end();
|
|
||||||
} else if (boardconf->needCheckPowerChip) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (checkOledConfig(boardconf, logger)) {
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "found a board config: %s", boardconf->Name.c_str());
|
|
||||||
return boardconf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "could not find OLED, will search for the modem now...");
|
|
||||||
|
|
||||||
for (BoardConfig const *boardconf : _boardConfigs) {
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, MODULE_NAME, "trying board config: %s", boardconf->Name.c_str());
|
|
||||||
if (boardconf->needCheckPowerChip && checkPowerConfig(boardconf, logger) == boardconf->powerCheckStatus) {
|
|
||||||
PowerManagement powerManagement;
|
|
||||||
Wire.begin(boardconf->Oled.Sda, boardconf->Oled.Scl);
|
|
||||||
powerManagement.begin(Wire);
|
|
||||||
powerManagement.activateLoRa();
|
|
||||||
Wire.end();
|
|
||||||
}
|
|
||||||
if (checkModemConfig(boardconf)) {
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "found a board config: %s", boardconf->Name.c_str());
|
|
||||||
return boardconf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, MODULE_NAME, "could not find a board config!");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BoardConfig const *BoardFinder::getBoardConfig(String name) {
|
|
||||||
std::_List_const_iterator<BoardConfig const *> elem = std::find_if(_boardConfigs.begin(), _boardConfigs.end(), [&](BoardConfig const *conf) {
|
|
||||||
return conf->Name == name;
|
|
||||||
});
|
|
||||||
if (elem == _boardConfigs.end()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return *elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BoardFinder::checkOledConfig(BoardConfig const *boardConfig, logging::Logger &logger) {
|
|
||||||
if (boardConfig->Oled.Reset != -1) {
|
|
||||||
pinMode(boardConfig->Oled.Reset, OUTPUT);
|
|
||||||
digitalWrite(boardConfig->Oled.Reset, HIGH);
|
|
||||||
delay(1);
|
|
||||||
digitalWrite(boardConfig->Oled.Reset, LOW);
|
|
||||||
delay(10);
|
|
||||||
digitalWrite(boardConfig->Oled.Reset, HIGH);
|
|
||||||
}
|
|
||||||
if (!Wire.begin(boardConfig->Oled.Sda, boardConfig->Oled.Scl)) {
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, MODULE_NAME, "issue with wire");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Wire.beginTransmission(boardConfig->Oled.Addr);
|
|
||||||
if (!Wire.endTransmission()) {
|
|
||||||
Wire.end();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Wire.end();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BoardFinder::checkModemConfig(BoardConfig const *boardConfig) {
|
|
||||||
pinMode(boardConfig->Lora.Reset, OUTPUT);
|
|
||||||
digitalWrite(boardConfig->Lora.Reset, LOW);
|
|
||||||
delay(10);
|
|
||||||
digitalWrite(boardConfig->Lora.Reset, HIGH);
|
|
||||||
delay(10);
|
|
||||||
|
|
||||||
pinMode(boardConfig->Lora.CS, OUTPUT);
|
|
||||||
digitalWrite(boardConfig->Lora.CS, HIGH);
|
|
||||||
|
|
||||||
SPI.begin(boardConfig->Lora.Sck, boardConfig->Lora.Miso, boardConfig->Lora.Mosi, boardConfig->Lora.CS);
|
|
||||||
|
|
||||||
digitalWrite(boardConfig->Lora.CS, LOW);
|
|
||||||
|
|
||||||
SPI.beginTransaction(SPISettings(8E6, MSBFIRST, SPI_MODE0));
|
|
||||||
SPI.transfer(0x42);
|
|
||||||
uint8_t response = SPI.transfer(0x00);
|
|
||||||
SPI.endTransaction();
|
|
||||||
digitalWrite(boardConfig->Lora.CS, HIGH);
|
|
||||||
SPI.end();
|
|
||||||
if (response == 0x12) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BoardFinder::checkPowerConfig(BoardConfig const *boardConfig, logging::Logger &logger) {
|
|
||||||
if (!Wire.begin(boardConfig->Oled.Sda, boardConfig->Oled.Scl)) {
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, MODULE_NAME, "issue with wire");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Wire.beginTransmission(0x34);
|
|
||||||
Wire.write(0x03);
|
|
||||||
Wire.endTransmission();
|
|
||||||
|
|
||||||
Wire.requestFrom(0x34, 1);
|
|
||||||
int response = Wire.read();
|
|
||||||
Wire.endTransmission();
|
|
||||||
Wire.end();
|
|
||||||
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, MODULE_NAME, "wire response: %d", response);
|
|
||||||
if (response == 0x03) {
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, MODULE_NAME, "power chip found!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, MODULE_NAME, "power chip NOT found");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
BoardConfig TTGO_LORA32_V1 ("TTGO_LORA32_V1", eTTGO_LORA32_V1, OledPins( 4, 15), LoraPins( 5, 19, 27, 18, 14, 26, eSX1278));
|
|
||||||
BoardConfig TTGO_LORA32_V2 ("TTGO_LORA32_V2", eTTGO_LORA32_V2, OledPins(21, 22), LoraPins( 5, 19, 27, 18, 14, 26, eSX1278));
|
|
||||||
BoardConfig TTGO_T_Beam_V0_7 ("TTGO_T_Beam_V0_7", eTTGO_T_Beam_V0_7, OledPins(21, 22), LoraPins( 5, 19, 27, 18, 14, 26, eSX1278), GpsPins(15, 12), EthernetPins(), ButtonPins(38), true);
|
|
||||||
BoardConfig TTGO_T_Beam_V1_0 ("TTGO_T_Beam_V1_0", eTTGO_T_Beam_V1_0, OledPins(21, 22), LoraPins( 5, 19, 27, 18, 14, 26, eSX1278), GpsPins(12, 34), EthernetPins(), ButtonPins(38), true, true);
|
|
||||||
BoardConfig LILYGO_POE_ETH_BOARD ("LILYGO_POE_ETH_BOARD", eLILYGO_POE_ETH_BOARD, OledPins(33, 32), LoraPins(14, 2, 15, 12, 4, 36, eSX1278), GpsPins(), EthernetPins(23, 18, 5, 0, -1, ETH_CLOCK_GPIO17_OUT, ETH_PHY_LAN8720));
|
|
||||||
BoardConfig WT32_ETH_BOARD ("WT32_ETH_BOARD", eWT32_ETH_BOARD, OledPins(17, 5), LoraPins( 4, 12, 14, 15, 33, 32, eSX1278), GpsPins(), EthernetPins(23, 18, -1, 1, 16, ETH_CLOCK_GPIO0_IN, ETH_PHY_LAN8720));
|
|
||||||
BoardConfig TRACKERD ("TRACKERD", eTRACKERD, OledPins( 5, 4), LoraPins(18, 19, 23, 16, 14, 26, eSX1278));
|
|
||||||
BoardConfig HELTEC_WIFI_LORA_32_V1 ("HELTEC_WIFI_LORA_32_V1", eHELTEC_WIFI_LORA_32_V1, OledPins( 4, 15, 16), LoraPins( 5, 19, 27, 18, 14, 26, eSX1278));
|
|
||||||
BoardConfig HELTEC_WIFI_LORA_32_V2 ("HELTEC_WIFI_LORA_32_V2", eHELTEC_WIFI_LORA_32_V2, OledPins( 4, 15, 16), LoraPins( 5, 19, 27, 18, 14, 26, eSX1278));
|
|
||||||
BoardConfig HELTEC_WIFI_LORA_32_V3 ("HELTEC_WIFI_LORA_32_V3", eHELTEC_WIFI_LORA_32_V3, OledPins(17, 18, 21), LoraPins( 9, 11, 10, 8, 12, 14, eSX1268));
|
|
||||||
BoardConfig GUALTHERIUS_LORAHAM_v100("GUALTHERIUS_LORAHAM_v100", eGUALTHERIUS_LORAHAM_v100, OledPins(17, 16), LoraPins(18, 19, 23, 5, 13, 35, eSX1278));
|
|
||||||
BoardConfig GUALTHERIUS_LORAHAM_v106("GUALTHERIUS_LORAHAM_v106", eGUALTHERIUS_LORAHAM_v106, OledPins(17, 16), LoraPins(18, 19, 23, 2, 13, 35, eSX1278));
|
|
||||||
// clang-format on
|
|
|
@ -1,139 +0,0 @@
|
||||||
#ifndef BOARD_FINDER_H_
|
|
||||||
#define BOARD_FINDER_H_
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include <ETH.h>
|
|
||||||
#include <SPI.h>
|
|
||||||
#include <Wire.h>
|
|
||||||
|
|
||||||
#include <logger.h>
|
|
||||||
|
|
||||||
class OledPins {
|
|
||||||
public:
|
|
||||||
explicit OledPins(int8_t sda, int8_t scl, int8_t reset = -1, int8_t addr = 0x3C);
|
|
||||||
|
|
||||||
int8_t Sda;
|
|
||||||
int8_t Scl;
|
|
||||||
int8_t Reset;
|
|
||||||
int8_t Addr;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum LoraModem {
|
|
||||||
eSX1278,
|
|
||||||
eSX1268,
|
|
||||||
};
|
|
||||||
|
|
||||||
class LoraPins {
|
|
||||||
public:
|
|
||||||
explicit LoraPins(int8_t sck, int8_t miso, int8_t mosi, int8_t cs, int8_t reset, int8_t irq, LoraModem modem);
|
|
||||||
|
|
||||||
int8_t Sck;
|
|
||||||
int8_t Miso;
|
|
||||||
int8_t Mosi;
|
|
||||||
int8_t CS;
|
|
||||||
int8_t Reset;
|
|
||||||
int8_t IRQ;
|
|
||||||
LoraModem Modem;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GpsPins {
|
|
||||||
public:
|
|
||||||
explicit GpsPins(int8_t rx = -1, int8_t tx = -1);
|
|
||||||
|
|
||||||
int8_t Rx;
|
|
||||||
int8_t Tx;
|
|
||||||
};
|
|
||||||
|
|
||||||
class EthernetPins {
|
|
||||||
public:
|
|
||||||
explicit EthernetPins(int8_t mdc = -1, int8_t mdio = -1, int8_t nreset = -1, int8_t addr = 0, int8_t power = -1, eth_clock_mode_t clk = ETH_CLOCK_GPIO17_OUT, eth_phy_type_t type = ETH_PHY_LAN8720);
|
|
||||||
|
|
||||||
int8_t MDC;
|
|
||||||
int8_t MDIO;
|
|
||||||
int8_t nReset;
|
|
||||||
int8_t Addr;
|
|
||||||
int8_t Power;
|
|
||||||
|
|
||||||
eth_clock_mode_t CLK;
|
|
||||||
eth_phy_type_t Type;
|
|
||||||
|
|
||||||
bool isEthernetBoard() const {
|
|
||||||
return MDC != -1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class ButtonPins {
|
|
||||||
public:
|
|
||||||
explicit ButtonPins(int8_t pin = -1);
|
|
||||||
|
|
||||||
int8_t Pin;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum BoardType {
|
|
||||||
eHELTEC_WIFI_LORA_32_V1,
|
|
||||||
eHELTEC_WIFI_LORA_32_V2,
|
|
||||||
eHELTEC_WIFI_LORA_32_V3,
|
|
||||||
eTTGO_LORA32_V1,
|
|
||||||
eTTGO_LORA32_V2,
|
|
||||||
eTTGO_T_Beam_V0_7,
|
|
||||||
eTTGO_T_Beam_V1_0,
|
|
||||||
eLILYGO_POE_ETH_BOARD,
|
|
||||||
eWT32_ETH_BOARD,
|
|
||||||
eTRACKERD,
|
|
||||||
eGUALTHERIUS_LORAHAM_v100,
|
|
||||||
eGUALTHERIUS_LORAHAM_v106
|
|
||||||
};
|
|
||||||
|
|
||||||
class BoardConfig {
|
|
||||||
public:
|
|
||||||
explicit BoardConfig(String name, BoardType type, OledPins oled, LoraPins lora, GpsPins gps = GpsPins(), EthernetPins ethernet = EthernetPins(), ButtonPins button = ButtonPins(), bool needcheckpowerchip = false, bool powercheckstatus = false);
|
|
||||||
|
|
||||||
String Name;
|
|
||||||
BoardType Type;
|
|
||||||
|
|
||||||
OledPins Oled;
|
|
||||||
LoraPins Lora;
|
|
||||||
GpsPins Gps;
|
|
||||||
EthernetPins Ethernet;
|
|
||||||
|
|
||||||
ButtonPins Button;
|
|
||||||
|
|
||||||
bool needCheckPowerChip;
|
|
||||||
bool powerCheckStatus;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BoardFinder {
|
|
||||||
public:
|
|
||||||
explicit BoardFinder(const std::list<BoardConfig const *> &boardConfigs);
|
|
||||||
|
|
||||||
BoardConfig const *searchBoardConfig(logging::Logger &logger);
|
|
||||||
|
|
||||||
BoardConfig const *getBoardConfig(String name);
|
|
||||||
|
|
||||||
#ifndef UNIT_TEST
|
|
||||||
private:
|
|
||||||
#endif
|
|
||||||
const std::list<BoardConfig const *> &_boardConfigs;
|
|
||||||
|
|
||||||
bool checkOledConfig(BoardConfig const *boardConfig, logging::Logger &logger);
|
|
||||||
bool checkModemConfig(BoardConfig const *boardConfig);
|
|
||||||
bool checkPowerConfig(BoardConfig const *boardConfig, logging::Logger &logger);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern BoardConfig TTGO_LORA32_V1;
|
|
||||||
extern BoardConfig TTGO_LORA32_V2;
|
|
||||||
extern BoardConfig TTGO_T_Beam_V0_7;
|
|
||||||
extern BoardConfig TTGO_T_Beam_V1_0;
|
|
||||||
extern BoardConfig LILYGO_POE_ETH_BOARD;
|
|
||||||
extern BoardConfig WT32_ETH_BOARD;
|
|
||||||
extern BoardConfig TRACKERD;
|
|
||||||
extern BoardConfig HELTEC_WIFI_LORA_32_V1;
|
|
||||||
extern BoardConfig HELTEC_WIFI_LORA_32_V2;
|
|
||||||
extern BoardConfig HELTEC_WIFI_LORA_32_V3;
|
|
||||||
extern BoardConfig GUALTHERIUS_LORAHAM_v100;
|
|
||||||
extern BoardConfig GUALTHERIUS_LORAHAM_v106;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -8,17 +8,21 @@ Display::Display() : _disp(0), _statusFrame(0), _displaySaveMode(false) {
|
||||||
Display::~Display() {
|
Display::~Display() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::setup(BoardConfig const *const boardConfig) {
|
void Display::setup() {
|
||||||
if (boardConfig->Oled.Reset != -1) {
|
#ifdef RESET_OLED
|
||||||
pinMode(boardConfig->Oled.Reset, OUTPUT);
|
pinMode(RESET_OLED, OUTPUT);
|
||||||
digitalWrite(boardConfig->Oled.Reset, HIGH);
|
digitalWrite(RESET_OLED, HIGH);
|
||||||
delay(1);
|
delay(1);
|
||||||
digitalWrite(boardConfig->Oled.Reset, LOW);
|
digitalWrite(RESET_OLED, LOW);
|
||||||
delay(10);
|
delay(10);
|
||||||
digitalWrite(boardConfig->Oled.Reset, HIGH);
|
digitalWrite(RESET_OLED, HIGH);
|
||||||
}
|
#endif
|
||||||
Wire.begin(boardConfig->Oled.Sda, boardConfig->Oled.Scl);
|
#if defined(OLED_SDA) && defined(OLED_SCL)
|
||||||
_disp = new SSD1306(&Wire, boardConfig->Oled.Addr);
|
Wire.begin(OLED_SDA, OLED_SCL);
|
||||||
|
#else
|
||||||
|
Wire.begin(SDA, SCL);
|
||||||
|
#endif
|
||||||
|
_disp = new SSD1306(&Wire, 0x3C);
|
||||||
|
|
||||||
Bitmap bitmap(_disp->getWidth(), _disp->getHeight());
|
Bitmap bitmap(_disp->getWidth(), _disp->getHeight());
|
||||||
_disp->display(&bitmap);
|
_disp->display(&bitmap);
|
||||||
|
@ -91,12 +95,14 @@ void Display::setStatusFrame(std::shared_ptr<StatusFrame> frame) {
|
||||||
_statusFrame = frame;
|
_statusFrame = frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::showSpashScreen(String firmwareTitle, String version) {
|
void Display::showSpashScreen(String firmwareTitle, String version, String boardname) {
|
||||||
Bitmap bitmap(_disp);
|
Bitmap bitmap(_disp);
|
||||||
bitmap.drawString(0, 10, firmwareTitle);
|
bitmap.drawString(0, 10, firmwareTitle);
|
||||||
bitmap.drawString(0, 20, version);
|
bitmap.drawString(0, 20, version);
|
||||||
bitmap.drawString(0, 35, "by Peter Buchegger");
|
bitmap.drawString(0, 35, "by Peter Buchegger");
|
||||||
bitmap.drawString(30, 45, "OE5BPA");
|
bitmap.drawString(30, 45, "OE5BPA");
|
||||||
|
bitmap.drawString(0, 55, "for board");
|
||||||
|
bitmap.drawString(0, 65, boardname);
|
||||||
_disp->display(&bitmap);
|
_disp->display(&bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef DISPLAY_H_
|
#ifndef DISPLAY_H_
|
||||||
#define DISPLAY_H_
|
#define DISPLAY_H_
|
||||||
|
|
||||||
#include "BoardFinder/BoardFinder.h"
|
|
||||||
#include "Display/SSD1306.h"
|
#include "Display/SSD1306.h"
|
||||||
#include "System/Timer.h"
|
#include "System/Timer.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
@ -27,9 +26,9 @@ public:
|
||||||
Display();
|
Display();
|
||||||
~Display();
|
~Display();
|
||||||
|
|
||||||
void setup(BoardConfig const *const boardConfig);
|
void setup();
|
||||||
// setup functions
|
// setup functions
|
||||||
void showSpashScreen(String firmwareTitle, String version);
|
void showSpashScreen(String firmwareTitle, String version, String boardname);
|
||||||
void setStatusFrame(std::shared_ptr<StatusFrame> frame);
|
void setStatusFrame(std::shared_ptr<StatusFrame> frame);
|
||||||
void showStatusScreen(String header, String text);
|
void showStatusScreen(String header, String text);
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
#include "LoRaModem.h"
|
#include "LoRaModem.h"
|
||||||
|
|
||||||
// SX1278
|
// SX1278
|
||||||
|
#ifdef USE_SX1278
|
||||||
Modem_SX1278::Modem_SX1278() : _radio(0) {
|
Modem_SX1278::Modem_SX1278() : _radio(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t Modem_SX1278::begin(const LoraPins &lora_pins, const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) {
|
int16_t Modem_SX1278::begin(const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) {
|
||||||
float _frequencyRx = (float)lora_config.frequencyRx / 1000000;
|
float _frequencyRx = (float)lora_config.frequencyRx / 1000000;
|
||||||
float BWkHz = (float)lora_config.signalBandwidth / 1000;
|
float BWkHz = (float)lora_config.signalBandwidth / 1000;
|
||||||
|
|
||||||
SPI.begin(lora_pins.Sck, lora_pins.Miso, lora_pins.Mosi, lora_pins.CS);
|
#if defined(LORA_SCK) && defined(LORA_MISO) && defined(LORA_MOSI) && defined(LORA_CS)
|
||||||
_module = new Module(lora_pins.CS, lora_pins.IRQ, lora_pins.Reset);
|
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
|
||||||
|
_module = new Module(LORA_CS, LORA_IRQ, LORA_RST);
|
||||||
|
#else
|
||||||
|
SPI.begin(SCK, MISO, MOSI, SS);
|
||||||
|
_module = new Module(SS, DIO0, RST_LoRa);
|
||||||
|
#endif
|
||||||
|
|
||||||
_radio = new SX1278(_module);
|
_radio = new SX1278(_module);
|
||||||
int16_t state = _radio->begin(_frequencyRx, BWkHz, lora_config.spreadingFactor, lora_config.codingRate4, RADIOLIB_SX127X_SYNC_WORD, lora_config.power, preambleLength, lora_config.gainRx);
|
int16_t state = _radio->begin(_frequencyRx, BWkHz, lora_config.spreadingFactor, lora_config.codingRate4, RADIOLIB_SX127X_SYNC_WORD, lora_config.power, preambleLength, lora_config.gainRx);
|
||||||
|
@ -67,15 +73,21 @@ uint8_t Modem_SX1278::getModemStatus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SX1262
|
// SX1262
|
||||||
|
#elif defined(USE_SX1268)
|
||||||
Modem_SX1268::Modem_SX1268() : _radio(0) {
|
Modem_SX1268::Modem_SX1268() : _radio(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t Modem_SX1268::begin(const LoraPins &lora_pins, const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) {
|
int16_t Modem_SX1268::begin(const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) {
|
||||||
float _frequencyRx = (float)lora_config.frequencyRx / 1000000;
|
float _frequencyRx = (float)lora_config.frequencyRx / 1000000;
|
||||||
float BWkHz = (float)lora_config.signalBandwidth / 1000;
|
float BWkHz = (float)lora_config.signalBandwidth / 1000;
|
||||||
|
|
||||||
SPI.begin(lora_pins.Sck, lora_pins.Miso, lora_pins.Mosi, lora_pins.CS);
|
#if defined(LORA_SCK) && defined(LORA_MISO) && defined(LORA_MOSI) && defined(LORA_CS)
|
||||||
_module = new Module(lora_pins.CS, lora_pins.IRQ, lora_pins.Reset, 13);
|
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
|
||||||
|
_module = new Module(LORA_CS, LORA_IRQ, LORA_RST, BUSY_LoRa);
|
||||||
|
#else
|
||||||
|
SPI.begin(SCK, MISO, MOSI, SS);
|
||||||
|
_module = new Module(SS, DIO0, RST_LoRa, BUSY_LoRa);
|
||||||
|
#endif
|
||||||
|
|
||||||
_radio = new SX1262(_module);
|
_radio = new SX1262(_module);
|
||||||
int16_t state = _radio->begin(_frequencyRx, BWkHz, lora_config.spreadingFactor, lora_config.codingRate4, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, lora_config.power, preambleLength);
|
int16_t state = _radio->begin(_frequencyRx, BWkHz, lora_config.spreadingFactor, lora_config.codingRate4, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, lora_config.power, preambleLength);
|
||||||
|
@ -131,3 +143,4 @@ float Modem_SX1268::getFrequencyError() {
|
||||||
uint8_t Modem_SX1268::getModemStatus() {
|
uint8_t Modem_SX1268::getModemStatus() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
|
||||||
#include "BoardFinder/BoardFinder.h"
|
|
||||||
#include "project_configuration.h"
|
#include "project_configuration.h"
|
||||||
|
|
||||||
class LoRaModem {
|
class LoRaModem {
|
||||||
|
@ -14,7 +13,7 @@ public:
|
||||||
virtual ~LoRaModem() {
|
virtual ~LoRaModem() {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int16_t begin(const LoraPins &lora_pins, const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) = 0;
|
virtual int16_t begin(const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) = 0;
|
||||||
|
|
||||||
virtual int16_t readData(String &str) = 0;
|
virtual int16_t readData(String &str) = 0;
|
||||||
|
|
||||||
|
@ -33,11 +32,12 @@ protected:
|
||||||
Module *_module;
|
Module *_module;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef USE_SX1278
|
||||||
class Modem_SX1278 : public LoRaModem {
|
class Modem_SX1278 : public LoRaModem {
|
||||||
public:
|
public:
|
||||||
Modem_SX1278();
|
Modem_SX1278();
|
||||||
|
|
||||||
int16_t begin(const LoraPins &lora_pins, const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) override;
|
int16_t begin(const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) override;
|
||||||
|
|
||||||
int16_t readData(String &str) override;
|
int16_t readData(String &str) override;
|
||||||
|
|
||||||
|
@ -56,11 +56,12 @@ private:
|
||||||
SX1278 *_radio;
|
SX1278 *_radio;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#elif defined(USE_SX1268)
|
||||||
class Modem_SX1268 : public LoRaModem {
|
class Modem_SX1268 : public LoRaModem {
|
||||||
public:
|
public:
|
||||||
Modem_SX1268();
|
Modem_SX1268();
|
||||||
|
|
||||||
int16_t begin(const LoraPins &lora_pins, const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) override;
|
int16_t begin(const Configuration::LoRa &lora_config, const uint16_t preambleLength, void (*setFlag)()) override;
|
||||||
|
|
||||||
int16_t readData(String &str) override;
|
int16_t readData(String &str) override;
|
||||||
|
|
||||||
|
@ -78,5 +79,6 @@ public:
|
||||||
private:
|
private:
|
||||||
SX1262 *_radio;
|
SX1262 *_radio;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
#ifndef UNIT_TEST
|
#ifndef UNIT_TEST
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include <esp_task_wdt.h>
|
||||||
|
#include <logger.h>
|
||||||
|
|
||||||
#include "APRS-IS/APRS-IS.h"
|
#include "APRS-IS/APRS-IS.h"
|
||||||
#include "BoardFinder/BoardFinder.h"
|
#include "Board.h"
|
||||||
#include "PowerManagement/power_management.h"
|
#include "PowerManagement/power_management.h"
|
||||||
#include "System/System.h"
|
#include "System/System.h"
|
||||||
#include "System/TaskManager.h"
|
#include "System/TaskManager.h"
|
||||||
#include <esp_task_wdt.h>
|
|
||||||
#include <logger.h>
|
|
||||||
|
|
||||||
#include "TaskAprsIs.h"
|
#include "TaskAprsIs.h"
|
||||||
#include "TaskBeacon.h"
|
#include "TaskBeacon.h"
|
||||||
|
@ -36,6 +37,15 @@ TaskQueue<std::shared_ptr<APRSMessage>> toMQTT;
|
||||||
System LoRaSystem;
|
System LoRaSystem;
|
||||||
Configuration userConfig;
|
Configuration userConfig;
|
||||||
|
|
||||||
|
#ifdef HAS_AXP192
|
||||||
|
AXP192 axp;
|
||||||
|
PowerManagement *powerManagement = &axp;
|
||||||
|
#endif
|
||||||
|
#ifdef HAS_AXP2101
|
||||||
|
AXP2101 axp;
|
||||||
|
PowerManagement *powerManagement = &axp;
|
||||||
|
#endif
|
||||||
|
|
||||||
DisplayTask displayTask;
|
DisplayTask displayTask;
|
||||||
// ModemTask modemTask(fromModem, toModem);
|
// ModemTask modemTask(fromModem, toModem);
|
||||||
RadiolibTask modemTask(fromModem, toModem);
|
RadiolibTask modemTask(fromModem, toModem);
|
||||||
|
@ -53,45 +63,14 @@ void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
LoRaSystem.getLogger().setSerial(&Serial);
|
LoRaSystem.getLogger().setSerial(&Serial);
|
||||||
setWiFiLogger(&LoRaSystem.getLogger());
|
setWiFiLogger(&LoRaSystem.getLogger());
|
||||||
delay(500);
|
delay(1000);
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "LoRa APRS iGate by OE5BPA (Peter Buchegger)");
|
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "LoRa APRS iGate by OE5BPA (Peter Buchegger)");
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "Version: %s", VERSION);
|
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "Version: %s", VERSION);
|
||||||
|
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "Board: %s", getBoardName().c_str());
|
||||||
std::list<BoardConfig const *> boardConfigs;
|
|
||||||
boardConfigs.push_back(&TTGO_LORA32_V1);
|
|
||||||
boardConfigs.push_back(&TTGO_LORA32_V2);
|
|
||||||
boardConfigs.push_back(&HELTEC_WIFI_LORA_32_V1);
|
|
||||||
boardConfigs.push_back(&HELTEC_WIFI_LORA_32_V2);
|
|
||||||
boardConfigs.push_back(&HELTEC_WIFI_LORA_32_V3);
|
|
||||||
boardConfigs.push_back(&LILYGO_POE_ETH_BOARD);
|
|
||||||
boardConfigs.push_back(&WT32_ETH_BOARD);
|
|
||||||
boardConfigs.push_back(&TRACKERD);
|
|
||||||
boardConfigs.push_back(&GUALTHERIUS_LORAHAM_v100);
|
|
||||||
boardConfigs.push_back(&GUALTHERIUS_LORAHAM_v106);
|
|
||||||
boardConfigs.push_back(&TTGO_T_Beam_V0_7);
|
|
||||||
boardConfigs.push_back(&TTGO_T_Beam_V1_0);
|
|
||||||
|
|
||||||
ProjectConfigurationManagement confmg(LoRaSystem.getLogger());
|
ProjectConfigurationManagement confmg(LoRaSystem.getLogger());
|
||||||
confmg.readConfiguration(LoRaSystem.getLogger(), userConfig);
|
confmg.readConfiguration(LoRaSystem.getLogger(), userConfig);
|
||||||
|
|
||||||
BoardFinder finder(boardConfigs);
|
|
||||||
BoardConfig const *boardConfig = finder.getBoardConfig(userConfig.board);
|
|
||||||
if (!boardConfig) {
|
|
||||||
boardConfig = finder.searchBoardConfig(LoRaSystem.getLogger());
|
|
||||||
if (!boardConfig) {
|
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, MODULE_NAME, "Board config not set and search failed!");
|
|
||||||
while (true)
|
|
||||||
;
|
|
||||||
} else {
|
|
||||||
userConfig.board = boardConfig->Name;
|
|
||||||
confmg.writeConfiguration(LoRaSystem.getLogger(), userConfig);
|
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "will restart board now!");
|
|
||||||
ESP.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "Board %s loaded.", boardConfig->Name.c_str());
|
|
||||||
|
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "Will start watchdog now...");
|
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "Will start watchdog now...");
|
||||||
if (esp_task_wdt_init(10, true) != ESP_OK) {
|
if (esp_task_wdt_init(10, true) != ESP_OK) {
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_WARN, MODULE_NAME, "Watchdog init failed!");
|
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_WARN, MODULE_NAME, "Watchdog init failed!");
|
||||||
|
@ -101,24 +80,23 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boardConfig->Type == eTTGO_T_Beam_V1_0) {
|
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
|
||||||
Wire.begin(boardConfig->Oled.Sda, boardConfig->Oled.Scl);
|
Wire.begin(SDA, SCL);
|
||||||
PowerManagement powerManagement;
|
if (powerManagement->begin(Wire)) {
|
||||||
if (!powerManagement.begin(Wire)) {
|
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "PMU", "init done!");
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "AXP192 init done!");
|
} else {
|
||||||
} else {
|
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "PMU", "init failed!");
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, MODULE_NAME, "AXP192 init failed!");
|
|
||||||
}
|
|
||||||
powerManagement.activateLoRa();
|
|
||||||
powerManagement.activateOLED();
|
|
||||||
if (userConfig.beacon.use_gps) {
|
|
||||||
powerManagement.activateGPS();
|
|
||||||
} else {
|
|
||||||
powerManagement.deactivateGPS();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
powerManagement->activateLoRa();
|
||||||
|
powerManagement->activateOLED();
|
||||||
|
if (userConfig.beacon.use_gps) {
|
||||||
|
powerManagement->activateGPS();
|
||||||
|
} else {
|
||||||
|
powerManagement->deactivateGPS();
|
||||||
|
}
|
||||||
|
// powerManagement->activateMeasurement();
|
||||||
|
#endif
|
||||||
|
|
||||||
LoRaSystem.setBoardConfig(boardConfig);
|
|
||||||
LoRaSystem.setUserConfig(&userConfig);
|
LoRaSystem.setUserConfig(&userConfig);
|
||||||
LoRaSystem.getTaskManager().addTask(&displayTask);
|
LoRaSystem.getTaskManager().addTask(&displayTask);
|
||||||
LoRaSystem.getTaskManager().addTask(&modemTask);
|
LoRaSystem.getTaskManager().addTask(&modemTask);
|
||||||
|
@ -131,12 +109,13 @@ void setup() {
|
||||||
LoRaSystem.getTaskManager().addAlwaysRunTask(&wifiTask);
|
LoRaSystem.getTaskManager().addAlwaysRunTask(&wifiTask);
|
||||||
tcpip = true;
|
tcpip = true;
|
||||||
}
|
}
|
||||||
if (boardConfig->Ethernet.isEthernetBoard()) {
|
|
||||||
LoRaSystem.getTaskManager().addAlwaysRunTask(ðTask);
|
|
||||||
tcpip = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tcpip) {
|
#ifdef T_INTERNET_POE
|
||||||
|
LoRaSystem.getTaskManager().addAlwaysRunTask(ðTask);
|
||||||
|
tcpip = true; // cppcheck-suppress redundantAssignment
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (tcpip) { // cppcheck-suppress knownConditionTrueFalse
|
||||||
LoRaSystem.getTaskManager().addTask(&otaTask);
|
LoRaSystem.getTaskManager().addTask(&otaTask);
|
||||||
LoRaSystem.getTaskManager().addTask(&ntpTask);
|
LoRaSystem.getTaskManager().addTask(&ntpTask);
|
||||||
if (userConfig.ftp.active) {
|
if (userConfig.ftp.active) {
|
||||||
|
@ -155,7 +134,7 @@ void setup() {
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
LoRaSystem.getTaskManager().setup(LoRaSystem);
|
LoRaSystem.getTaskManager().setup(LoRaSystem);
|
||||||
|
|
||||||
LoRaSystem.getDisplay().showSpashScreen("LoRa APRS iGate", VERSION);
|
LoRaSystem.getDisplay().showSpashScreen("LoRa APRS iGate", VERSION, getBoardName());
|
||||||
|
|
||||||
if (userConfig.callsign == "NOCALL-10") {
|
if (userConfig.callsign == "NOCALL-10") {
|
||||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, MODULE_NAME, "You have to change your settings in 'data/is-cfg.json' and upload it via 'Upload File System image'!");
|
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, MODULE_NAME, "You have to change your settings in 'data/is-cfg.json' and upload it via 'Upload File System image'!");
|
||||||
|
|
|
@ -1,37 +1,218 @@
|
||||||
|
#include <XPowersAXP192.tpp>
|
||||||
|
#include <XPowersAXP2101.tpp>
|
||||||
|
|
||||||
#include "power_management.h"
|
#include "power_management.h"
|
||||||
|
|
||||||
PowerManagement::PowerManagement() : axp() {
|
AXP192::AXP192() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PowerManagement::begin(TwoWire &port) {
|
// cppcheck-suppress unusedFunction
|
||||||
bool result = axp.begin(port, AXP192_SLAVE_ADDRESS);
|
bool AXP192::begin(TwoWire &port) {
|
||||||
if (!result) {
|
_pmu = new XPowersAXP192(port);
|
||||||
axp.setDCDC1Voltage(3300);
|
if (!_pmu->init()) {
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerManagement::activateLoRa() {
|
// cppcheck-suppress unusedFunction
|
||||||
axp.setPowerOutPut(AXP192_LDO2, AXP202_ON);
|
void AXP192::activateLoRa() {
|
||||||
|
_pmu->enablePowerOutput(XPOWERS_LDO2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerManagement::deactivateLoRa() {
|
// cppcheck-suppress unusedFunction
|
||||||
axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
|
void AXP192::deactivateLoRa() {
|
||||||
|
_pmu->disablePowerOutput(XPOWERS_LDO2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerManagement::activateGPS() {
|
// cppcheck-suppress unusedFunction
|
||||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON);
|
void AXP192::activateGPS() {
|
||||||
|
_pmu->enablePowerOutput(XPOWERS_LDO3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerManagement::deactivateGPS() {
|
// cppcheck-suppress unusedFunction
|
||||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF);
|
void AXP192::deactivateGPS() {
|
||||||
|
_pmu->disablePowerOutput(XPOWERS_LDO3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerManagement::activateOLED() {
|
// cppcheck-suppress unusedFunction
|
||||||
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON);
|
void AXP192::activateOLED() {
|
||||||
|
_pmu->enablePowerOutput(XPOWERS_DCDC1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerManagement::deactivateOLED() {
|
// cppcheck-suppress unusedFunction
|
||||||
axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
|
void AXP192::deactivateOLED() {
|
||||||
|
_pmu->disablePowerOutput(XPOWERS_DCDC1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
void AXP192::activateMeasurement() {
|
||||||
|
_pmu->enableBattVoltageMeasure();
|
||||||
|
}
|
||||||
|
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
void AXP192::deactivateMeasurement() {
|
||||||
|
_pmu->disableBattVoltageMeasure();
|
||||||
|
}
|
||||||
|
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
double AXP192::getBatteryVoltage() {
|
||||||
|
return _pmu->getBattVoltage() / 1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
double AXP192::getBatteryChargeDischargeCurrent() {
|
||||||
|
if (isCharging()) {
|
||||||
|
return static_cast<XPowersAXP192 *>(_pmu)->getBatteryChargeCurrent();
|
||||||
|
}
|
||||||
|
return -1.0 * static_cast<XPowersAXP192 *>(_pmu)->getBattDischargeCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AXP192::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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,87 @@
|
||||||
#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() {
|
||||||
bool begin(TwoWire &port);
|
}
|
||||||
|
|
||||||
void activateLoRa();
|
virtual bool begin(TwoWire &port) = 0;
|
||||||
void deactivateLoRa();
|
|
||||||
|
|
||||||
void activateGPS();
|
virtual void activateLoRa() = 0;
|
||||||
void deactivateGPS();
|
virtual void deactivateLoRa() = 0;
|
||||||
|
|
||||||
void activateOLED();
|
virtual void activateGPS() = 0;
|
||||||
void deactivateOLED();
|
virtual void deactivateGPS() = 0;
|
||||||
|
|
||||||
private:
|
virtual void activateOLED() = 0;
|
||||||
AXP20X_Class axp;
|
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) override;
|
||||||
|
|
||||||
|
void activateLoRa() override;
|
||||||
|
void deactivateLoRa() override;
|
||||||
|
|
||||||
|
void activateGPS() override;
|
||||||
|
void deactivateGPS() override;
|
||||||
|
|
||||||
|
void activateOLED() override;
|
||||||
|
void deactivateOLED() override;
|
||||||
|
|
||||||
|
void activateMeasurement() override;
|
||||||
|
void deactivateMeasurement() override;
|
||||||
|
|
||||||
|
double getBatteryVoltage() override;
|
||||||
|
double getBatteryChargeDischargeCurrent() override;
|
||||||
|
|
||||||
|
bool isBatteryConnect() override;
|
||||||
|
bool isCharging() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class AXP2101 : public PowerManagement {
|
||||||
|
public:
|
||||||
|
AXP2101();
|
||||||
|
|
||||||
|
bool begin(TwoWire &port) override;
|
||||||
|
|
||||||
|
void activateLoRa() override;
|
||||||
|
void deactivateLoRa() override;
|
||||||
|
|
||||||
|
void activateGPS() override;
|
||||||
|
void deactivateGPS() override;
|
||||||
|
|
||||||
|
void activateOLED() override;
|
||||||
|
void deactivateOLED() override;
|
||||||
|
|
||||||
|
void activateMeasurement() override;
|
||||||
|
void deactivateMeasurement() override;
|
||||||
|
|
||||||
|
double getBatteryVoltage() override;
|
||||||
|
double getBatteryChargeDischargeCurrent() override;
|
||||||
|
|
||||||
|
bool isBatteryConnect() override;
|
||||||
|
bool isCharging() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,24 +1,16 @@
|
||||||
|
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
|
|
||||||
System::System() : _boardConfig(0), _userConfig(0), _isEthConnected(false), _isWifiConnected(false) {
|
System::System() : _userConfig(0), _isEthConnected(false), _isWifiConnected(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
System::~System() {
|
System::~System() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::setBoardConfig(BoardConfig const *const boardConfig) {
|
|
||||||
_boardConfig = boardConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
void System::setUserConfig(Configuration const *const userConfig) {
|
void System::setUserConfig(Configuration const *const userConfig) {
|
||||||
_userConfig = userConfig;
|
_userConfig = userConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoardConfig const *const System::getBoardConfig() const {
|
|
||||||
return _boardConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
Configuration const *const System::getUserConfig() const {
|
Configuration const *const System::getUserConfig() const {
|
||||||
return _userConfig;
|
return _userConfig;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <logger.h>
|
#include <logger.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "BoardFinder/BoardFinder.h"
|
|
||||||
#include "ConfigurationManagement/configuration.h"
|
#include "ConfigurationManagement/configuration.h"
|
||||||
#include "Display/Display.h"
|
#include "Display/Display.h"
|
||||||
#include "TaskManager.h"
|
#include "TaskManager.h"
|
||||||
|
@ -14,10 +13,8 @@ public:
|
||||||
System();
|
System();
|
||||||
~System();
|
~System();
|
||||||
|
|
||||||
void setBoardConfig(BoardConfig const *const boardConfig);
|
|
||||||
void setUserConfig(Configuration const *const userConfig);
|
void setUserConfig(Configuration const *const userConfig);
|
||||||
|
|
||||||
BoardConfig const *const getBoardConfig() const;
|
|
||||||
Configuration const *const getUserConfig() const;
|
Configuration const *const getUserConfig() const;
|
||||||
TaskManager &getTaskManager();
|
TaskManager &getTaskManager();
|
||||||
Display &getDisplay();
|
Display &getDisplay();
|
||||||
|
@ -27,7 +24,6 @@ public:
|
||||||
logging::Logger &getLogger();
|
logging::Logger &getLogger();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BoardConfig const *_boardConfig;
|
|
||||||
Configuration const *_userConfig;
|
Configuration const *_userConfig;
|
||||||
TaskManager _taskManager;
|
TaskManager _taskManager;
|
||||||
Display _display;
|
Display _display;
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "BoardFinder/BoardFinder.h"
|
|
||||||
#include "ConfigurationManagement/configuration.h"
|
#include "ConfigurationManagement/configuration.h"
|
||||||
#include "Display/Display.h"
|
#include "Display/Display.h"
|
||||||
|
|
||||||
|
|
|
@ -22,21 +22,23 @@ void BeaconTask::pushButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BeaconTask::setup(System &system) {
|
bool BeaconTask::setup(System &system) {
|
||||||
if (_instances++ == 0 && system.getBoardConfig()->Button.Pin != -1) {
|
#ifdef KEY_BUILTIN
|
||||||
_userButton = OneButton(system.getBoardConfig()->Button.Pin, true, true);
|
if (_instances++ == 0 && KEY_BUILTIN != 0) {
|
||||||
|
_userButton = OneButton(KEY_BUILTIN, true, true);
|
||||||
_userButton.attachClick(pushButton);
|
_userButton.attachClick(pushButton);
|
||||||
_send_update = false;
|
_send_update = false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_useGps = system.getUserConfig()->beacon.use_gps;
|
_useGps = system.getUserConfig()->beacon.use_gps;
|
||||||
|
|
||||||
if (_useGps) {
|
if (_useGps) {
|
||||||
if (system.getBoardConfig()->Gps.Rx != -1) {
|
#if defined(GPS_RX_PIN) && defined(GPS_TX_PIN)
|
||||||
_ss.begin(9600, SERIAL_8N1, system.getBoardConfig()->Gps.Tx, system.getBoardConfig()->Gps.Rx);
|
_ss.begin(9600, SERIAL_8N1, GPS_TX_PIN, GPS_RX_PIN);
|
||||||
} else {
|
#else
|
||||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "NO GPS found.");
|
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "NO GPS found.");
|
||||||
_useGps = false;
|
_useGps = false;
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
// setup beacon
|
// setup beacon
|
||||||
_beacon_timer.setTimeout(system.getUserConfig()->beacon.timeout * 60 * 1000);
|
_beacon_timer.setTimeout(system.getUserConfig()->beacon.timeout * 60 * 1000);
|
||||||
|
|
|
@ -31,7 +31,7 @@ private:
|
||||||
static uint _instances;
|
static uint _instances;
|
||||||
static OneButton _userButton;
|
static OneButton _userButton;
|
||||||
static bool _send_update;
|
static bool _send_update;
|
||||||
static void pushButton();
|
static void pushButton(); // cppcheck-suppress unusedPrivateFunction
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,7 +10,7 @@ DisplayTask::~DisplayTask() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DisplayTask::setup(System &system) {
|
bool DisplayTask::setup(System &system) {
|
||||||
system.getDisplay().setup(system.getBoardConfig());
|
system.getDisplay().setup();
|
||||||
if (system.getUserConfig()->display.turn180) {
|
if (system.getUserConfig()->display.turn180) {
|
||||||
system.getDisplay().turn180();
|
system.getDisplay().turn180();
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,18 +78,19 @@ EthTask::~EthTask() {
|
||||||
bool EthTask::setup(System &system) {
|
bool EthTask::setup(System &system) {
|
||||||
WiFi.onEvent(WiFiEvent);
|
WiFi.onEvent(WiFiEvent);
|
||||||
|
|
||||||
if (system.getBoardConfig()->Ethernet.nReset != -1) {
|
#ifdef T_INTERNET_POE
|
||||||
pinMode(system.getBoardConfig()->Ethernet.nReset, OUTPUT);
|
if (ETH_NRESET != -1) {
|
||||||
digitalWrite(system.getBoardConfig()->Ethernet.nReset, 0);
|
pinMode(ETH_NRESET, OUTPUT);
|
||||||
|
digitalWrite(ETH_NRESET, 0);
|
||||||
delay(200);
|
delay(200);
|
||||||
digitalWrite(system.getBoardConfig()->Ethernet.nReset, 1);
|
digitalWrite(ETH_NRESET, 1);
|
||||||
delay(200);
|
delay(200);
|
||||||
digitalWrite(system.getBoardConfig()->Ethernet.nReset, 0);
|
digitalWrite(ETH_NRESET, 0);
|
||||||
delay(200);
|
delay(200);
|
||||||
digitalWrite(system.getBoardConfig()->Ethernet.nReset, 1);
|
digitalWrite(ETH_NRESET, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ETH.begin(system.getBoardConfig()->Ethernet.Addr, system.getBoardConfig()->Ethernet.Power, system.getBoardConfig()->Ethernet.MDC, system.getBoardConfig()->Ethernet.MDIO, system.getBoardConfig()->Ethernet.Type, system.getBoardConfig()->Ethernet.CLK);
|
ETH.begin(ETH_ADDR, ETH_POWER, ETH_MDC, ETH_MDIO, (eth_phy_type_t)ETH_TYPE, (eth_clock_mode_t)ETH_CLOCK);
|
||||||
|
|
||||||
if (!system.getUserConfig()->network.DHCP) {
|
if (!system.getUserConfig()->network.DHCP) {
|
||||||
ETH.config(system.getUserConfig()->network.static_.ip, system.getUserConfig()->network.static_.gateway, system.getUserConfig()->network.static_.subnet, system.getUserConfig()->network.static_.dns1, system.getUserConfig()->network.static_.dns2);
|
ETH.config(system.getUserConfig()->network.static_.ip, system.getUserConfig()->network.static_.gateway, system.getUserConfig()->network.static_.subnet, system.getUserConfig()->network.static_.dns1, system.getUserConfig()->network.static_.dns2);
|
||||||
|
@ -99,6 +100,7 @@ bool EthTask::setup(System &system) {
|
||||||
} else {
|
} else {
|
||||||
ETH.setHostname(system.getUserConfig()->callsign.c_str());
|
ETH.setHostname(system.getUserConfig()->callsign.c_str());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,17 +25,17 @@ bool RadiolibTask::setup(System &system) {
|
||||||
|
|
||||||
const uint16_t preambleLength = 8;
|
const uint16_t preambleLength = 8;
|
||||||
|
|
||||||
if (system.getBoardConfig()->Lora.Modem == eSX1278) {
|
#ifdef USE_SX1278
|
||||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] using SX1278", timeString().c_str());
|
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] using SX1278", timeString().c_str());
|
||||||
_modem = new Modem_SX1278();
|
_modem = new Modem_SX1278();
|
||||||
} else if (system.getBoardConfig()->Lora.Modem == eSX1268) {
|
#elif defined(USE_SX1268)
|
||||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] using SX1268", timeString().c_str());
|
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] using SX1268", timeString().c_str());
|
||||||
_modem = new Modem_SX1268();
|
_modem = new Modem_SX1268();
|
||||||
} else {
|
#else
|
||||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, getName(), "[%s] Modem not correctly defined!", timeString().c_str());
|
#error "Modem not correctly defined!"
|
||||||
}
|
#endif
|
||||||
|
|
||||||
int16_t state = _modem->begin(system.getBoardConfig()->Lora, system.getUserConfig()->lora, preambleLength, setFlag);
|
int16_t state = _modem->begin(system.getUserConfig()->lora, preambleLength, setFlag);
|
||||||
if (state != RADIOLIB_ERR_NONE) {
|
if (state != RADIOLIB_ERR_NONE) {
|
||||||
decodeError(system, state);
|
decodeError(system, state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef TASK_LORA_H_
|
#ifndef TASK_LORA_H_
|
||||||
#define TASK_LORA_H_
|
#define TASK_LORA_H_
|
||||||
|
|
||||||
#include "BoardFinder/BoardFinder.h"
|
|
||||||
#include "LoRaModem.h"
|
#include "LoRaModem.h"
|
||||||
#include "System/TaskManager.h"
|
#include "System/TaskManager.h"
|
||||||
#include "project_configuration.h"
|
#include "project_configuration.h"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef PROJECT_CONFIGURATION_H_
|
#ifndef PROJECT_CONFIGURATION_H_
|
||||||
#define PROJECT_CONFIGURATION_H_
|
#define PROJECT_CONFIGURATION_H_
|
||||||
|
|
||||||
#include "BoardFinder/BoardFinder.h"
|
|
||||||
#include "ConfigurationManagement/configuration.h"
|
#include "ConfigurationManagement/configuration.h"
|
||||||
|
|
||||||
class Configuration {
|
class Configuration {
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
// cppcheck suppressions
|
||||||
|
|
||||||
|
unusedFunction
|
||||||
|
|
||||||
|
// ignore "external" library issues
|
||||||
|
shadowFunction:*TimeLib.cpp
|
||||||
|
unreadVariable:*TimeLib.cpp
|
||||||
|
|
||||||
|
// ignore bitmask from ArduinoJson
|
||||||
|
badBitmaskCheck:*project_configuration.cpp
|
||||||
|
|
||||||
|
// ignore stuff that is not ours
|
||||||
|
*:.pio/*
|
||||||
|
*:*/libdeps/*
|
|
@ -1,78 +0,0 @@
|
||||||
#include <Arduino.h>
|
|
||||||
#include <unity.h>
|
|
||||||
|
|
||||||
#include "BoardFinder/BoardFinder.h"
|
|
||||||
|
|
||||||
std::list<BoardConfig const *> boardConfigs;
|
|
||||||
logging::Logger logger;
|
|
||||||
BoardFinder *finder = 0;
|
|
||||||
|
|
||||||
void setUp(void) {
|
|
||||||
boardConfigs.push_back(&TTGO_LORA32_V1);
|
|
||||||
boardConfigs.push_back(&TTGO_LORA32_V2);
|
|
||||||
boardConfigs.push_back(&TTGO_T_Beam_V1_0);
|
|
||||||
boardConfigs.push_back(&LILYGO_POE_ETH_BOARD);
|
|
||||||
boardConfigs.push_back(&HELTEC_WIFI_LORA_32_V1);
|
|
||||||
boardConfigs.push_back(&HELTEC_WIFI_LORA_32_V2);
|
|
||||||
|
|
||||||
finder = new BoardFinder(boardConfigs);
|
|
||||||
|
|
||||||
logger.setSerial(&Serial);
|
|
||||||
}
|
|
||||||
|
|
||||||
void tearDown(void) {
|
|
||||||
delete finder;
|
|
||||||
finder = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_oled_found(void) {
|
|
||||||
bool found = false;
|
|
||||||
for (auto boardConfig : boardConfigs) {
|
|
||||||
if (finder->checkOledConfig(boardConfig, logger)) {
|
|
||||||
TEST_PRINTF("found: %s", boardConfig->Name.c_str());
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TEST_ASSERT_TRUE(found);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_modem_found(void) {
|
|
||||||
bool found = false;
|
|
||||||
for (auto boardConfig : boardConfigs) {
|
|
||||||
if (finder->checkModemConfig(boardConfig)) {
|
|
||||||
TEST_PRINTF("found: %s", boardConfig->Name.c_str());
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TEST_ASSERT_TRUE(found);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_search_board_config(void) {
|
|
||||||
BoardConfig const *boardConfig = finder->searchBoardConfig(logger);
|
|
||||||
TEST_ASSERT_NOT_NULL(boardConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_get_board_config(void) {
|
|
||||||
BoardConfig const *boardConfig = finder->getBoardConfig("LILYGO_POE_ETH_BOARD");
|
|
||||||
TEST_ASSERT_NOT_NULL(boardConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_get_board_config_negative(void) {
|
|
||||||
BoardConfig const *boardConfig = finder->getBoardConfig("NO BOARD");
|
|
||||||
TEST_ASSERT_NULL(boardConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
UNITY_BEGIN();
|
|
||||||
RUN_TEST(test_oled_found);
|
|
||||||
RUN_TEST(test_modem_found);
|
|
||||||
RUN_TEST(test_search_board_config);
|
|
||||||
RUN_TEST(test_get_board_config);
|
|
||||||
RUN_TEST(test_get_board_config_negative);
|
|
||||||
UNITY_END();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
}
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
[env:heltec-v1]
|
||||||
|
extends = esp32_base
|
||||||
|
board_level = extra
|
||||||
|
board = heltec_wifi_lora_32
|
||||||
|
build_flags =
|
||||||
|
${esp32_base.build_flags} -DHELTEC_V1 -DUSE_SX1278
|
|
@ -0,0 +1,6 @@
|
||||||
|
[env:heltec-v2_0]
|
||||||
|
extends = esp32_base
|
||||||
|
board = heltec_wifi_lora_32_V2
|
||||||
|
board_level = extra
|
||||||
|
build_flags =
|
||||||
|
${esp32_base.build_flags} -DHELTEC_V2_0 -DUSE_SX1278
|
|
@ -0,0 +1,5 @@
|
||||||
|
[env:heltec-v3]
|
||||||
|
extends = esp32s3_base
|
||||||
|
board = heltec_wifi_lora_32_V3
|
||||||
|
build_flags =
|
||||||
|
${esp32s3_base.build_flags} -DHELTEC_V3 -DUSE_SX1268
|
|
@ -0,0 +1,8 @@
|
||||||
|
[env:t_internet_poe]
|
||||||
|
extends = esp32_base
|
||||||
|
board = esp32doit-devkit-v1
|
||||||
|
build_flags =
|
||||||
|
${esp32_base.build_flags} -DT_INTERNET_POE
|
||||||
|
-DOLED_SDA=33 -DOLED_SCL=32
|
||||||
|
-DLORA_SCK=14 -DLORA_MISO=2 -DLORA_MOSI=15 -DLORA_CS=12 -DLORA_IRQ=36 -DLORA_RST=4 -DUSE_SX1278
|
||||||
|
-DETH_MDC=23 -DETH_MDIO=18 -DETH_NRESET=5 -DETH_ADDR=0 -DETH_POWER=-1 -DETH_CLOCK=3 -DETH_TYPE=0
|
|
@ -0,0 +1,57 @@
|
||||||
|
#ifndef Pins_Arduino_h
|
||||||
|
#define Pins_Arduino_h
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define USB_VID 0x303a
|
||||||
|
#define USB_PID 0x1001
|
||||||
|
|
||||||
|
#define EXTERNAL_NUM_INTERRUPTS 46
|
||||||
|
#define NUM_DIGITAL_PINS 48
|
||||||
|
#define NUM_ANALOG_INPUTS 20
|
||||||
|
|
||||||
|
#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
|
||||||
|
#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
|
||||||
|
#define digitalPinHasPWM(p) (p < 46)
|
||||||
|
|
||||||
|
#define TX 43
|
||||||
|
#define RX 44
|
||||||
|
|
||||||
|
// The default Wire will be mapped to PMU and RTC
|
||||||
|
#define SDA 42
|
||||||
|
#define SCL 41
|
||||||
|
|
||||||
|
// Wire1 will be mapped to display and QMC6310 sensor
|
||||||
|
#define OLED_SDA 17
|
||||||
|
#define OLED_SCL 18
|
||||||
|
|
||||||
|
// Default SPI will be mapped to Radio
|
||||||
|
#define SS 10
|
||||||
|
#define MOSI 11
|
||||||
|
#define MISO 13
|
||||||
|
#define SCK 12
|
||||||
|
|
||||||
|
#define LORA_CS 10
|
||||||
|
#define LORA_MOSI 11
|
||||||
|
#define LORA_MISO 13
|
||||||
|
#define LORA_SCK 12
|
||||||
|
#define DIO0 -1
|
||||||
|
#define RST_LoRa 5
|
||||||
|
#define BUSY_LoRa 4
|
||||||
|
|
||||||
|
#define LORA_IRQ 1
|
||||||
|
#define LORA_RST 5
|
||||||
|
|
||||||
|
// Another SPI bus shares SD card and QMI8653 inertial measurement sensor
|
||||||
|
#define SPI_MOSI (35)
|
||||||
|
#define SPI_SCK (36)
|
||||||
|
#define SPI_MISO (37)
|
||||||
|
#define SPI_CS (47)
|
||||||
|
#define IMU_CS (34)
|
||||||
|
|
||||||
|
#define SDCARD_CS SPI_CS
|
||||||
|
#define IMU_INT (33)
|
||||||
|
// #define PMU_IRQ (40)
|
||||||
|
#define RTC_INT (14)
|
||||||
|
|
||||||
|
#endif /* Pins_Arduino_h */
|
|
@ -0,0 +1,9 @@
|
||||||
|
[env:tbeam-s3-core]
|
||||||
|
extends = esp32s3_base
|
||||||
|
board = tbeam-s3-core
|
||||||
|
build_flags =
|
||||||
|
${esp32s3_base.build_flags} -Ivariants/tbeam-s3-core -DTBEAM_S3_CORE -DUSE_SX1268 -DHAS_AXP2101 -DGPS_RX_PIN=9 -DGPS_TX_PIN=8
|
||||||
|
|
||||||
|
#-DI2C_SDA=17 -DI2C_SCL=18 -DI2C_SDA1=42 -DI2C_SCL1=41
|
||||||
|
# I2C_SDA1 and I2C_SCL1 - Used for PMU management and PCF8563
|
||||||
|
# I2C_SDA and I2C_SCL - For QMC6310 sensors and screens
|
|
@ -0,0 +1,5 @@
|
||||||
|
[env:tbeam]
|
||||||
|
extends = esp32_base
|
||||||
|
board = ttgo-t-beam
|
||||||
|
build_flags =
|
||||||
|
${esp32_base.build_flags} -DTBEAM_V10 -DUSE_SX1278 -DGPS_RX_PIN=34 -DGPS_TX_PIN=12 -DHAS_AXP192
|
|
@ -0,0 +1,5 @@
|
||||||
|
[env:tbeam_axp2101]
|
||||||
|
extends = esp32_base
|
||||||
|
board = ttgo-t-beam
|
||||||
|
build_flags =
|
||||||
|
${esp32_base.build_flags} -DTBEAM_V12_AXP2101 -DUSE_SX1278 -DGPS_RX_PIN=34 -DGPS_TX_PIN=12 -DHAS_AXP2101
|
|
@ -0,0 +1,5 @@
|
||||||
|
[env:tlora-v1]
|
||||||
|
extends = esp32_base
|
||||||
|
board = ttgo-lora32-v1
|
||||||
|
build_flags =
|
||||||
|
${esp32_base.build_flags} -DTLORA_V1 -DRESET_OLED=16 -DUSE_SX1278
|
|
@ -0,0 +1,6 @@
|
||||||
|
[env:tlora-v2]
|
||||||
|
extends = esp32_base
|
||||||
|
board = ttgo-lora32-v1
|
||||||
|
board_level = extra
|
||||||
|
build_flags =
|
||||||
|
${esp32_base.build_flags} -DTLORA_V2 -DUSE_SX1278
|
Ładowanie…
Reference in New Issue