Skip to content

Add Time settings#21

Merged
lulf merged 2 commits intolulf:mainfrom
realroot2185:time-settings
Feb 25, 2025
Merged

Add Time settings#21
lulf merged 2 commits intolulf:mainfrom
realroot2185:time-settings

Conversation

@realroot2185
Copy link
Contributor

Right now there is no setting for the date.
And incrementing the time over 24 hours will go to the next day.

I wonder if it is possible to set the current time instead of the unix epoch (1970) when flashing it.
Infinitime should have that now.

@realroot2185 realroot2185 changed the title Add a Time settings in settings Add Time settings Feb 25, 2025
Copy link
Owner

@lulf lulf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I rely on just using the current time service, which works nicely since I rarely let it run out of battery. But I'm fine with adding a menu entry for adjusting, thanks for adding!

@lulf lulf merged commit 3e8543c into lulf:main Feb 25, 2025
2 checks passed
@realroot2185
Copy link
Contributor Author

realroot2185 commented Feb 25, 2025

Now it would be nice to have an alarm.
Where should I store the var?
I guess it should be a PrimitiveDateTime.

Edit: just holding hours and minute I think.

Trying in firmware/src/clock.rs:

pub struct Clock {
    time: Mutex<ThreadModeRawMutex, RefCell<time::PrimitiveDateTime>>,
    alarm: (u8, u8),
}

@lulf
Copy link
Owner

lulf commented Feb 26, 2025

Now it would be nice to have an alarm. Where should I store the var? I guess it should be a PrimitiveDateTime.

Edit: just holding hours and minute I think.

Trying in firmware/src/clock.rs:

pub struct Clock {
    time: Mutex<ThreadModeRawMutex, RefCell<time::PrimitiveDateTime>>,
    alarm: (u8, u8),
}

Alarms should preferably be stored to flash I guess, but for now in memory is fine. An alternative to storing it on the clock would be to spawn a task whenever an alarm is set, and the task would wait until the deadline before signalling that it should be raised.

@realroot2185
Copy link
Contributor Author

How does a task signal that a WatchState I believe should be raised?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants