InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

datetime: Set the default year to the year during compile

Open FintasticMan opened this issue 1 year ago • 10 comments

Supersedes #2067.

FintasticMan avatar Oct 02 '24 22:10 FintasticMan

Build size and comparison to main:

Section Size Difference
text 374544B 16B
data 948B 0B
bss 63488B 0B

github-actions[bot] avatar Oct 02 '24 22:10 github-actions[bot]

While were at it changing stuff related to Date & Time, we could also consider this PR:

https://github.com/InfiniTimeOrg/InfiniTime/issues/1782

tituscmd avatar Oct 02 '24 22:10 tituscmd

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.

FintasticMan avatar Oct 06 '24 12:10 FintasticMan

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?

mark9064 avatar Oct 06 '24 15:10 mark9064

Good thinking! Adding a NULL check should indeed fix it.

FintasticMan avatar Oct 06 '24 20:10 FintasticMan

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!)

FintasticMan avatar Oct 07 '24 08:10 FintasticMan

Is it possible to make a Firmware that always reads the noinit data I instead of the filesystem?

NeroBurner avatar Oct 07 '24 14:10 NeroBurner

image 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

mark9064 avatar Oct 07 '24 15:10 mark9064

That makes a lot of sense haha.

FintasticMan avatar Oct 08 '24 09:10 FintasticMan

My watch just ran out of battery, so I can confirm: this does work on actual hardware!

FintasticMan avatar Oct 09 '24 23:10 FintasticMan