mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-09-11 05:35:50 +03:00
AlarmController: rename helper to Save()/Restore()
This commit is contained in:
parent
ad6e1b967c
commit
3969a4aa01
@ -38,7 +38,7 @@ namespace {
|
||||
void AlarmController::Init(System::SystemTask* systemTask) {
|
||||
this->systemTask = systemTask;
|
||||
alarmTimer = xTimerCreate("Alarm", 1, pdFALSE, this, SetOffAlarm);
|
||||
LoadAlarmFromFile();
|
||||
Restore();
|
||||
if (alarm.isEnabled) {
|
||||
NRF_LOG_INFO("[AlarmController] Loaded alarm was enabled, scheduling");
|
||||
ScheduleAlarm();
|
||||
@ -49,7 +49,7 @@ void AlarmController::SaveAlarm() {
|
||||
|
||||
// verify if is necessary to save
|
||||
if (alarmChanged) {
|
||||
SaveAlarmToFile();
|
||||
Save();
|
||||
}
|
||||
alarmChanged = false;
|
||||
}
|
||||
@ -144,7 +144,7 @@ void AlarmController::SetRecurrence(RecurType recurrence) {
|
||||
}
|
||||
}
|
||||
|
||||
void AlarmController::LoadAlarmFromFile() {
|
||||
void AlarmController::Restore() {
|
||||
lfs_file_t alarmFile;
|
||||
AlarmData alarmBuffer;
|
||||
|
||||
@ -166,7 +166,7 @@ void AlarmController::LoadAlarmFromFile() {
|
||||
NRF_LOG_INFO("[AlarmController] Loaded alarm data from file");
|
||||
}
|
||||
|
||||
void AlarmController::SaveAlarmToFile() const {
|
||||
void AlarmController::Save() const {
|
||||
lfs_file_t alarmFile;
|
||||
if (fs.FileOpen(&alarmFile, "/alarm.dat", LFS_O_WRONLY | LFS_O_CREAT) != LFS_ERR_OK) {
|
||||
NRF_LOG_WARNING("[AlarmController] Failed to open alarm data file for saving");
|
||||
|
@ -78,8 +78,8 @@ namespace Pinetime {
|
||||
AlarmData alarm;
|
||||
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> alarmTime;
|
||||
|
||||
void LoadAlarmFromFile();
|
||||
void SaveAlarmToFile() const;
|
||||
void Restore();
|
||||
void Save() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user