mirror of
https://github.com/meshtastic/firmware.git
synced 2026-02-02 15:11:48 +00:00
Add portduino_status, assign hardware device IDs... (#9441)
* Add portduino_status, assign hardware device IDs, and try to recover a CH341 device on a USB error * Minor fixes suggested by Copilot
This commit is contained in:
@@ -2247,7 +2247,10 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
|
||||
|
||||
// Currently portuino is mostly used for simulation. Make sure the user notices something really bad happened
|
||||
#ifdef ARCH_PORTDUINO
|
||||
LOG_ERROR("A critical failure occurred, portduino is exiting");
|
||||
exit(2);
|
||||
LOG_ERROR("A critical failure occurred");
|
||||
// TODO: Determine if other critical errors should also cause an immediate exit
|
||||
if (code == meshtastic_CriticalErrorCode_FLASH_CORRUPTION_RECOVERABLE ||
|
||||
code == meshtastic_CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE)
|
||||
exit(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -269,8 +269,12 @@ template <typename T> void SX126xInterface<T>::setStandby()
|
||||
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_DEBUG("SX126x standby %s%d", radioLibErr, err);
|
||||
#ifdef ARCH_PORTDUINO
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
portduino_status.LoRa_in_error = true;
|
||||
#else
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
#endif
|
||||
isReceiving = false; // If we were receiving, not any more
|
||||
activeReceiveStart = 0;
|
||||
disableInterrupt();
|
||||
@@ -313,7 +317,12 @@ template <typename T> void SX126xInterface<T>::startReceive()
|
||||
int err = lora.startReceiveDutyCycleAuto(preambleLength, 8, MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS);
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_ERROR("SX126X startReceiveDutyCycleAuto %s%d", radioLibErr, err);
|
||||
#ifdef ARCH_PORTDUINO
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
portduino_status.LoRa_in_error = true;
|
||||
#else
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
#endif
|
||||
|
||||
RadioLibInterface::startReceive();
|
||||
|
||||
@@ -341,7 +350,12 @@ template <typename T> bool SX126xInterface<T>::isChannelActive()
|
||||
return true;
|
||||
if (result != RADIOLIB_CHANNEL_FREE)
|
||||
LOG_ERROR("SX126X scanChannel %s%d", radioLibErr, result);
|
||||
#ifdef ARCH_PORTDUINO
|
||||
if (result == RADIOLIB_ERR_WRONG_MODEM)
|
||||
portduino_status.LoRa_in_error = true;
|
||||
#else
|
||||
assert(result != RADIOLIB_ERR_WRONG_MODEM);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user