kopia lustrzana https://github.com/lora-aprs/LoRa_APRS_iGate
remove BoardFinder and implement first boards (not all are still supported)
rodzic
5b7fd68ba5
commit
08dc8380bc
|
@ -4,52 +4,22 @@ extends = arduino_base
|
|||
platform = platformio/espressif32 @ 6.3.2
|
||||
|
||||
build_src_filter =
|
||||
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/>
|
||||
${arduino_base.build_src_filter}
|
||||
|
||||
upload_speed = 921600
|
||||
debug_init_break = tbreak setup
|
||||
monitor_filters = esp32_exception_decoder
|
||||
|
||||
;board_build.filesystem = littlefs
|
||||
|
||||
# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
|
||||
# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
|
||||
# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
|
||||
build_flags =
|
||||
${arduino_base.build_flags}
|
||||
-Wall
|
||||
; -Wextra
|
||||
-Isrc/platform/esp32
|
||||
-std=c++2a
|
||||
; -std=c++11
|
||||
-DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
|
||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||
-DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL
|
||||
-DAXP_DEBUG_PORT=Serial
|
||||
-DCONFIG_BT_NIMBLE_ENABLED
|
||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
|
||||
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
||||
-DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=5120
|
||||
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
||||
-DSERIAL_BUFFER_SIZE=4096
|
||||
;-DDEBUG_HEAP
|
||||
|
||||
;lib_deps =
|
||||
; ${arduino_base.lib_deps}
|
||||
; ${networking_base.lib_deps}
|
||||
; ${environmental_base.lib_deps}
|
||||
; h2zero/NimBLE-Arduino@^1.4.1
|
||||
; jgromes/RadioLib@^6.1.0
|
||||
; https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
|
||||
|
||||
;lib_ignore =
|
||||
; segger_rtt
|
||||
; ESP32 BLE Arduino
|
||||
|
||||
; leave this commented out to avoid breaking Windows
|
||||
;upload_port = /dev/ttyUSB0
|
||||
;monitor_port = /dev/ttyUSB0
|
||||
|
||||
; customize the partition table
|
||||
; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
|
||||
;board_build.partitions = partition-table.csv
|
||||
lib_deps =
|
||||
${arduino_base.lib_deps}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[esp32s3_base]
|
||||
extends = esp32_base
|
|
@ -26,24 +26,22 @@ extra_configs =
|
|||
[env]
|
||||
;extra_scripts = bin/platformio-custom.py
|
||||
|
||||
build_flags = -Wno-missing-field-initializers
|
||||
-Wno-format
|
||||
; -Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map
|
||||
; -DUSE_THREAD_NAMES
|
||||
; -DTINYGPS_OPTION_NO_CUSTOM_FIELDS
|
||||
; -DPB_ENABLE_MALLOC=1
|
||||
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_AX25
|
||||
-DRADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
-DRADIOLIB_EXCLUDE_BELL
|
||||
-DRADIOLIB_EXCLUDE_PAGER
|
||||
|
@ -69,26 +67,13 @@ check_flags =
|
|||
--suppressions-list=suppressions.txt
|
||||
--inline-suppr
|
||||
|
||||
;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
|
||||
;test_build_src = yes
|
||||
test_build_src = yes
|
||||
|
||||
[arduino_base]
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
|
||||
build_flags = ${env.build_flags} -Os -DRADIOLIB_SPI_PARANOID=0
|
||||
build_flags = ${env.build_flags} -Os
|
||||
build_src_filter = ${env.build_src_filter} -<platform/portduino/>
|
||||
|
||||
;[env:lora_board]
|
||||
;board = esp32doit-devkit-v1
|
||||
;build_flags = -Werror -Wall -DUNITY_INCLUDE_PRINT_FORMATTED
|
||||
;
|
||||
;[env:lora_v3_board]
|
||||
;board = heltec_wifi_lora_32_V3
|
||||
;build_flags = -Werror -Wall -DUNITY_INCLUDE_PRINT_FORMATTED
|
||||
;
|
||||
;[env:lora_board_debug]
|
||||
;board = esp32doit-devkit-v1
|
||||
;build_flags = -Werror -Wall -DCORE_DEBUG_LEVEL=5 -DUNITY_INCLUDE_PRINT_FORMATTED
|
||||
;build_type = debug
|
||||
debug_init_break = tbreak setup
|
||||
|
|
|
@ -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,18 +8,26 @@ Display::Display() : _disp(0), _statusFrame(0), _displaySaveMode(false) {
|
|||
Display::~Display() {
|
||||
}
|
||||
|
||||
void Display::setup(BoardConfig const *const boardConfig) {
|
||||
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);
|
||||
}
|
||||
Wire.begin(boardConfig->Oled.Sda, boardConfig->Oled.Scl);
|
||||
_disp = new SSD1306(&Wire, boardConfig->Oled.Addr);
|
||||
void Display::setup() {
|
||||
Serial.println("oled reset");
|
||||
#ifdef RESET_OLED
|
||||
pinMode(RESET_OLED, OUTPUT);
|
||||
digitalWrite(RESET_OLED, HIGH);
|
||||
delay(1);
|
||||
digitalWrite(RESET_OLED, LOW);
|
||||
delay(10);
|
||||
digitalWrite(RESET_OLED, HIGH);
|
||||
#endif
|
||||
Serial.println("Wire begin");
|
||||
#if defined(OLED_SDA) && defined(OLED_SCL)
|
||||
Wire.begin(OLED_SDA, OLED_SCL);
|
||||
#else
|
||||
Wire.begin(SDA, SCL);
|
||||
#endif
|
||||
Serial.println("SSD1306 init");
|
||||
_disp = new SSD1306(&Wire, 0x3C);
|
||||
|
||||
Serial.println("SSD1306 setup");
|
||||
Bitmap bitmap(_disp->getWidth(), _disp->getHeight());
|
||||
_disp->display(&bitmap);
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef DISPLAY_H_
|
||||
#define DISPLAY_H_
|
||||
|
||||
#include "BoardFinder/BoardFinder.h"
|
||||
#include "Display/SSD1306.h"
|
||||
#include "System/Timer.h"
|
||||
#include <Arduino.h>
|
||||
|
@ -27,7 +26,7 @@ public:
|
|||
Display();
|
||||
~Display();
|
||||
|
||||
void setup(BoardConfig const *const boardConfig);
|
||||
void setup();
|
||||
// setup functions
|
||||
void showSpashScreen(String firmwareTitle, String version);
|
||||
void setStatusFrame(std::shared_ptr<StatusFrame> frame);
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
#include "LoRaModem.h"
|
||||
|
||||
// SX1278
|
||||
#ifdef USE_SX1278
|
||||
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 BWkHz = (float)lora_config.signalBandwidth / 1000;
|
||||
|
||||
SPI.begin(lora_pins.Sck, lora_pins.Miso, lora_pins.Mosi, lora_pins.CS);
|
||||
_module = new Module(lora_pins.CS, lora_pins.IRQ, lora_pins.Reset);
|
||||
#if defined(LORA_SCK) && defined(LORA_MISO) && defined(LORA_MOSI) && defined(LORA_CS)
|
||||
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);
|
||||
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
|
||||
#elif defined(USE_SX1268)
|
||||
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 BWkHz = (float)lora_config.signalBandwidth / 1000;
|
||||
|
||||
SPI.begin(lora_pins.Sck, lora_pins.Miso, lora_pins.Mosi, lora_pins.CS);
|
||||
_module = new Module(lora_pins.CS, lora_pins.IRQ, lora_pins.Reset, 13);
|
||||
#if defined(LORA_SCK) && defined(LORA_MISO) && defined(LORA_MOSI) && defined(LORA_CS)
|
||||
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);
|
||||
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() {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <RadioLib.h>
|
||||
|
||||
#include "BoardFinder/BoardFinder.h"
|
||||
#include "project_configuration.h"
|
||||
|
||||
class LoRaModem {
|
||||
|
@ -14,7 +13,7 @@ public:
|
|||
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;
|
||||
|
||||
|
@ -33,11 +32,12 @@ protected:
|
|||
Module *_module;
|
||||
};
|
||||
|
||||
#ifdef USE_SX1278
|
||||
class Modem_SX1278 : public LoRaModem {
|
||||
public:
|
||||
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;
|
||||
|
||||
|
@ -56,11 +56,12 @@ private:
|
|||
SX1278 *_radio;
|
||||
};
|
||||
|
||||
#elif defined(USE_SX1268)
|
||||
class Modem_SX1268 : public LoRaModem {
|
||||
public:
|
||||
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;
|
||||
|
||||
|
@ -78,5 +79,6 @@ public:
|
|||
private:
|
||||
SX1262 *_radio;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <map>
|
||||
|
||||
#include "APRS-IS/APRS-IS.h"
|
||||
#include "BoardFinder/BoardFinder.h"
|
||||
#include "PowerManagement/power_management.h"
|
||||
#include "System/System.h"
|
||||
#include "System/TaskManager.h"
|
||||
|
@ -57,68 +56,35 @@ void setup() {
|
|||
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);
|
||||
|
||||
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());
|
||||
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) {
|
||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_WARN, MODULE_NAME, "Watchdog init failed!");
|
||||
} else {
|
||||
if (esp_task_wdt_add(NULL) != ESP_OK) {
|
||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_WARN, MODULE_NAME, "Watchdog add failed!");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (boardConfig->Type == eTTGO_T_Beam_V1_0) {
|
||||
Wire.begin(boardConfig->Oled.Sda, boardConfig->Oled.Scl);
|
||||
PowerManagement powerManagement;
|
||||
if (!powerManagement.begin(Wire)) {
|
||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "AXP192 init done!");
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
#ifdef TBEAM_V10
|
||||
Wire.begin(SDA, SCL);
|
||||
PowerManagement powerManagement;
|
||||
if (!powerManagement.begin(Wire)) {
|
||||
LoRaSystem.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, MODULE_NAME, "AXP192 init done!");
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
#endif
|
||||
|
||||
LoRaSystem.setBoardConfig(boardConfig);
|
||||
LoRaSystem.setUserConfig(&userConfig);
|
||||
LoRaSystem.getTaskManager().addTask(&displayTask);
|
||||
LoRaSystem.getTaskManager().addTask(&modemTask);
|
||||
|
@ -131,10 +97,11 @@ void setup() {
|
|||
LoRaSystem.getTaskManager().addAlwaysRunTask(&wifiTask);
|
||||
tcpip = true;
|
||||
}
|
||||
if (boardConfig->Ethernet.isEthernetBoard()) {
|
||||
LoRaSystem.getTaskManager().addAlwaysRunTask(ðTask);
|
||||
tcpip = true;
|
||||
}
|
||||
|
||||
#ifdef TINTERNET_POE
|
||||
LoRaSystem.getTaskManager().addAlwaysRunTask(ðTask);
|
||||
tcpip = true;
|
||||
#endif
|
||||
|
||||
if (tcpip) {
|
||||
LoRaSystem.getTaskManager().addTask(&otaTask);
|
||||
|
@ -152,7 +119,7 @@ void setup() {
|
|||
}
|
||||
}
|
||||
|
||||
esp_task_wdt_reset();
|
||||
// esp_task_wdt_reset();
|
||||
LoRaSystem.getTaskManager().setup(LoRaSystem);
|
||||
|
||||
LoRaSystem.getDisplay().showSpashScreen("LoRa APRS iGate", VERSION);
|
||||
|
@ -161,7 +128,7 @@ void setup() {
|
|||
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.getDisplay().showStatusScreen("ERROR", "You have to change your settings in 'data/is-cfg.json' and upload it via \"Upload File System image\"!");
|
||||
while (true) {
|
||||
esp_task_wdt_reset();
|
||||
// esp_task_wdt_reset();
|
||||
}
|
||||
}
|
||||
if ((!userConfig.aprs_is.active) && !(userConfig.digi.active)) {
|
||||
|
@ -182,7 +149,7 @@ void setup() {
|
|||
volatile bool syslogSet = false;
|
||||
|
||||
void loop() {
|
||||
esp_task_wdt_reset();
|
||||
// esp_task_wdt_reset();
|
||||
LoRaSystem.getTaskManager().loop(LoRaSystem);
|
||||
if (LoRaSystem.isWifiOrEthConnected() && LoRaSystem.getUserConfig()->syslog.active && !syslogSet) {
|
||||
LoRaSystem.getLogger().setSyslogServer(LoRaSystem.getUserConfig()->syslog.server, LoRaSystem.getUserConfig()->syslog.port, LoRaSystem.getUserConfig()->callsign);
|
||||
|
|
|
@ -1,24 +1,16 @@
|
|||
|
||||
#include "System.h"
|
||||
|
||||
System::System() : _boardConfig(0), _userConfig(0), _isEthConnected(false), _isWifiConnected(false) {
|
||||
System::System() : _userConfig(0), _isEthConnected(false), _isWifiConnected(false) {
|
||||
}
|
||||
|
||||
System::~System() {
|
||||
}
|
||||
|
||||
void System::setBoardConfig(BoardConfig const *const boardConfig) {
|
||||
_boardConfig = boardConfig;
|
||||
}
|
||||
|
||||
void System::setUserConfig(Configuration const *const userConfig) {
|
||||
_userConfig = userConfig;
|
||||
}
|
||||
|
||||
BoardConfig const *const System::getBoardConfig() const {
|
||||
return _boardConfig;
|
||||
}
|
||||
|
||||
Configuration const *const System::getUserConfig() const {
|
||||
return _userConfig;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <logger.h>
|
||||
#include <memory>
|
||||
|
||||
#include "BoardFinder/BoardFinder.h"
|
||||
#include "ConfigurationManagement/configuration.h"
|
||||
#include "Display/Display.h"
|
||||
#include "TaskManager.h"
|
||||
|
@ -14,10 +13,8 @@ public:
|
|||
System();
|
||||
~System();
|
||||
|
||||
void setBoardConfig(BoardConfig const *const boardConfig);
|
||||
void setUserConfig(Configuration const *const userConfig);
|
||||
|
||||
BoardConfig const *const getBoardConfig() const;
|
||||
Configuration const *const getUserConfig() const;
|
||||
TaskManager &getTaskManager();
|
||||
Display &getDisplay();
|
||||
|
@ -27,7 +24,6 @@ public:
|
|||
logging::Logger &getLogger();
|
||||
|
||||
private:
|
||||
BoardConfig const *_boardConfig;
|
||||
Configuration const *_userConfig;
|
||||
TaskManager _taskManager;
|
||||
Display _display;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "BoardFinder/BoardFinder.h"
|
||||
#include "ConfigurationManagement/configuration.h"
|
||||
#include "Display/Display.h"
|
||||
|
||||
|
|
|
@ -22,21 +22,23 @@ void BeaconTask::pushButton() {
|
|||
}
|
||||
|
||||
bool BeaconTask::setup(System &system) {
|
||||
if (_instances++ == 0 && system.getBoardConfig()->Button.Pin != -1) {
|
||||
_userButton = OneButton(system.getBoardConfig()->Button.Pin, true, true);
|
||||
#ifdef KEY_BUILTIN
|
||||
if (_instances++ == 0 && KEY_BUILTIN != 0) {
|
||||
_userButton = OneButton(KEY_BUILTIN, true, true);
|
||||
_userButton.attachClick(pushButton);
|
||||
_send_update = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
_useGps = system.getUserConfig()->beacon.use_gps;
|
||||
|
||||
if (_useGps) {
|
||||
if (system.getBoardConfig()->Gps.Rx != -1) {
|
||||
_ss.begin(9600, SERIAL_8N1, system.getBoardConfig()->Gps.Tx, system.getBoardConfig()->Gps.Rx);
|
||||
} else {
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "NO GPS found.");
|
||||
_useGps = false;
|
||||
}
|
||||
#if defined(GPS_RX_PIN) && defined(GPS_TX_PIN)
|
||||
_ss.begin(9600, SERIAL_8N1, GPS_TX_PIN, GPS_RX_PIN);
|
||||
#else
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "NO GPS found.");
|
||||
_useGps = false;
|
||||
#endif
|
||||
}
|
||||
// setup beacon
|
||||
_beacon_timer.setTimeout(system.getUserConfig()->beacon.timeout * 60 * 1000);
|
||||
|
|
|
@ -10,7 +10,7 @@ DisplayTask::~DisplayTask() {
|
|||
}
|
||||
|
||||
bool DisplayTask::setup(System &system) {
|
||||
system.getDisplay().setup(system.getBoardConfig());
|
||||
system.getDisplay().setup();
|
||||
if (system.getUserConfig()->display.turn180) {
|
||||
system.getDisplay().turn180();
|
||||
}
|
||||
|
|
|
@ -78,27 +78,27 @@ EthTask::~EthTask() {
|
|||
bool EthTask::setup(System &system) {
|
||||
WiFi.onEvent(WiFiEvent);
|
||||
|
||||
if (system.getBoardConfig()->Ethernet.nReset != -1) {
|
||||
pinMode(system.getBoardConfig()->Ethernet.nReset, OUTPUT);
|
||||
digitalWrite(system.getBoardConfig()->Ethernet.nReset, 0);
|
||||
delay(200);
|
||||
digitalWrite(system.getBoardConfig()->Ethernet.nReset, 1);
|
||||
delay(200);
|
||||
digitalWrite(system.getBoardConfig()->Ethernet.nReset, 0);
|
||||
delay(200);
|
||||
digitalWrite(system.getBoardConfig()->Ethernet.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);
|
||||
|
||||
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);
|
||||
}
|
||||
if (system.getUserConfig()->network.hostname.overwrite) {
|
||||
ETH.setHostname(system.getUserConfig()->network.hostname.name.c_str());
|
||||
} else {
|
||||
ETH.setHostname(system.getUserConfig()->callsign.c_str());
|
||||
}
|
||||
// if (system.getBoardConfig()->Ethernet.nReset != -1) {
|
||||
// pinMode(system.getBoardConfig()->Ethernet.nReset, OUTPUT);
|
||||
// digitalWrite(system.getBoardConfig()->Ethernet.nReset, 0);
|
||||
// delay(200);
|
||||
// digitalWrite(system.getBoardConfig()->Ethernet.nReset, 1);
|
||||
// delay(200);
|
||||
// digitalWrite(system.getBoardConfig()->Ethernet.nReset, 0);
|
||||
// delay(200);
|
||||
// digitalWrite(system.getBoardConfig()->Ethernet.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);
|
||||
//
|
||||
// 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);
|
||||
//}
|
||||
// if (system.getUserConfig()->network.hostname.overwrite) {
|
||||
// ETH.setHostname(system.getUserConfig()->network.hostname.name.c_str());
|
||||
//} else {
|
||||
// ETH.setHostname(system.getUserConfig()->callsign.c_str());
|
||||
//}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,17 +25,17 @@ bool RadiolibTask::setup(System &system) {
|
|||
|
||||
const uint16_t preambleLength = 8;
|
||||
|
||||
if (system.getBoardConfig()->Lora.Modem == eSX1278) {
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] using SX1278", timeString().c_str());
|
||||
_modem = new Modem_SX1278();
|
||||
} else if (system.getBoardConfig()->Lora.Modem == eSX1268) {
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] using SX1268", timeString().c_str());
|
||||
_modem = new Modem_SX1268();
|
||||
} else {
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, getName(), "[%s] Modem not correctly defined!", timeString().c_str());
|
||||
}
|
||||
#ifdef USE_SX1278
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] using SX1278", timeString().c_str());
|
||||
_modem = new Modem_SX1278();
|
||||
#elif defined(USE_SX1268)
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] using SX1268", timeString().c_str());
|
||||
_modem = new Modem_SX1268();
|
||||
#else
|
||||
#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) {
|
||||
decodeError(system, state);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef TASK_LORA_H_
|
||||
#define TASK_LORA_H_
|
||||
|
||||
#include "BoardFinder/BoardFinder.h"
|
||||
#include "LoRaModem.h"
|
||||
#include "System/TaskManager.h"
|
||||
#include "project_configuration.h"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef PROJECT_CONFIGURATION_H_
|
||||
#define PROJECT_CONFIGURATION_H_
|
||||
|
||||
#include "BoardFinder/BoardFinder.h"
|
||||
#include "ConfigurationManagement/configuration.h"
|
||||
|
||||
class Configuration {
|
||||
|
|
|
@ -1,49 +1,14 @@
|
|||
// cppcheck suppressions
|
||||
assertWithSideEffect
|
||||
|
||||
// TODO: need to come back to these
|
||||
//duplInheritedMember
|
||||
unusedFunction
|
||||
|
||||
// TODO:
|
||||
// "Using memset() on struct which contains a floating point number."
|
||||
// tried:
|
||||
// if (std::is_floating_point<T>::value) {
|
||||
// p = 0;
|
||||
// in src/mesh/MemoryPool.h
|
||||
//memsetClassFloat
|
||||
// ignore "external" library issues
|
||||
shadowFunction:*TimeLib.cpp
|
||||
unreadVariable:*TimeLib.cpp
|
||||
|
||||
//knownConditionTrueFalse
|
||||
|
||||
// no real downside/harm in these
|
||||
//unusedFunction
|
||||
//unusedPrivateFunction
|
||||
|
||||
// most likely due to a cppcheck configuration issue (like missing an include)
|
||||
//syntaxError
|
||||
|
||||
// try to quiet a few
|
||||
//useInitializationList:src/main.cpp
|
||||
//useInitializationList
|
||||
|
||||
// I don't want to go back and cast function pointers just to appease a tools insatiable thirst for immutability
|
||||
//constParameterCallback
|
||||
|
||||
//redundantInitialization
|
||||
|
||||
//cstyleCast:src/mesh/MemoryPool.h:71
|
||||
//cstyleCast
|
||||
// ignore bitmask from ArduinoJson
|
||||
badBitmaskCheck:*project_configuration.cpp
|
||||
|
||||
// ignore stuff that is not ours
|
||||
*:.pio/*
|
||||
*:*/libdeps/*
|
||||
*:*/generated/*
|
||||
//noExplicitConstructor:*/mqtt/*
|
||||
//postfixOperator:*/mqtt/*
|
||||
|
||||
// these two caused issues
|
||||
//missingOverride
|
||||
//virtualCallInConstructor
|
||||
|
||||
//passedByValue:*/RedirectablePrint.h
|
||||
|
||||
//internalAstError:*/CrossPlatformCryptoEngine.cpp
|
||||
|
|
|
@ -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,5 @@
|
|||
[env:t_internet_poe]
|
||||
extends = esp32_base
|
||||
board = esp32doit-devkit-v1
|
||||
build_flags =
|
||||
${esp32_base.build_flags} -DTINTERNET_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
|
|
@ -0,0 +1,6 @@
|
|||
; The 1.0 release of the TBEAM board
|
||||
[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
|
|
@ -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
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
[env:tlora-v2]
|
||||
extends = esp32_base
|
||||
board = ttgo-lora32-v1
|
||||
board_level = extra
|
||||
build_flags =
|
||||
${esp32_base.build_flags} -D TLORA_V2 -I variants/tlora_v2
|
||||
${esp32_base.build_flags} -DTLORA_V2 -DUSE_SX1278
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
|
||||
|
||||
#define I2C_SDA 21 // I2C pins for this board
|
||||
#define I2C_SCL 22
|
||||
|
||||
#define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost
|
||||
#define LED_PIN 25 // If defined we will blink this LED
|
||||
#define BUTTON_PIN \
|
||||
0 // If defined, this will be used for user button presses, if your board doesn't have a physical switch, you can wire one
|
||||
// between this pin and ground
|
||||
#define BUTTON_NEED_PULLUP
|
||||
|
||||
#define USE_RF95
|
||||
#define LORA_DIO0 26 // a No connect on the SX1262 module
|
||||
#define LORA_RESET 14
|
||||
#define LORA_DIO1 33 // Must be manually wired: https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436
|
||||
#define LORA_DIO2 32 // Not really used
|
Ładowanie…
Reference in New Issue