kopia lustrzana https://github.com/sh123/esp32_loraprs
Remove some magic constants
rodzic
8df912facf
commit
3d6e059420
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace LoraPrs {
|
||||
|
||||
byte Service::rxBuf_[256];
|
||||
byte Service::rxBuf_[CfgMaxPacketSize];
|
||||
|
||||
#ifdef USE_RADIOLIB
|
||||
#pragma message("Using RadioLib")
|
||||
|
@ -409,7 +409,7 @@ void Service::onAprsisDataAvailable()
|
|||
if (c == '\r') continue;
|
||||
if (c == '\n') break;
|
||||
aprsisData += c;
|
||||
if (aprsisData.length() >= CfgMaxAprsInMessageSize) {
|
||||
if (aprsisData.length() >= CfgMaxPacketSize) {
|
||||
LOG_WARN("APRS-IS incoming message is too long, skipping tail");
|
||||
break;
|
||||
}
|
||||
|
@ -441,15 +441,12 @@ void Service::sendSignalReportEvent(int rssi, float snr)
|
|||
bool Service::sendAX25ToLora(const AX25::Payload &payload)
|
||||
{
|
||||
int bytesWritten;
|
||||
byte buf[CfgMaxAX25PayloadSize];
|
||||
byte buf[CfgMaxPacketSize];
|
||||
|
||||
// TNC2 text mode
|
||||
if (config_.EnableTextPackets) {
|
||||
String textPayload = payload.ToString();
|
||||
bytesWritten = textPayload.length();
|
||||
if (bytesWritten > CfgMaxAX25PayloadSize) {
|
||||
bytesWritten = CfgMaxAX25PayloadSize;
|
||||
}
|
||||
bytesWritten = textPayload.length() > CfgMaxPacketSize ? CfgMaxPacketSize : textPayload.length();
|
||||
textPayload.getBytes(buf, bytesWritten);
|
||||
buf[bytesWritten-1] = '\0';
|
||||
|
||||
|
@ -528,8 +525,8 @@ void Service::processIncomingRawPacketAsServer(const byte *packet, int packetLen
|
|||
|
||||
// try to parse as text for clients, who submit plain text
|
||||
if (!payload.IsValid() && config_.EnableTextPackets) {
|
||||
char buf[CfgMaxAX25PayloadSize];
|
||||
int cpySize = packetLength > CfgMaxAX25PayloadSize ? CfgMaxAX25PayloadSize : packetLength;
|
||||
char buf[CfgMaxPacketSize];
|
||||
int cpySize = packetLength > CfgMaxPacketSize ? CfgMaxPacketSize : packetLength;
|
||||
memcpy(buf, packet, cpySize);
|
||||
buf[cpySize-1] = '\0';
|
||||
payload = AX25::Payload(String((char*)buf));
|
||||
|
|
|
@ -120,8 +120,7 @@ private:
|
|||
const int CfgConnRetryMs = 500; // connection retry delay, e.g. wifi
|
||||
const int CfgPollDelayMs = 5; // main loop delay
|
||||
const int CfgConnRetryMaxTimes = 10; // number of connection retries
|
||||
const int CfgMaxAX25PayloadSize = 512; // maximum ax25 payload size
|
||||
const int CfgMaxAprsInMessageSize = 255; // maximum aprsis to rf message size
|
||||
static const int CfgMaxPacketSize = 256; // maximum packet size
|
||||
|
||||
// csma parameters, overriden with KISS commands
|
||||
const long CfgCsmaPersistence = 100; // 255 for real time, lower for higher traffic
|
||||
|
@ -145,10 +144,10 @@ private:
|
|||
long previousBeaconMs_;
|
||||
|
||||
// peripherals
|
||||
static byte rxBuf_[256];
|
||||
static byte rxBuf_[CfgMaxPacketSize];
|
||||
#ifdef USE_RADIOLIB
|
||||
static bool interruptEnabled_;
|
||||
CircularBuffer<uint8_t, 256> txQueue_;
|
||||
CircularBuffer<uint8_t, CfgMaxPacketSize> txQueue_;
|
||||
static std::shared_ptr<MODULE_NAME> radio_;
|
||||
#endif
|
||||
BluetoothSerial serialBt_;
|
||||
|
|
Ładowanie…
Reference in New Issue