Skip to content

Defend against abnormal events #205

@nomis52

Description

@nomis52

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions