Fix broken UART error handling logic

This commit is contained in:
Dale Whinham committed 2021-09-03 23:03:21 +01:00
1 parent fc98e0a198
commit 773838e8fb
2 files changed
+25 -17

No files matched your search

+4
View File
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Broken UART error handling since v0.10.2 which would result in erratic, false MIDI activity under some circumstances. Many thanks to WiteWulf and Alex Mitchell for the report!
## [0.10.2] - 2021-08-11
### Added
+21 -17
View File
@@ -893,30 +893,34 @@ size_t CMT32Pi::ReceiveSerialMIDI(u8* pOutData, size_t nSize)
return 0;
// Error
if (nResult < 0 && m_pConfig->SystemVerbose)
if (nResult < 0)
{
const char* pErrorString;
switch (nResult)
if (m_pConfig->SystemVerbose)
{
case -SERIAL_ERROR_BREAK:
pErrorString = "UART break error!";
break;
const char* pErrorString;
switch (nResult)
{
case -SERIAL_ERROR_BREAK:
pErrorString = "UART break error!";
break;
case -SERIAL_ERROR_OVERRUN:
pErrorString = "UART overrun error!";
break;
case -SERIAL_ERROR_OVERRUN:
pErrorString = "UART overrun error!";
break;
case -SERIAL_ERROR_FRAMING:
pErrorString = "UART framing error!";
break;
case -SERIAL_ERROR_FRAMING:
pErrorString = "UART framing error!";
break;
default:
pErrorString = "Unknown UART error!";
break;
default:
pErrorString = "Unknown UART error!";
break;
}
m_pLogger->Write(MT32PiName, LogWarning, pErrorString);
LCDLog(TLCDLogType::Warning, pErrorString);
}
m_pLogger->Write(MT32PiName, LogWarning, pErrorString);
LCDLog(TLCDLogType::Warning, pErrorString);
return 0;
}