datetime: Set the default year to the year during compile
Supersedes #2067.
Build size and comparison to main:
| Section | Size | Difference |
|---|---|---|
| text | 374544B | 16B |
| data | 948B | 0B |
| bss | 63488B | 0B |
While were at it changing stuff related to Date & Time, we could also consider this PR:
https://github.com/InfiniTimeOrg/InfiniTime/issues/1782
Yeah, const-correctness in C++ isn't very obvious haha. I'm not by my dev kit so I can't debug this, but it really doesn't seem to like calling SetTime in the constructor, as doing so seems to result in a non-booting firmware.
Ah, that would be as system task doesn't exist yet so it hits a null ptr deref when it tries to push OnNewTime
Edit: I think just adding a systemtask null check should suffice?
Good thinking! Adding a NULL check should indeed fix it.
It boots now, but I haven't been able to get the time to not be read from .noinit :sweat_smile:, so I can't test if it actually works. I'm sure if the battery runs out it'll reset the time (isn't it annoying having such good battery life!)
Is it possible to make a Firmware that always reads the noinit data I instead of the filesystem?
So I tried @pipe01's InfiniEmu and it looks like we're off by a little bit. I'd guess the month and day are meant to be ones
That makes a lot of sense haha.
My watch just ran out of battery, so I can confirm: this does work on actual hardware!