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