Merge branch 'master' into platformio_dependabot/Adafruit_GFX_Library/1.11.5

pull/84/head
Peter Buchegger 2023-01-21 13:52:12 +01:00 zatwierdzone przez GitHub
commit 8d04e5ccef
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 39 dodań i 34 usunięć

Wyświetl plik

@ -14,6 +14,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: run PlatformIO Dependabot
uses: peterus/platformio_dependabot@v1.0.1
uses: peterus/platformio_dependabot@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

Wyświetl plik

@ -2,7 +2,7 @@
default_envs = ttgo-t-beam-v1
[env]
platform = espressif32 @ 3.0.0
platform = espressif32 @ 6.0.0
framework = arduino
lib_ldf_mode = deep+
monitor_speed = 115200
@ -12,12 +12,12 @@ lib_deps =
adafruit/Adafruit SSD1306 @ 2.5.7
bblanchon/ArduinoJson @ 6.20.0
lewisxhe/AXP202X_Library @ 1.1.3
sandeepmistry/LoRa @ 0.7.2
sandeepmistry/LoRa @ 0.8.0
peterus/APRS-Decoder-Lib @ 0.0.6
mikalhart/TinyGPSPlus @ 1.0.3
paulstoffregen/Time @ 1.6
shaggydog/OneButton @ 1.5.0
peterus/esp-logger @ 0.0.1
peterus/esp-logger @ 1.0.0
check_tool = cppcheck
check_flags =
cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK

Wyświetl plik

@ -15,6 +15,8 @@
#define VERSION "22.19.0"
logging::Logger logger;
Configuration Config;
BeaconManager BeaconMan;
@ -65,9 +67,9 @@ void setup() {
#ifdef TTGO_T_Beam_V1_0
Wire.begin(SDA, SCL);
if (!powerManagement.begin(Wire)) {
logPrintlnI("AXP192 init done!");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "AXP192", "init done!");
} else {
logPrintlnE("AXP192 init failed!");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "AXP192", "init failed!");
}
powerManagement.activateLoRa();
powerManagement.activateOLED();
@ -76,8 +78,8 @@ void setup() {
#endif
delay(500);
logPrintlnI("LoRa APRS Tracker by OE5BPA (Peter Buchegger)");
logPrintlnI("Version: " VERSION);
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "LoRa APRS Tracker by OE5BPA (Peter Buchegger)");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Version: " VERSION);
setup_display();
show_display("OE5BPA", "LoRa APRS Tracker", "by Peter Buchegger", "Version: " VERSION, 2000);
@ -105,9 +107,9 @@ void setup() {
}
userButton.attachDoubleClick(toggle_display);
logPrintlnI("Smart Beacon is " + getSmartBeaconState());
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Smart Beacon is: %s", getSmartBeaconState());
show_display("INFO", "Smart Beacon is " + getSmartBeaconState(), 1000);
logPrintlnI("setup done...");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "setup done...");
delay(500);
}
@ -137,10 +139,11 @@ void loop() {
if (gps_loc_update != gps_loc_update_valid) {
gps_loc_update_valid = gps_loc_update;
if (gps_loc_update)
logPrintlnI("GPS fix state went to VALID");
else
logPrintlnI("GPS fix state went to INVALID");
if (gps_loc_update) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Loop", "GPS fix state went to VALID");
} else {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Loop", "GPS fix state went to INVALID");
}
}
static double currentHeading = 0;
@ -292,7 +295,7 @@ void loop() {
msg.getBody()->setData(aprsmsg);
String data = msg.encode();
logPrintlnD(data);
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, "Loop", "%s", data);
show_display("<< TX >>", data);
if (Config.ptt.active) {
@ -351,8 +354,9 @@ void loop() {
}
if ((Config.debug == false) && (millis() > 5000 && gps.charsProcessed() < 10)) {
logPrintlnE("No GPS frames detected! Try to reset the GPS Chip with this "
"firmware: https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "GPS",
"No GPS frames detected! Try to reset the GPS Chip with this "
"firmware: https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset");
show_display("No GPS frames detected!", "Try to reset the GPS Chip", "https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset", 2000);
}
}
@ -362,8 +366,9 @@ void load_config() {
Config = confmg.readConfiguration();
BeaconMan.loadConfig(Config.beacons);
if (BeaconMan.getCurrentBeaconConfig()->callsign == "NOCALL-10") {
logPrintlnE("You have to change your settings in 'data/tracker.json' and "
"upload it via \"Upload File System image\"!");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Config",
"You have to change your settings in 'data/tracker.json' and "
"upload it via \"Upload File System image\"!");
show_display("ERROR", "You have to change your settings in 'data/tracker.json' and "
"upload it via \"Upload File System image\"!");
while (true) {
@ -372,16 +377,15 @@ void load_config() {
}
void setup_lora() {
logPrintlnI("Set SPI pins!");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "Set SPI pins!");
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
logPrintlnI("Set LoRa pins!");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "Set LoRa pins!");
LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ);
long freq = Config.lora.frequencyTx;
logPrintI("frequency: ");
logPrintlnI(String(freq));
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "frequency: %d", freq);
if (!LoRa.begin(freq)) {
logPrintlnE("Starting LoRa failed!");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "LoRa", "Starting LoRa failed!");
show_display("ERROR", "Starting LoRa failed!");
while (true) {
}
@ -392,7 +396,7 @@ void setup_lora() {
LoRa.enableCrc();
LoRa.setTxPower(Config.lora.power);
logPrintlnI("LoRa init done!");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "LoRa init done!");
show_display("INFO", "LoRa init done!", 2000);
}

Wyświetl plik

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

Wyświetl plik

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