Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect localTime when enabling countdown #4197

Open
1 task done
HackerShurf opened this issue Oct 17, 2024 · 17 comments
Open
1 task done

Incorrect localTime when enabling countdown #4197

HackerShurf opened this issue Oct 17, 2024 · 17 comments

Comments

@HackerShurf
Copy link

What happened?

When I set the feature to turn on the countdown timer it sets the date to some time in the 1970s

To Reproduce Bug

Turn on the NTP
set to scrolling text
let it establish the correct time and date
Turn on countdown timer option with any date in 2025 I was using august 25, 2025

Expected Behavior

To show a count down timer to the date

Install Method

Binary from WLED.me

What version of WLED?

0.15.0-b6

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@blazoncek
Copy link
Collaborator

What makes you think Scrolling text will display countdown?

@blazoncek blazoncek added enhancement and removed bug labels Oct 17, 2024
@HackerShurf
Copy link
Author

What makes you think Scrolling text will display countdown?

It used to in previous versions I've had other people test. Looks like it has not worked for a few versions. Unless you have instructions on how to make the countdown timer work.

@blazoncek
Copy link
Collaborator

I am the author of Scrolling text effect and I know I never implemented "coundown" of any kind. 😄

@HackerShurf
Copy link
Author

SmartSelect_20241017_002844
Checking the box for countdown used to mak it count down to that date and time unless I'm mistaken.

@HackerShurf
Copy link
Author

I am the author of Scrolling text effect and I know I never implemented "coundown" of any kind. 😄

But if you developed it then it must be a different item or setup. But I guess it needs to be a feature request then.

@dosipod
Copy link

dosipod commented Oct 17, 2024

@HackerShurf It is actually working if you play with the date ( the calculation is wrong though ) but scrolling text will do countdown , feature it is but it is a bug

Countdown_b6_FIX.mov

@softhack007
Copy link
Collaborator

softhack007 commented Oct 17, 2024

Checking the box for countdown used to make it count down to that date and time unless I'm mistaken.

"countdown mode" is actually a feature of the "analog clock overlay". This is an overlay effect for 1D rings. So it has no relation with 2D scrolling text.

@softhack007 softhack007 changed the title Countdown timer does not display countdown Countdown Mode: countdown display in 2D scrolling text effect? Oct 17, 2024
@DedeHai
Copy link
Collaborator

DedeHai commented Oct 17, 2024

Checking the box for countdown used to make it count down to that date and time unless I'm mistaken.

"countdown mode" is actually a feature of the "analog clock overlay". This is an overlay effect for 1D rings. So it has no relation with 2D scrolling text.

then this is a bug? if its just for analog clock overlay it should not change the behaviour of scrolling text IMHO. A good fix would be to allow it in scrolling text instead of braking it.

@softhack007
Copy link
Collaborator

softhack007 commented Oct 17, 2024

@DedeHai I wouldn't say it's a bug, but a feature that could be added to scrolling text. Right now I have no idea which "tag" could be used - maybe append a "Z" so that "#MMDD" shows month and date, but "#MMDDZ" shows countdown months and days.

I wouldn't change the display automatically based on a checkbox in time settings - this relation would be hard to understand for users who are running their digital clocks with WLED.

@DedeHai
Copy link
Collaborator

DedeHai commented Oct 17, 2024

I wouldn't change the display automatically based on a checkbox in time settings - this relation would be hard to understand for users who are running their digital clocks with WLED.

isn't that what it is currently doing i.e. what the issue was opened for?

@blazoncek
Copy link
Collaborator

Scrolling text is displaying localTime as it is calcualted by ntp.cpp.
If there is an error it is in the nttp.cpp not Scrolling text.

@dosipod
Copy link

dosipod commented Oct 17, 2024

With my none existing experience I have gone over ntp.cpp and that is not a code but all math .
Since that is the case only math , with the correction by adding around 55 years (give or take for now )
to the target date I could get the date I want to countdown on the scrolling text from ui

Please do not close this , marked it any way you like and if code correction is not possible then I will plot multiple dates and will provide an accurate value to use in ui to get scrolling text to do the count down at least for date . If you see that as a silly way of doing it then I agree and please do not shot the messenger as myself and DedeHai do not use it and this is the first
time I did just to verify for the OP , Cheers

@5chubrakete
Copy link

After a few tests the countdown TIME seems to work fine. The DATE is offset by 1.1.1970.
since: if (countdownMode) localTime = n - countdownTime + utcOffsetSecs;
So maybe we can subtract 1, 1 and 1970 before displaying DD, MO, YY, YYYY and DATE in this mode.
Am-time and string representations of month or days make no sense though. So display "-" or ?

I also found that during effect transitions the localtime is displayed instead of the countdown time. (flickering)

@HackerShurf
Copy link
Author

Checking the box for countdown used to make it count down to that date and time unless I'm mistaken.

"countdown mode" is actually a feature of the "analog clock overlay". This is an overlay effect for 1D rings. So it has no relation with 2D scrolling text.

then this is a bug? if its just for analog clock overlay it should not change the behaviour of scrolling text IMHO. A good fix would be to allow it in scrolling text instead of braking it.

This is my thinking as well since it globally effects the time/other effects.

@DedeHai
Copy link
Collaborator

DedeHai commented Oct 18, 2024

I see two solutions:
a) fix ntp and make the scrolling-text FX display the countdown-time if this option is activated
b) fix ntp and handle countdown completely separate, add special strings to make it display in clock mode

personally I prefer option a). This "bug" of countdown mode changing the global time has been present for a long time and apparently there were no requests to fix it up to now. It will not break any existing setups and makes it easy to display a countdown.
If special Strings (or just a "C" in front for countdown like "C#HH" for hours or "C#SS" for seconds) is used, then having the checkmark for countdown mode makes little sense to me, it could just always be enabled but that would break the analog clock.
The only downside of option a) would be that displaying a countdown AND the time on different segments is not possible. Since not many seem to use this option and it was not possible up to this point I see no problem with that.

@blazoncek blazoncek changed the title Countdown Mode: countdown display in 2D scrolling text effect? Incorrect localTime when enabling countdown Oct 18, 2024
@5chubrakete
Copy link

It might also make sense to add (or chage the meaning of) some tags. e.g. having #DDDD display the total days so target instead of days to end of month requiring the display of month and years in addition.

I'dd prefer a) as well.

@dosipod
Copy link

dosipod commented Oct 23, 2024

After a few tests the countdown TIME seems to work fine. The DATE is offset by 1.1.1970. since: if (countdownMode) localTime = n - countdownTime + utcOffsetSecs; So maybe we can subtract 1, 1 and 1970 before displaying DD, MO, YY, YYYY and DATE in this mode. Am-time and string representations of month or days make no sense though. So display "-" or ?

I also found that during effect transitions the localtime is displayed instead of the countdown time. (flickering)
@5chubrakete
I did not see this and yeah i have tested now as below and it is the offset by 1.1.1970 ,
image
Note: I added one day using that site to the target date of Oct 25,2024 but the math checks out

@softhack007 softhack007 added this to the 0.15.1 candidate milestone Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants