-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
Description
One thing I found during testing today, if you disconnect the IC line, the unit 'locks up' when used as an RDM controller with one or more responders on the line. This is because without IC we never enter the STATE_C_RX_IN_DUB but the UART is still receiving and Transceiver_UARTEvent() is called repeatably.
This is symptomatic of a general class of 'abnormal' failures. If something happens that we don't expect, we should enter the ERROR state and reset the unit.
e.g.
case STATE_C_INITIALIZE:
case STATE_C_TX_READY:
case STATE_C_TX_DATA:
case STATE_C_TX_DRAIN:
case STATE_C_RX_WAIT_FOR_BREAK:
case STATE_C_RX_WAIT_FOR_MARK:
case STATE_C_RX_DATA:
case STATE_C_RX_WAIT_FOR_DUB:
case STATE_C_RX_IN_DUB:
case STATE_C_RX_TIMEOUT:
case STATE_C_COMPLETE:
case STATE_C_BACKOFF:
case STATE_R_INITIALIZE:
case STATE_R_RX_PREPARE:
case STATE_R_RX_BREAK:
case STATE_R_RX_MARK:
case STATE_R_RX_MBB:
case STATE_R_RX_DATA:
case STATE_R_TX_DATA:
case STATE_R_TX_DRAIN:
case STATE_R_TX_COMPLETE:
case STATE_ERROR:
case STATE_RESET:
// Should never happen
{}
That last line should handle the failure.