M products/BellHybrid/apps/application-bell-settings/models/alarm_settings/AlarmSettingsModel.cpp => products/BellHybrid/apps/application-bell-settings/models/alarm_settings/AlarmSettingsModel.cpp +9 -1
@@ 8,6 8,11 @@
namespace app::bell_settings
{
+ namespace
+ {
+ static constexpr std::string_view DefaultBrightness{"50.0"};
+ }
+
void AlarmToneModel::setValue(UTF8 value)
{
settings.setValue(bell::settings::Alarm::tone, value, settings::SettingsScope::Global);
@@ 56,7 61,10 @@ namespace app::bell_settings
frontlight_utils::Brightness AlarmFrontlightModel::getValue() const
{
- const auto str = settings.getValue(bell::settings::Alarm::brightness, settings::SettingsScope::Global);
+ auto str = settings.getValue(bell::settings::Alarm::brightness, settings::SettingsScope::Global);
+ if (str.empty()) {
+ str = DefaultBrightness;
+ }
return frontlight_utils::percentageToFixedVal(std::stoi(str));
}
} // namespace app::bell_settings
M products/BellHybrid/apps/application-bell-settings/models/alarm_settings/PrewakeUpSettingsModel.cpp => products/BellHybrid/apps/application-bell-settings/models/alarm_settings/PrewakeUpSettingsModel.cpp +9 -1
@@ 8,6 8,11 @@
namespace app::bell_settings
{
+ namespace
+ {
+ static constexpr std::string_view DefaultBrightness{"50.0"};
+ }
+
void PrewakeUpChimeDurationModel::setValue(std::uint8_t value)
{
const auto valStr = std::to_string(value);
@@ 68,7 73,10 @@ namespace app::bell_settings
frontlight_utils::Brightness PrewakeUpFrontlightModel::getValue() const
{
- const auto str = settings.getValue(bell::settings::PrewakeUp::brightness, settings::SettingsScope::Global);
+ auto str = settings.getValue(bell::settings::PrewakeUp::brightness, settings::SettingsScope::Global);
+ if (str.empty()) {
+ str = DefaultBrightness;
+ }
return frontlight_utils::percentageToFixedVal(std::stoi(str));
}
} // namespace app::bell_settings