Skip to content

Commit

Permalink
Updated SessionData struct and removed wakelock
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberneel committed Dec 16, 2024
1 parent 152f028 commit 7d1cfae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
29 changes: 20 additions & 9 deletions src/components/infinisleep/InfiniSleepController.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ namespace Pinetime {
}

namespace Controllers {
namespace InfiniSleepControllerTypes {
// Struct for sessions
struct SessionData {
uint8_t day = 0;
uint8_t month = 0;
uint16_t year = 0;

uint8_t startTimeHours = 0;
uint8_t startTimeMinutes = 0;
uint8_t endTimeHours = 0;
uint8_t endTimeMinutes = 0;
};
}

class InfiniSleepController {
public:
InfiniSleepController(Controllers::DateTime& dateTimeCOntroller,
Expand All @@ -51,15 +65,7 @@ namespace Pinetime {
uint8_t preSnoozeMinutes = 255;
uint8_t preSnnoozeHours = 255;

// Struct for sessions
struct SessionData {
uint8_t startTimeHours = 0;
uint8_t startTimeMinutes = 0;
uint8_t endTimeHours = 0;
uint8_t endTimeMinutes = 0;
};

SessionData prevSessionData;
InfiniSleepControllerTypes::SessionData prevSessionData;

void SetPreSnoozeTime() {
if (preSnoozeMinutes != 255 || preSnnoozeHours != 255) {
Expand Down Expand Up @@ -180,8 +186,13 @@ namespace Pinetime {
DisableTracker();
} else {
// ClearDataCSV(TRACKER_DATA_FILE_NAME);
prevSessionData.endTimeHours = 255;
prevSessionData.endTimeMinutes = 255;
prevSessionData.startTimeHours = GetCurrentHour();
prevSessionData.startTimeMinutes = GetCurrentMinute();
prevSessionData.day = dateTimeController.Day();
prevSessionData.month = static_cast<uint8_t>(dateTimeController.Month());
prevSessionData.year = dateTimeController.Year();
EnableTracker();
}
return isEnabled;
Expand Down
12 changes: 6 additions & 6 deletions src/displayapp/screens/Sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,9 @@ void Sleep::SetAlerting() {
} else {
motorController.StartWakeAlarm();
}
if (!infiniSleepController.infiniSleepSettings.naturalWake) {
wakeLock.Lock();
}
// if (!infiniSleepController.infiniSleepSettings.naturalWake) {
// wakeLock.Lock();
// }
alreadyAlerting = true;
}

Expand All @@ -699,9 +699,9 @@ void Sleep::RedrawSetAlerting() {
lv_obj_set_hidden(btnSuggestedAlarm, true);
lv_obj_set_hidden(txtSuggestedAlarm, true);
lv_obj_set_hidden(iconSuggestedAlarm, true);
if (!infiniSleepController.infiniSleepSettings.naturalWake) {
wakeLock.Lock();
}
// if (!infiniSleepController.infiniSleepSettings.naturalWake) {
// wakeLock.Lock();
// }
}

void Sleep::StopAlerting(bool setSwitch) {
Expand Down

0 comments on commit 7d1cfae

Please sign in to comment.