kopia lustrzana https://github.com/sh123/esp32_loraprs
Rename methods for better readability
rodzic
8636f1eb9d
commit
f4254a95d5
|
@ -11,7 +11,7 @@ Processor::Processor()
|
|||
{
|
||||
}
|
||||
|
||||
void Processor::serialSend(Cmd cmd, const byte *packet, int packetLength) {
|
||||
void Processor::sendRigToSerial(Cmd cmd, const byte *packet, int packetLength) {
|
||||
onSerialTx((byte)Marker::Fend);
|
||||
onSerialTx((byte)cmd);
|
||||
|
||||
|
@ -34,7 +34,7 @@ void Processor::serialSend(Cmd cmd, const byte *packet, int packetLength) {
|
|||
onSerialTx((byte)Marker::Fend);
|
||||
}
|
||||
|
||||
void ICACHE_RAM_ATTR Processor::serialQueueIsr(Cmd cmd, const byte *packet, int packetLength) {
|
||||
void ICACHE_RAM_ATTR Processor::queueRigToSerialIsr(Cmd cmd, const byte *packet, int packetLength) {
|
||||
if (!rigToSerialQueueIndex_.unshift(packetLength)) {
|
||||
Serial.println("Rig to serial queue is full!");
|
||||
return;
|
||||
|
@ -47,7 +47,7 @@ void ICACHE_RAM_ATTR Processor::serialQueueIsr(Cmd cmd, const byte *packet, int
|
|||
}
|
||||
}
|
||||
|
||||
void Processor::rigQueue(Cmd cmd, const byte *packet, int packetLength) {
|
||||
void Processor::queueSerialToRig(Cmd cmd, const byte *packet, int packetLength) {
|
||||
bool result = 1;
|
||||
result &= serialToRigQueue_.unshift(Marker::Fend);
|
||||
result &= serialToRigQueue_.unshift(cmd);
|
||||
|
@ -91,7 +91,7 @@ bool Processor::processRigToSerial()
|
|||
for (int i = 0; i < rxPacketSize; i++) {
|
||||
buf[i] = rigToSerialQueue_.pop();
|
||||
}
|
||||
serialSend(Cmd::Data, buf, rxPacketSize);
|
||||
sendRigToSerial(Cmd::Data, buf, rxPacketSize);
|
||||
onRigPacket(&buf, rxPacketSize);
|
||||
|
||||
isProcessed = true;
|
||||
|
|
|
@ -49,10 +49,10 @@ protected:
|
|||
public:
|
||||
Processor();
|
||||
|
||||
void serialSend(Cmd cmd, const byte *packet, int packetLength);
|
||||
static void ICACHE_RAM_ATTR serialQueueIsr(Cmd cmd, const byte *packet, int packetLength);
|
||||
void sendRigToSerial(Cmd cmd, const byte *packet, int packetLength);
|
||||
static void ICACHE_RAM_ATTR queueRigToSerialIsr(Cmd cmd, const byte *packet, int packetLength);
|
||||
|
||||
void rigQueue(Cmd cmd, const byte *packet, int packetLength);
|
||||
void queueSerialToRig(Cmd cmd, const byte *packet, int packetLength);
|
||||
|
||||
bool processRigToSerial();
|
||||
bool processSerialToRig();
|
||||
|
|
|
@ -198,7 +198,7 @@ ICACHE_RAM_ATTR void Service::onLoraDataAvailableIsr(int packetSize)
|
|||
for (int i = 0; i < packetSize; i++) {
|
||||
rxBuf[rxBufIndex++] = LoRa.read();
|
||||
}
|
||||
serialQueueIsr(Cmd::Data, rxBuf, rxBufIndex);
|
||||
queueRigToSerialIsr(Cmd::Data, rxBuf, rxBufIndex);
|
||||
}
|
||||
|
||||
void Service::sendPeriodicBeacon()
|
||||
|
@ -270,7 +270,7 @@ void Service::sendSignalReportEvent(int rssi, float snr)
|
|||
signalReport.rssi = htobe16(rssi);
|
||||
signalReport.snr = htobe16(snr * 100);
|
||||
|
||||
serialSend(Cmd::SignalReport, (const byte *)&signalReport, sizeof(SignalReport));
|
||||
sendRigToSerial(Cmd::SignalReport, (const byte *)&signalReport, sizeof(SignalReport));
|
||||
}
|
||||
|
||||
bool Service::sendAX25ToLora(const AX25::Payload &payload)
|
||||
|
@ -281,7 +281,7 @@ bool Service::sendAX25ToLora(const AX25::Payload &payload)
|
|||
Serial.println("Failed to serialize payload");
|
||||
return false;
|
||||
}
|
||||
rigQueue(Cmd::Data, buf, bytesWritten);
|
||||
queueSerialToRig(Cmd::Data, buf, bytesWritten);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ void Service::loraReceive(int packetSize)
|
|||
while (LoRa.available()) {
|
||||
rxBuf[rxBufIndex++] = LoRa.read();
|
||||
}
|
||||
serialSend(Cmd::Data, rxBuf, rxBufIndex);
|
||||
sendRigToSerial(Cmd::Data, rxBuf, rxBufIndex);
|
||||
onRigPacket(rxBuf, rxBufIndex);
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue