Przeglądaj źródła

added conditional to room server radio bringup for supporting RA01sh radio on faketec

taco 1 rok temu
rodzic
commit
5632e2771e
1 zmienionych plików z 7 dodań i 0 usunięć
  1. 7 0
      examples/simple_room_server/main.cpp

+ 7 - 0
examples/simple_room_server/main.cpp

@@ -751,6 +751,13 @@ void setup() {
   spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
 #endif
   int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
+#if defined(FAKETEC)
+  if (status == RADIOLIB_ERR_SPI_CMD_FAILED || status == RADIOLIB_ERR_SPI_CMD_INVALID) {
+    #define SX126X_DIO3_TCXO_VOLTAGE (0.0f);
+    tcxo = SX126X_DIO3_TCXO_VOLTAGE;
+    status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
+  }
+#endif
   if (status != RADIOLIB_ERR_NONE) {
     delay(5000);
     Serial.print("ERROR: radio init failed: ");