Fixed promiscuous mode.

This commit is contained in:
Alligitor 2025-04-19 01:19:37 +00:00
parent 23c580d0df
commit 3926e6706d

View file

@ -357,7 +357,8 @@ void ISR_VECT receive_callback(int packet_size) {
BaseType_t int_mask;
#endif
if (!promisc) {
bool ready = false;
if (!promisc) { // Not in promiscuous mode
// The standard operating mode allows large
// packets with a payload up to 500 bytes,
// by combining two raw LoRa packets.
@ -365,7 +366,6 @@ void ISR_VECT receive_callback(int packet_size) {
// packet sequence number and split flags
uint8_t header = LoRa->read(); packet_size--;
uint8_t sequence = packetSequence(header);
bool ready = false;
if (isSplitPacket(header) && seq == SEQ_UNSET) {
// This is the first part of a split
@ -442,6 +442,29 @@ void ISR_VECT receive_callback(int packet_size) {
getPacketData(packet_size);
ready = true;
}
} else { // In promiscuous mode
// In promiscuous mode, raw packets are
// output directly to the host
read_len = 0;
#if MCU_VARIANT != MCU_ESP32 && MCU_VARIANT != MCU_NRF52
last_rssi = LoRa->packetRssi();
last_snr_raw = LoRa->packetSnrRaw();
getPacketData(packet_size);
// We first signal the RSSI of the
// recieved packet to the host.
kiss_indicate_stat_rssi();
kiss_indicate_stat_snr();
// And then write the entire packet
kiss_write_packet();
#else
getPacketData(packet_size);
ready = true;
#endif
}
if (ready) {
#if MCU_VARIANT != MCU_ESP32 && MCU_VARIANT != MCU_NRF52
@ -475,29 +498,6 @@ void ISR_VECT receive_callback(int packet_size) {
}
#endif
}
} else {
// In promiscuous mode, raw packets are
// output directly to the host
read_len = 0;
#if MCU_VARIANT != MCU_ESP32 && MCU_VARIANT != MCU_NRF52
last_rssi = LoRa->packetRssi();
last_snr_raw = LoRa->packetSnrRaw();
getPacketData(packet_size);
// We first signal the RSSI of the
// recieved packet to the host.
kiss_indicate_stat_rssi();
kiss_indicate_stat_snr();
// And then write the entire packet
kiss_write_packet();
#else
getPacketData(packet_size);
packet_ready = true;
#endif
}
}
bool startRadio() {