mirror of
https://github.com/timmbogner/Farm-Data-Relay-System
synced 2024-11-08 13:10:29 +00:00
SX1262 support
I don't have an SX1262 board to test this on
This commit is contained in:
parent
ab1f51e547
commit
c5c7df0665
@ -35,7 +35,9 @@
|
||||
#define LORA_NEIGHBOR_2 0x03 // LoRa2 Address
|
||||
|
||||
// LoRa Configuration
|
||||
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
|
||||
// LoRa Configuration
|
||||
#define RADIOLIB_MODULE SX1262 //Tested on SX1276
|
||||
#define USE_SX126X
|
||||
#define LORA_SS 18
|
||||
#define LORA_RST 14
|
||||
#define LORA_DIO 26
|
||||
|
@ -252,8 +252,11 @@ void begin_lora()
|
||||
while (true)
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef USE_SX126X
|
||||
radio.setDio1Action(setFlag);
|
||||
#else
|
||||
radio.setDio0Action(setFlag);
|
||||
#endif
|
||||
|
||||
radio.setCRC(false);
|
||||
DBG("LoRa Initialized. Frequency: " + String(FDRS_LORA_FREQUENCY) + " Bandwidth: " + String(FDRS_LORA_BANDWIDTH) + " SF: " + String(FDRS_LORA_SF) + " CR: " + String(FDRS_LORA_CR) + " SyncWord: " + String(FDRS_LORA_SYNCWORD) + " Tx Power: " + String(FDRS_LORA_TXPWR) + "dBm");
|
||||
@ -561,44 +564,45 @@ void asyncReleaseLoRa(bool first_run)
|
||||
}
|
||||
}
|
||||
}
|
||||
void asyncReleaseLoRaFirst()
|
||||
{
|
||||
asyncReleaseLoRa(true);
|
||||
}
|
||||
void asyncReleaseLoRaFirst()
|
||||
{
|
||||
asyncReleaseLoRa(true);
|
||||
}
|
||||
|
||||
void handleLoRa()
|
||||
void handleLoRa()
|
||||
{
|
||||
if (operationDone) // the interrupt was triggered
|
||||
{
|
||||
if (operationDone) // the interrupt was triggered
|
||||
enableInterrupt = false;
|
||||
operationDone = false;
|
||||
if (transmitFlag) // the previous operation was transmission
|
||||
{
|
||||
enableInterrupt = false;
|
||||
operationDone = false;
|
||||
if (transmitFlag) // the previous operation was transmission
|
||||
if (TxStatus != TxIdle)
|
||||
{
|
||||
if (TxStatus != TxIdle)
|
||||
{
|
||||
asyncReleaseLoRa(false);
|
||||
enableInterrupt = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tx_time_set){
|
||||
DBG("ToA: " + String(millis() - tx_start_time));
|
||||
tx_time_set = false;
|
||||
}
|
||||
radio.startReceive(); // return to listen mode
|
||||
enableInterrupt = true;
|
||||
transmitFlag = false;
|
||||
}
|
||||
}
|
||||
else // the previous operation was reception
|
||||
{
|
||||
returnCRC = getLoRa();
|
||||
if (!transmitFlag) // return to listen if no transmission was begun
|
||||
{
|
||||
radio.startReceive();
|
||||
}
|
||||
asyncReleaseLoRa(false);
|
||||
enableInterrupt = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tx_time_set)
|
||||
{
|
||||
DBG("ToA: " + String(millis() - tx_start_time));
|
||||
tx_time_set = false;
|
||||
}
|
||||
radio.startReceive(); // return to listen mode
|
||||
enableInterrupt = true;
|
||||
transmitFlag = false;
|
||||
}
|
||||
}
|
||||
else // the previous operation was reception
|
||||
{
|
||||
returnCRC = getLoRa();
|
||||
if (!transmitFlag) // return to listen if no transmission was begun
|
||||
{
|
||||
radio.startReceive();
|
||||
}
|
||||
enableInterrupt = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // USE_LORA
|
||||
|
Loading…
Reference in New Issue
Block a user