From 70e35316d4e066fbd6776d089c95beaf572675e2 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Tue, 22 Nov 2022 18:25:33 +1100 Subject: [PATCH] Create ShowStartupWarnings.cpp --- .../OperatingModes/ShowStartupWarnings.cpp | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 source/Core/Threads/OperatingModes/ShowStartupWarnings.cpp diff --git a/source/Core/Threads/OperatingModes/ShowStartupWarnings.cpp b/source/Core/Threads/OperatingModes/ShowStartupWarnings.cpp new file mode 100644 index 00000000..c940ae52 --- /dev/null +++ b/source/Core/Threads/OperatingModes/ShowStartupWarnings.cpp @@ -0,0 +1,40 @@ +#include "OperatingModes.h" + +void showWarnings(void) { + // Display alert if settings were reset + if (settingsWereReset) { + warnUser(translatedString(Tr->SettingsResetMessage), 10 * TICKS_SECOND); + } +#ifdef DEVICE_HAS_VALIDATION_SUPPORT + if (getDeviceValidationStatus()) { + // Warn user this device might be counterfeit + warnUser(translatedString(Tr->DeviceFailedValidationWarning), 10 * TICKS_SECOND); + } +#endif +#ifndef NO_WARN_MISSING + // We also want to alert if accel or pd is not detected / not responding + // In this case though, we dont want to nag the user _too_ much + // So only show first 2 times + while (DetectedAccelerometerVersion == AccelType::Scanning) { + osDelay(5); + } + // Display alert if accelerometer is not detected + if (DetectedAccelerometerVersion == AccelType::None) { + if (getSettingValue(SettingsOptions::AccelMissingWarningCounter) < 2) { + nextSettingValue(SettingsOptions::AccelMissingWarningCounter); + saveSettings(); + warnUser(translatedString(Tr->NoAccelerometerMessage), 10 * TICKS_SECOND); + } + } +#if POW_PD + // We expect pd to be present + if (!USBPowerDelivery::fusbPresent()) { + if (getSettingValue(SettingsOptions::PDMissingWarningCounter) < 2) { + nextSettingValue(SettingsOptions::PDMissingWarningCounter); + saveSettings(); + warnUser(translatedString(Tr->NoPowerDeliveryMessage), 10 * TICKS_SECOND); + } + } +#endif +#endif +} \ No newline at end of file