Fixes - Smoothing, Color-Calibration (#1532)

* Smoothing Remove ouputrate as duplicate to update frequency

* Serial LDEDDevices -Increase writeBlack to overcome issues on high baud rates

* Serial LED-Devices - Support device feedback, show statistics provided by HyperSerial

* Fix - Update Color Calibration on Remote Control when settings saved

* Serial LED-Devices - Support device feedback, show statistics provided by HyperSerial
This commit is contained in:
LordGrey
2022-11-27 15:47:54 +01:00
committed by GitHub
parent 46f996310d
commit a2db590d2a
10 changed files with 130 additions and 87 deletions

View File

@@ -18,7 +18,7 @@ namespace {
constexpr std::chrono::milliseconds WRITE_TIMEOUT{ 1000 }; // device write timeout in ms
constexpr std::chrono::milliseconds OPEN_TIMEOUT{ 5000 }; // device open timeout in ms
const int MAX_WRITE_TIMEOUTS = 5; // Maximum number of allowed timeouts
const int NUM_POWEROFF_WRITE_BLACK = 2; // Number of write "BLACK" during powering off
const int NUM_POWEROFF_WRITE_BLACK = 5; // Number of write "BLACK" during powering off
constexpr std::chrono::milliseconds DEFAULT_IDENTIFY_TIME{ 500 };
@@ -86,6 +86,8 @@ int ProviderRs232::open()
// open device physically
if ( tryOpen(_delayAfterConnect_ms) )
{
connect(&_rs232Port, &QSerialPort::readyRead, this, &ProviderRs232::readFeedback);
// Everything is OK, device is ready
_isDeviceReady = true;
retval = 0;
@@ -106,6 +108,9 @@ int ProviderRs232::close()
{
Debug(_log,"Flush was successful");
}
disconnect(&_rs232Port, &QSerialPort::readyRead, this, &ProviderRs232::readFeedback);
Debug(_log,"Close UART: %s", QSTRING_CSTR(_deviceName) );
_rs232Port.close();
// Everything is OK -> device is closed
@@ -261,6 +266,23 @@ int ProviderRs232::writeBytes(const qint64 size, const uint8_t *data)
return rc;
}
void ProviderRs232::readFeedback()
{
QByteArray readData = _rs232Port.readAll();
if (!readData.isEmpty())
{
//Output as received
std::cout << readData.toStdString();
//Output as Hex
//#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
// std::cout << readData.toHex(':').toStdString();
//#else
// std::cout << readData.toHex().toStdString();
//#endif
}
}
QString ProviderRs232::discoverFirst()
{
// take first available USB serial port - currently no probing!