-
Notifications
You must be signed in to change notification settings - Fork 18
Description
fprime-arduino/Arduino/Drv/StreamDriver/StreamDriver.cpp
Lines 29 to 31 in f86dfb4
| Drv::ByteStreamStatus StreamDriver ::send_handler(const FwIndexType portNum, Fw::Buffer& serBuffer) { | |
| return write_data(serBuffer); | |
| } |
By passing the return value of write_data back to whatever calls send_handler, it is possible to pass Drv::ByteStreamStatus::OP_OK or Drv::ByteStreamStatus::OTHER_ERROR. When other error is returned for me (in my case it is returned because my board tries to write data to serial but I haven't yet connected my computer to read the serial buffer), I quickly see an overflow in ComQueue with the WARNING_HI EVR QueueOverflow and all downlink stops entirely:
EVENT: (512) (2:4,298807) WARNING_HI: QueueOverflow : The COM_QUEUE (0) queue at index 1 overflowed
I'm currently addressing this by simply writing the data and returning OP_OK (which is essentially what you had before the v4 updates)
Drv::ByteStreamStatus StreamDriver ::send_handler(const FwIndexType portNum, Fw::Buffer& serBuffer) {
(void) write_data(serBuffer);
return Drv::ByteStreamStatus::OP_OK;
}
I understand not wanting to blindly return an OK status even if the write wasn't successful. If that doesn't sit well with you maybe you could try another option? Either finding a way to clear the queue even when the write isn't successful or maybe something like:
Drv::ByteStreamStatus StreamDriver ::send_handler(const FwIndexType portNum, Fw::Buffer& serBuffer) {
Drv::ByteStreamStatus status = write_data(serBuffer);
if (status != Drv::ByteStreamStatus::OP_OK) {
//issue a warning EVR?
}
return Drv::ByteStreamStatus::OP_OK;
}