Add config option to set debug level, add trace calls for incoming and outgoing data

pull/42/head
sh123 2021-11-12 19:57:12 +02:00
rodzic 34663fb943
commit af096a3548
4 zmienionych plików z 12 dodań i 1 usunięć

Wyświetl plik

@ -2,6 +2,8 @@
#define SERIAL_BAUD_RATE 115200
#define CFG_LOG_LEVEL DebugLogLevel::LVL_INFO
// change pinouts if not defined through native board LORA_* definitions
#ifndef LORA_RST
#pragma message("LoRa pin definitions are not found, redefining...")

Wyświetl plik

@ -1,4 +1,5 @@
#include <arduino-timer.h>
#include <DebugLog.h>
#include "WiFi.h"
#include "loraprs_service.h"
@ -18,6 +19,9 @@
void initializeConfig(LoraPrs::Config &cfg) {
// log level
cfg.LogLevel = CFG_LOG_LEVEL;
// client/server mode switch
cfg.IsClientMode = CFG_IS_CLIENT_MODE;

Wyświetl plik

@ -2,11 +2,13 @@
#define LORAPRS_CONFIG_H
#include <Arduino.h>
#include <DebugLog.h>
namespace LoraPrs {
struct Config
{
DebugLogLevel LogLevel; // log level
bool IsClientMode; // false - server mode, true - client mode (disables wifi and aprsis)
// lora protocol parameters

Wyświetl plik

@ -37,7 +37,7 @@ void Service::setup(const Config &conf)
// disable logging when USB is used for data transfer
if (config_.UsbSerialEnable) {
LOG_SET_LEVEL(DebugLogLevel::LVL_NONE);
LOG_SET_LEVEL(config_.LogLevel);
}
printConfig();
@ -599,6 +599,7 @@ bool Service::onRigTxBegin()
void Service::onRigTx(byte b)
{
LOG_TRACE((char)b);
#ifdef USE_RADIOLIB
txQueue_.push(b);
#else
@ -662,6 +663,7 @@ void Service::attachKissNetworkClient()
void Service::onSerialTx(byte b)
{
LOG_TRACE((char)b);
if (config_.UsbSerialEnable) {
Serial.write(b);
}
@ -716,6 +718,7 @@ bool Service::onSerialRx(byte *b)
return false;
}
*b = (byte)rxResult;
LOG_TRACE((char)rxResult);
return true;
}