Fast read implementation
This commit is contained in:
@@ -487,7 +487,7 @@ void onReceive(int packetSize)
|
||||
//We have a packet candidate that might contain a valid QSP packet
|
||||
radioState.bytesToRead = packetSize;
|
||||
for (int i = 0; i < packetSize; i++) {
|
||||
radioState.data[i] = LoRa.read();
|
||||
radioState.data[i] = LoRa.fastRead();
|
||||
}
|
||||
radioState.rssi = getRadioRssi();
|
||||
radioState.snr = getRadioSnr();
|
||||
|
||||
10
lora.cpp
10
lora.cpp
@@ -238,15 +238,19 @@ int LoRaClass::available()
|
||||
return (readRegister(REG_RX_NB_BYTES) - _packetIndex);
|
||||
}
|
||||
|
||||
int LoRaClass::fastRead() {
|
||||
_packetIndex++;
|
||||
|
||||
return readRegister(REG_FIFO);
|
||||
}
|
||||
|
||||
int LoRaClass::read()
|
||||
{
|
||||
if (!available()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
_packetIndex++;
|
||||
|
||||
return readRegister(REG_FIFO);
|
||||
return fastRead();
|
||||
}
|
||||
|
||||
void LoRaClass::onReceive(void(*callback)(int))
|
||||
|
||||
Reference in New Issue
Block a user