Index: sources/view/VUIPowerOnSelfTest.cpp =================================================================== diff -u -ra73067eedc12bcb4a41afdf4aabb6db9f1994f33 -rd005537390186cc065a824a923f41d615782b552 --- sources/view/VUIPowerOnSelfTest.cpp (.../VUIPowerOnSelfTest.cpp) (revision a73067eedc12bcb4a41afdf4aabb6db9f1994f33) +++ sources/view/VUIPowerOnSelfTest.cpp (.../VUIPowerOnSelfTest.cpp) (revision d005537390186cc065a824a923f41d615782b552) @@ -17,6 +17,7 @@ // Qt #include #include +#include // Project #include "FileHandler.h" @@ -48,6 +49,7 @@ { AdjustUIPostFinalResultRequestData data; + // assume success then set to 0 if there are any failures data.mResult = 1; if (!selfTestFileSystem()) data.mResult = 0; @@ -61,8 +63,6 @@ data.mResult = 0; if (!selfTestRTCClock()) data.mResult = 0; - if (!selfTestClockSpeed()) - data.mResult = 0; emit didAdjustment(data); } @@ -96,20 +96,17 @@ if (!FileHandler::read(Path_FileSystem_Checksums, obj)) return false; bool result = true; - QStringList invalidChecksums; for (const QString& path : obj.keys()) { QString calculatedChecksum = sha256(path); if ( calculatedChecksum != obj.value(path).toString()) { - invalidChecksums.append(path); + LOG_DEBUG(QString("Invalid checksum detected: %1").arg(path)); result = false; } else { LOG_DEBUG(QString("Checksum verified: %1").arg(path)); } } - for (const QString &invalidChecksum : invalidChecksums) - LOG_DEBUG(QString("Invalid checksum detected: %1").arg(invalidChecksum)); return result; } @@ -215,23 +212,38 @@ } /*! - * \brief VUIPostSingleResult::selfTestRTCClock - * Tests that the RTC clock is correct + * \brief VUIPostSingleResult::selfTestClockSpeed + * Test that the clock speed can be read and is within spec */ bool VUIPowerOnSelfTest::selfTestRTCClock() { - // TODO: If needed - return true; -} + QString content; + if (!FileHandler::read(Path_RTC_Check, content)) + { + LOG_DEBUG(QString("Could not read %1!").arg(Path_RTC_Check)); + return false; + } -/*! - * \brief VUIPostSingleResult::selfTestClockSpeed - * Test that the clock speed is within spec - */ -bool VUIPowerOnSelfTest::selfTestClockSpeed() -{ - // TODO: If needed - return true; + QStringList lines = content.split("\n", QString::SkipEmptyParts); + QList times; + for (const QString &line : lines) + { + bool ok = false; + double tm = line.toDouble(&ok); + if (ok) + times.append(tm); + } + if (times.length() == 2) + { + double diff = times.at(1) - times.at(0); + if ((diff > 0) && (diff < (1.0 + _rtc_tolerance))) + { + LOG_DEBUG("RTC Clock speed check passed."); + return true; + } + } + LOG_DEBUG("RTC Clock speed check failed."); + return false; } /*!