Added error flag when packetizer and multichannelcommunication fail to read
parent
453f098cdb
commit
f9712a4bcd
|
|
@ -49,8 +49,8 @@ void MultiChannelCommunication::readTask() {
|
||||||
currentCommandType = (CommandType)usbReadFifo[0];
|
currentCommandType = (CommandType)usbReadFifo[0];
|
||||||
|
|
||||||
if(!CommandTypeIsValid(currentCommandType)) {
|
if(!CommandTypeIsValid(currentCommandType)) {
|
||||||
// TODO Flag error? Device to host bytes discarded
|
// Device to host bytes discarded
|
||||||
//std::cout << "cnv" << std::hex << (int)currentCommandType << ' ' << std::dec;
|
EventManager::GetInstance().add(APIEvent(APIEvent::Type::FailedToRead, APIEvent::Severity::Error));
|
||||||
usbReadFifo.pop_front();
|
usbReadFifo.pop_front();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ bool Packetizer::input(const std::vector<uint8_t>& inputBytes) {
|
||||||
*/
|
*/
|
||||||
if(packetLength < 4 || packetLength > 4000) {
|
if(packetLength < 4 || packetLength > 4000) {
|
||||||
bytes.pop_front();
|
bytes.pop_front();
|
||||||
//std::cout << "skipping long packet with length " << packetLength << std::endl;
|
EventManager::GetInstance().add(APIEvent::Type::FailedToRead, APIEvent::Severity::Error);
|
||||||
state = ReadState::SearchForHeader;
|
state = ReadState::SearchForHeader;
|
||||||
} else {
|
} else {
|
||||||
state = ReadState::GetData;
|
state = ReadState::GetData;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue