kopia lustrzana https://github.com/meshtastic/firmware
Portduino logging enhancements (#3121)
* Portduino logging enhancements * Extra debugging for SPI devicepull/3122/head
rodzic
062c646814
commit
6b5101ec67
|
@ -95,3 +95,8 @@ Touchscreen:
|
|||
|
||||
Input:
|
||||
# KeyboardDevice: /dev/input/event0
|
||||
|
||||
###
|
||||
|
||||
Logging:
|
||||
# DebugMode: true
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef ARCH_PORTDUINO
|
||||
#include "platform/portduino/PortduinoGlue.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A printer that doesn't go anywhere
|
||||
*/
|
||||
|
@ -68,6 +72,10 @@ size_t RedirectablePrint::vprintf(const char *format, va_list arg)
|
|||
|
||||
size_t RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
||||
{
|
||||
#ifdef ARCH_PORTDUINO
|
||||
if (!settingsMap[debugmode] && strcmp(logLevel, "DEBUG") == 0)
|
||||
return 0;
|
||||
#endif
|
||||
if (moduleConfig.serial.override_console_serial_port && strcmp(logLevel, "DEBUG") == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -717,6 +717,7 @@ void setup()
|
|||
#ifdef ARCH_PORTDUINO
|
||||
if (settingsMap[use_sx1262]) {
|
||||
if (!rIf) {
|
||||
LOG_DEBUG("Attempting to activate sx1262 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||
rIf = new SX1262Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||
settingsMap[busy]);
|
||||
|
@ -730,6 +731,7 @@ void setup()
|
|||
}
|
||||
} else if (settingsMap[use_rf95]) {
|
||||
if (!rIf) {
|
||||
LOG_DEBUG("Attempting to activate rf95 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||
rIf = new RF95Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||
settingsMap[busy]);
|
||||
|
@ -744,6 +746,7 @@ void setup()
|
|||
}
|
||||
} else if (settingsMap[use_sx1280]) {
|
||||
if (!rIf) {
|
||||
LOG_DEBUG("Attempting to activate sx1280 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||
rIf = new SX1280Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||
settingsMap[busy]);
|
||||
|
|
|
@ -81,6 +81,7 @@ void portduinoSetup()
|
|||
YAML::Node yamlConfig;
|
||||
|
||||
if (configPath != nullptr) {
|
||||
std::cout << "Using " << configPath << " as config file" << std::endl;
|
||||
try {
|
||||
yamlConfig = YAML::LoadFile(configPath);
|
||||
} catch (YAML::Exception e) {
|
||||
|
@ -88,6 +89,7 @@ void portduinoSetup()
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else if (access("config.yaml", R_OK) == 0) {
|
||||
std::cout << "Using local config.yaml as config file" << std::endl;
|
||||
try {
|
||||
yamlConfig = YAML::LoadFile("config.yaml");
|
||||
} catch (YAML::Exception e) {
|
||||
|
@ -95,6 +97,7 @@ void portduinoSetup()
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else if (access("/etc/meshtasticd/config.yaml", R_OK) == 0) {
|
||||
std::cout << "Using /etc/meshtasticd/config.yaml as config file" << std::endl;
|
||||
try {
|
||||
yamlConfig = YAML::LoadFile("/etc/meshtasticd/config.yaml");
|
||||
} catch (YAML::Exception e) {
|
||||
|
@ -105,24 +108,13 @@ void portduinoSetup()
|
|||
std::cout << "No 'config.yaml' found, running simulated." << std::endl;
|
||||
// Set the random seed equal to TCPPort to have a different seed per instance
|
||||
randomSeed(TCPPort);
|
||||
|
||||
/* Aren't all pins defaulted to simulated?
|
||||
auto fakeBusy = new SimGPIOPin(SX126X_BUSY, "fakeBusy");
|
||||
fakeBusy->writePin(LOW);
|
||||
fakeBusy->setSilent(true);
|
||||
gpioBind(fakeBusy);
|
||||
|
||||
auto cs = new SimGPIOPin(SX126X_CS, "fakeLoraCS");
|
||||
cs->setSilent(true);
|
||||
gpioBind(cs);
|
||||
|
||||
gpioBind(new SimGPIOPin(SX126X_RESET, "fakeLoraReset"));
|
||||
gpioBind(new SimGPIOPin(LORA_DIO1, "fakeLoraIrq"));
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (yamlConfig["Logging"]) {
|
||||
settingsMap[debugmode] = yamlConfig["Logging"]["DebugMode"].as<bool>(false);
|
||||
}
|
||||
if (yamlConfig["Lora"]) {
|
||||
settingsMap[use_sx1262] = false;
|
||||
settingsMap[use_rf95] = false;
|
||||
|
|
|
@ -31,7 +31,8 @@ enum configNames {
|
|||
displayOffsetX,
|
||||
displayOffsetY,
|
||||
displayInvert,
|
||||
keyboardDevice
|
||||
keyboardDevice,
|
||||
debugmode
|
||||
};
|
||||
enum { no_screen, st7789, st7735, st7735s };
|
||||
enum { no_touchscreen, xpt2046 };
|
||||
|
|
Ładowanie…
Reference in New Issue