kopia lustrzana https://github.com/sh123/esp32_loraprs
Add config option to set debug level, add trace calls for incoming and outgoing data
rodzic
34663fb943
commit
af096a3548
2
config.h
2
config.h
|
@ -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...")
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue