refactor: promicro with CustomSX1262::std_init()

added check in CustomSX1262.h to support both txco and non-txco radios
switched promicro to use CustomSX1262::std_init()
This commit is contained in:
taco 2025-06-20 11:22:34 +10:00
parent eb5826645e
commit e7b0e9e526
2 changed files with 7 additions and 41 deletions

View file

@ -30,6 +30,12 @@ class CustomSX1262 : public SX1262 {
#endif
#endif
int status = begin(LORA_FREQ, LORA_BW, LORA_SF, cr, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
// if radio init fails with -707/-706, try again with tcxo voltage set to 0.0f
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 = begin(LORA_FREQ, LORA_BW, LORA_SF, cr, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
}
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");
Serial.println(status);