diff --git a/interface1/firmware/CoaxTransceiver.cpp b/interface1/firmware/CoaxTransceiver.cpp index 0da3616..8f3b70b 100644 --- a/interface1/firmware/CoaxTransceiver.cpp +++ b/interface1/firmware/CoaxTransceiver.cpp @@ -229,9 +229,22 @@ static int /* ssize_t */ CoaxTransceiver::receive(uint16_t *buffer, size_t buffe NOP; } + uint16_t count = rxBufferCount; + rxState = RX_STATE_DISABLED; - return rxBufferCount; + if (count < 0) { + return count; + } + + // Check for receiver errors. + for (int index = 0; index < count; index++) { + if (buffer[index] & 0x8000) { + return ERROR_RX_RECEIVER; + } + } + + return count; } static void CoaxTransceiver::rxActiveInterrupt() { diff --git a/interface1/firmware/CoaxTransceiver.h b/interface1/firmware/CoaxTransceiver.h index e3c8c92..cc09e3c 100644 --- a/interface1/firmware/CoaxTransceiver.h +++ b/interface1/firmware/CoaxTransceiver.h @@ -19,6 +19,7 @@ #define ERROR_TX_RECEIVER_ACTIVE -1 #define ERROR_RX_TIMEOUT -2 #define ERROR_RX_OVERFLOW -3 +#define ERROR_RX_RECEIVER -4 class CoaxTransceiver { public: diff --git a/pycoax/coax/serial_interface.py b/pycoax/coax/serial_interface.py index 2fa7ba0..43602be 100644 --- a/pycoax/coax/serial_interface.py +++ b/pycoax/coax/serial_interface.py @@ -150,7 +150,8 @@ ERROR_MAP = { 101: InterfaceError('Receiver active'), 102: ReceiveTimeout(), - 103: ReceiveError('Receiver buffer overflow') + 103: ReceiveError('Receiver buffer overflow'), + 104: ReceiveError('Receiver error') } def _convert_error(message):