diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index 66eb68c..218a76e 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -103,7 +103,7 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con hw->vend_failed(); // read sw-version and store it in persistentData, if changed - QString dc_fw_version = hw->dc_getSWversion(); + QString dc_fw_version = hw->dc_getSWversion().remove(QChar('\0')); qCritical() << "ATBDeviceControllerPlugin: DC firmware version: " << dc_fw_version; this->persistentData->setDCFirmwareVersion(dc_fw_version); this->persistentData->serializeToFile(); diff --git a/src/ATBAPP/DeviceControllerDiag.cpp b/src/ATBAPP/DeviceControllerDiag.cpp index c94f691..2a5f89f 100644 --- a/src/ATBAPP/DeviceControllerDiag.cpp +++ b/src/ATBAPP/DeviceControllerDiag.cpp @@ -45,7 +45,11 @@ void DeviceControllerDiag::diagRequest() this->private_startDiag(); // read dc-fw-version: - QString dc_fw_version = hw->dc_getSWversion(); + /* note: dc_getSWVersion() returns always 32 characters (QString)... + * if no version string could be read it will contain 32 null-characters: + * "\u0000\u0000..." + */ + QString dc_fw_version = hw->dc_getSWversion().remove(QChar('\0')); qCritical() << "ATBDeviceControllerPlugin: DC firmware version: " << dc_fw_version; this->pData->setDCFirmwareVersion(dc_fw_version); this->pData->serializeToFile(); diff --git a/src/ATBAPP/support/PersistentData.cpp b/src/ATBAPP/support/PersistentData.cpp index 05f2a67..cfcf305 100644 --- a/src/ATBAPP/support/PersistentData.cpp +++ b/src/ATBAPP/support/PersistentData.cpp @@ -125,6 +125,9 @@ QList PersistentData::uniqueKeys() const { void PersistentData::setDCFirmwareVersion(const QString & fw_version) { + // there must be a version string! + if (fw_version.size() < 1) return; + if (this->hash["dc_fw_version"].toString() != fw_version) { this->isChangedFlag = true; this->hash.insert("dc_fw_version", fw_version);