kopia lustrzana https://github.com/sh123/esp32_loraprs
Update event report types
rodzic
3cd67e07d2
commit
877f5f3549
|
@ -8,9 +8,9 @@ Processor::Processor()
|
|||
{
|
||||
}
|
||||
|
||||
void Processor::serialSend(const byte *b, int dataLength) {
|
||||
void Processor::serialSend(Cmd cmd, const byte *b, int dataLength) {
|
||||
onSerialTx((byte)Marker::Fend);
|
||||
onSerialTx((byte)Cmd::Data);
|
||||
onSerialTx((byte)cmd);
|
||||
|
||||
for (int i = 0; i < dataLength; i++) {
|
||||
byte rxByte = b[i];
|
||||
|
@ -26,6 +26,7 @@ void Processor::serialSend(const byte *b, int dataLength) {
|
|||
else {
|
||||
onSerialTx(rxByte);
|
||||
}
|
||||
yield();
|
||||
}
|
||||
|
||||
onSerialTx((byte)Marker::Fend);
|
||||
|
|
|
@ -8,13 +8,7 @@
|
|||
namespace Kiss {
|
||||
|
||||
class Processor {
|
||||
|
||||
public:
|
||||
Processor();
|
||||
|
||||
void serialSend(const byte *b, int dataLength);
|
||||
void serialProcessRx();
|
||||
|
||||
protected:
|
||||
enum Marker {
|
||||
Fend = 0xc0,
|
||||
|
@ -54,9 +48,15 @@ protected:
|
|||
Raw = 0,
|
||||
Control
|
||||
};
|
||||
|
||||
|
||||
const int CfgTxQueueSize = 4096;
|
||||
|
||||
|
||||
public:
|
||||
Processor();
|
||||
|
||||
void serialSend(Cmd cmd, const byte *b, int dataLength);
|
||||
void serialProcessRx();
|
||||
|
||||
protected:
|
||||
virtual bool onRigTxBegin() = 0;
|
||||
virtual void onRigTx(byte b) = 0;
|
||||
|
|
|
@ -232,7 +232,7 @@ void Service::sendSignalReportEvent(int rssi, float snr)
|
|||
event.rssi = htobe16(rssi);
|
||||
event.snr = htobe16(snr * 100);
|
||||
|
||||
serialSend((const byte *)&event, sizeof(LoraSignalLevelEvent));
|
||||
serialSend(Cmd::RadioSignalLevel, (const byte *)&event, sizeof(LoraSignalLevelEvent));
|
||||
}
|
||||
|
||||
bool Service::sendAX25ToLora(const AX25::Payload &payload)
|
||||
|
@ -257,8 +257,9 @@ void Service::onLoraDataAvailable(int packetSize)
|
|||
while (LoRa.available()) {
|
||||
byte rxByte = LoRa.read();
|
||||
rxBuf[rxBufIndex++] = rxByte;
|
||||
yield();
|
||||
}
|
||||
serialSend(rxBuf, rxBufIndex);
|
||||
serialSend(Cmd::Data, rxBuf, rxBufIndex);
|
||||
long frequencyError = LoRa.packetFrequencyError();
|
||||
|
||||
if (config_.EnableAutoFreqCorrection) {
|
||||
|
|
|
@ -61,18 +61,18 @@ protected:
|
|||
|
||||
private:
|
||||
struct LoraSignalLevelEvent {
|
||||
int rssi;
|
||||
int snr;
|
||||
int16_t rssi;
|
||||
int16_t snr;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct LoraControlCommand {
|
||||
long freq;
|
||||
long bw;
|
||||
int sf;
|
||||
int cr;
|
||||
int pwr;
|
||||
int sync;
|
||||
bool crc;
|
||||
uint32_t freq;
|
||||
uint32_t bw;
|
||||
uint16_t sf;
|
||||
uint16_t cr;
|
||||
uint16_t pwr;
|
||||
uint16_t sync;
|
||||
uint8_t crc;
|
||||
} __attribute__((packed));
|
||||
|
||||
private:
|
||||
|
|
Ładowanie…
Reference in New Issue