Switch project from Arduino to PlatformIO (#52)
* Moved to platformio * Moved cad models and schematics under extras * Update README.md * Added .gitignore * Specify upload protocol * Refactor platformio.ini * Allow building igate mode from platformio file * Move images to extras * Update readme * Update readme * Use specific arduinoespressif version * Added ttgo-lora32-v1 * Rename file and update gitignore * Fix warnings * Update readme * Update readme * Do not send telemetry in igate mode and send battery level every minutemaster
|
@ -1,33 +1,2 @@
|
||||||
# Prerequisites
|
.pio
|
||||||
*.d
|
.vscode
|
||||||
|
|
||||||
# Compiled Object files
|
|
||||||
*.slo
|
|
||||||
*.lo
|
|
||||||
*.o
|
|
||||||
*.obj
|
|
||||||
|
|
||||||
# Precompiled Headers
|
|
||||||
*.gch
|
|
||||||
*.pch
|
|
||||||
|
|
||||||
# Compiled Dynamic libraries
|
|
||||||
*.so
|
|
||||||
*.dylib
|
|
||||||
*.dll
|
|
||||||
|
|
||||||
# Fortran module files
|
|
||||||
*.mod
|
|
||||||
*.smod
|
|
||||||
|
|
||||||
# Compiled Static libraries
|
|
||||||
*.lai
|
|
||||||
*.la
|
|
||||||
*.a
|
|
||||||
*.lib
|
|
||||||
|
|
||||||
# Executables
|
|
||||||
*.exe
|
|
||||||
*.out
|
|
||||||
*.app
|
|
||||||
*.log
|
|
20
README.md
|
@ -1,5 +1,5 @@
|
||||||
# ESP32 LoRa APRS Modem
|
# ESP32 LoRa APRS Modem
|
||||||
![Modes of operation](images/diagram.png)
|
![Modes of operation](extras/images/diagram.png)
|
||||||
|
|
||||||
This project is amateur radio ESP32 based LoRa **KISS Bluetooth/BLE/USB/TCPIP** modem + LoRa **APRS-IS RX/TX iGate** server over WiFI + LoRa **APRS digipeater** + **Codec2 DV modem** (with Codec2 Talkie Android application).
|
This project is amateur radio ESP32 based LoRa **KISS Bluetooth/BLE/USB/TCPIP** modem + LoRa **APRS-IS RX/TX iGate** server over WiFI + LoRa **APRS digipeater** + **Codec2 DV modem** (with Codec2 Talkie Android application).
|
||||||
|
|
||||||
|
@ -22,18 +22,12 @@ Modules, which are used by users and known to work
|
||||||
- RA-02 (SX1276)
|
- RA-02 (SX1276)
|
||||||
- TTGO T-Beam (SX1276)
|
- TTGO T-Beam (SX1276)
|
||||||
|
|
||||||
# Dependencies
|
# Building
|
||||||
Install via board manager:
|
- Update `include/config.h`
|
||||||
- Arduino ESP32 (search for esp32): https://github.com/espressif/arduino-esp32
|
- Build for client/tracker mode `pio run -e esp32dev`
|
||||||
- Use latest 2.0.5+ version, if board manager does not list it then update "Additional boards manager URL" to https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
- Build for iGate `pio run -e esp32dev_igate`
|
||||||
|
|
||||||
Install via libraries:
|
|
||||||
- RadioLib library: https://github.com/jgromes/RadioLib
|
|
||||||
- Arduino Timer library: https://github.com/contrem/arduino-timer
|
|
||||||
- CircularBuffer library: https://github.com/rlogiacco/CircularBuffer
|
|
||||||
- DebugLog library: https://github.com/hideakitai/DebugLog
|
|
||||||
|
|
||||||
# Development board
|
# Development board
|
||||||
Development board schematics, case and antenna models are available under `cad` and `schematics`.
|
Development board schematics, case and antenna models are available under `extras/cad` and `extras/schematics`.
|
||||||
|
|
||||||
![Modes of operation](images/device.png)
|
![Modes of operation](extras/images/device.png)
|
||||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 142 KiB Po Szerokość: | Wysokość: | Rozmiar: 142 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 27 KiB Po Szerokość: | Wysokość: | Rozmiar: 27 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 15 KiB Po Szerokość: | Wysokość: | Rozmiar: 15 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 58 KiB Po Szerokość: | Wysokość: | Rozmiar: 58 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 66 KiB Po Szerokość: | Wysokość: | Rozmiar: 66 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 57 KiB Po Szerokość: | Wysokość: | Rozmiar: 57 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 19 KiB Po Szerokość: | Wysokość: | Rozmiar: 19 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 132 KiB Po Szerokość: | Wysokość: | Rozmiar: 132 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 130 KiB Po Szerokość: | Wysokość: | Rozmiar: 130 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 45 KiB Po Szerokość: | Wysokość: | Rozmiar: 45 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 53 KiB Po Szerokość: | Wysokość: | Rozmiar: 53 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 564 KiB Po Szerokość: | Wysokość: | Rozmiar: 564 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 134 KiB Po Szerokość: | Wysokość: | Rozmiar: 134 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 64 KiB Po Szerokość: | Wysokość: | Rozmiar: 64 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 86 KiB Po Szerokość: | Wysokość: | Rozmiar: 86 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 39 KiB Po Szerokość: | Wysokość: | Rozmiar: 39 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 118 KiB Po Szerokość: | Wysokość: | Rozmiar: 118 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 39 KiB Po Szerokość: | Wysokość: | Rozmiar: 39 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 31 KiB Po Szerokość: | Wysokość: | Rozmiar: 31 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 29 KiB Po Szerokość: | Wysokość: | Rozmiar: 29 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 247 KiB Po Szerokość: | Wysokość: | Rozmiar: 247 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 147 KiB Po Szerokość: | Wysokość: | Rozmiar: 147 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 99 KiB Po Szerokość: | Wysokość: | Rozmiar: 99 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 567 KiB Po Szerokość: | Wysokość: | Rozmiar: 567 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 23 KiB Po Szerokość: | Wysokość: | Rozmiar: 23 KiB |
|
@ -18,7 +18,9 @@
|
||||||
#define CFG_LOG_LEVEL DebugLogLevel::LVL_INFO
|
#define CFG_LOG_LEVEL DebugLogLevel::LVL_INFO
|
||||||
|
|
||||||
// select between client mode and APRS-IS gate mode
|
// select between client mode and APRS-IS gate mode
|
||||||
|
#ifndef CFG_IS_CLIENT_MODE
|
||||||
#define CFG_IS_CLIENT_MODE true // false - server mode (APRS-IS gate mode)
|
#define CFG_IS_CLIENT_MODE true // false - server mode (APRS-IS gate mode)
|
||||||
|
#endif
|
||||||
|
|
||||||
// change pinouts if not defined through native board LORA_* definitions
|
// change pinouts if not defined through native board LORA_* definitions
|
||||||
#ifndef LORA_RST
|
#ifndef LORA_RST
|
|
@ -46,7 +46,8 @@ protected:
|
||||||
enum DataType {
|
enum DataType {
|
||||||
Raw = 0,
|
Raw = 0,
|
||||||
Control,
|
Control,
|
||||||
Reboot
|
Reboot,
|
||||||
|
None = 0x80
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int CfgSerialToRigQueueSize = 4096;
|
static const int CfgSerialToRigQueueSize = 4096;
|
|
@ -125,7 +125,7 @@ private:
|
||||||
const int CfgConnRetryMs = 500; // connection retry delay, e.g. wifi
|
const int CfgConnRetryMs = 500; // connection retry delay, e.g. wifi
|
||||||
const int CfgPollDelayMs = 20; // main loop delay
|
const int CfgPollDelayMs = 20; // main loop delay
|
||||||
const int CfgConnRetryMaxTimes = 10; // number of connection retries
|
const int CfgConnRetryMaxTimes = 10; // number of connection retries
|
||||||
const int CfgTelemetryPeriodMs = 30000; // how often to send telemetry event
|
const int CfgTelemetryPeriodMs = 60000; // how often to send telemetry event
|
||||||
|
|
||||||
static const int CfgMaxPacketSize = 256; // maximum packet size
|
static const int CfgMaxPacketSize = 256; // maximum packet size
|
||||||
static const int CfgRadioQueueSize = 1024; // radio queue size
|
static const int CfgRadioQueueSize = 1024; // radio queue size
|
|
@ -0,0 +1,36 @@
|
||||||
|
[platformio]
|
||||||
|
description = ESP32 LoRA APRS modem
|
||||||
|
default_envs = esp32dev
|
||||||
|
|
||||||
|
[env]
|
||||||
|
platform = espressif32 @ 5.2.0
|
||||||
|
framework = arduino
|
||||||
|
monitor_speed = 115200
|
||||||
|
board_build.partitions = min_spiffs.csv
|
||||||
|
board_build.f_cpu = 80000000L
|
||||||
|
upload_protocol = esptool
|
||||||
|
lib_deps =
|
||||||
|
hideakitai/DebugLog @ 0.6.6
|
||||||
|
contrem/arduino-timer @ 2.3.1
|
||||||
|
jgromes/RadioLib @ 5.5.0
|
||||||
|
rlogiacco/CircularBuffer @ 1.3.3
|
||||||
|
check_tool = cppcheck
|
||||||
|
check_flags =
|
||||||
|
cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK
|
||||||
|
check_skip_packages = yes
|
||||||
|
|
||||||
|
[env:esp32dev]
|
||||||
|
board = esp32dev
|
||||||
|
build_flags =
|
||||||
|
'-D CFG_IS_CLIENT_MODE=true'
|
||||||
|
|
||||||
|
[env:esp32dev_igate]
|
||||||
|
board = esp32dev
|
||||||
|
board_build.f_cpu = 240000000L
|
||||||
|
build_flags =
|
||||||
|
'-D CFG_IS_CLIENT_MODE=false'
|
||||||
|
|
||||||
|
[env:ttgo-lora32-v1]
|
||||||
|
board = ttgo-lora32-v1
|
||||||
|
build_flags =
|
||||||
|
'-D CFG_IS_CLIENT_MODE=true'
|
|
@ -43,6 +43,8 @@ class BLESerialCharacteristicCallbacks: public BLECharacteristicCallbacks {
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|
||||||
BLESerial::BLESerial()
|
BLESerial::BLESerial()
|
||||||
|
: pService(NULL)
|
||||||
|
, pTxCharacteristic(NULL)
|
||||||
{
|
{
|
||||||
// create instance
|
// create instance
|
||||||
receiveBuffer = "";
|
receiveBuffer = "";
|
|
@ -7,6 +7,7 @@ Processor::Processor()
|
||||||
, usePrefix3_(false)
|
, usePrefix3_(false)
|
||||||
, isRawIdle_(true)
|
, isRawIdle_(true)
|
||||||
, state_(State::GetStart)
|
, state_(State::GetStart)
|
||||||
|
, dataType_(DataType::None)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,14 @@ volatile bool Service::rigIsRxIsrEnabled_ = true;
|
||||||
|
|
||||||
Service::Service()
|
Service::Service()
|
||||||
: Kiss::Processor()
|
: Kiss::Processor()
|
||||||
|
, config_()
|
||||||
, csmaP_(CfgCsmaPersistence)
|
, csmaP_(CfgCsmaPersistence)
|
||||||
, csmaSlotTime_(CfgCsmaSlotTimeMs)
|
, csmaSlotTime_(CfgCsmaSlotTimeMs)
|
||||||
, csmaSlotTimePrev_(0)
|
, csmaSlotTimePrev_(0)
|
||||||
|
, beaconLastTimestampMs_(0)
|
||||||
, rigCurrentTxPacketSize_(0)
|
, rigCurrentTxPacketSize_(0)
|
||||||
, isIsrInstalled_(false)
|
, isIsrInstalled_(false)
|
||||||
|
, rigIsImplicitMode_(false)
|
||||||
, serialBt_()
|
, serialBt_()
|
||||||
, serialBLE_()
|
, serialBLE_()
|
||||||
, kissServer_(new WiFiServer(CfgKissPort))
|
, kissServer_(new WiFiServer(CfgKissPort))
|
||||||
|
@ -89,7 +92,7 @@ void Service::setup(const Config &conf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// telemetry event
|
// telemetry event
|
||||||
if (config_.TlmEnable) {
|
if (config_.TlmEnable && config_.IsClientMode) {
|
||||||
LOG_INFO("Telemetry event is enabled");
|
LOG_INFO("Telemetry event is enabled");
|
||||||
telemetryTimer_.every(CfgTelemetryPeriodMs, sendModemTelemetryTimer, this);
|
telemetryTimer_.every(CfgTelemetryPeriodMs, sendModemTelemetryTimer, this);
|
||||||
}
|
}
|
|
@ -105,6 +105,11 @@ LoraPrs::Service loraPrsService;
|
||||||
|
|
||||||
auto watchdogLedTimer = timer_create_default();
|
auto watchdogLedTimer = timer_create_default();
|
||||||
|
|
||||||
|
bool toggleWatchdogLed(void *) {
|
||||||
|
digitalWrite(BUILTIN_LED, !digitalRead(BUILTIN_LED));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
pinMode(BUILTIN_LED, OUTPUT);
|
pinMode(BUILTIN_LED, OUTPUT);
|
||||||
digitalWrite(BUILTIN_LED, 1);
|
digitalWrite(BUILTIN_LED, 1);
|
||||||
|
@ -124,8 +129,3 @@ void loop() {
|
||||||
loraPrsService.loop();
|
loraPrsService.loop();
|
||||||
watchdogLedTimer.tick();
|
watchdogLedTimer.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool toggleWatchdogLed(void *) {
|
|
||||||
digitalWrite(BUILTIN_LED, !digitalRead(BUILTIN_LED));
|
|
||||||
return true;
|
|
||||||
}
|
|