techniccontroller / wordclock_esp8266

Wordclock 2.0 with ESP8266 and NTP time
https://techniccontroller.com/word-clock-with-wifi-and-neopixel/
MIT License
22 stars 18 forks source link

Fix Time Calculation for "Past" and "To" Phrases in Word Clock #22

Closed crimsonclyde closed 9 months ago

crimsonclyde commented 9 months ago

Issue: The word clock displays time phrases incorrectly for certain times.

Specifically: "IT IS n TO n" is showing one hour in advance. "IT IS HALF PAST n" is showing an hour regressive.

Proposed Solution: This merge request introduces adjustments to the time calculation logic to address these issues. The changes include:

These changes aim to ensure that the clock accurately reflects phrases involving "past" and "to," addressing the current issues with hour advancement and regression.

techniccontroller commented 9 months ago

Hi Clyde, thank you for the fix. As I have no English version of the wordclock, I was never testing the code properly ;)

Best regards Edgar

crimsonclyde commented 9 months ago

Hi Edgar,

Du hast mir in deinem Blog ja schon weitergeholfen, daher hab ich mir dann auch die Zeit genommen, den Rest zu fixen.

Sorry für den üblen merge-request, bin kein Entwickler und irgendwie hats ne menge Zeilen verschoben. Die eigentlich Änderung ist eigentlich nur die:

// Convert hours to 12h format and adjust for "TO" phrases

if (hours >= 12) {

hours -= 12;

}

// Increment hour for "TO" phrases (minutes 35 or more)

if (minutes >= 35) {

hours = (hours + 1) % 12;

message += "TO ";

} else if (minutes >= 5) {

message += "PAST ";

}

// Handle edge case for 0 hour (12 AM/PM)

if (hours == 0) {

hours = 12;

}

Der Rest ist pure noise 😊 weil ich nicht aufgepasst habe das beim copy-paste der Editor teilweise Zeilen verschoben hat.

ich habs getestet – läuft einwandfrei nun.

Vielen Dank für dein Projekt. Ich hab, wenn jemand interesse hat noch ne 3D Matrix erstellt die man nutzen kann und modifizieren. Wenn du die in deinen Blog dazu packen willst. Ist aber keine Heldenarbeit, eher „reicht für mich“

Anbei noch ein Bild, wobei das light bleeding in der Realität nicht so schlimm ist 😊 aber vorhanden, da die Plexiglasscheibe vorne so dünn ist.

Cheers und weiterhin gute Projekte

clyde

From: Edgar W @.> Sent: Sunday, 7 January 2024 12:39 To: techniccontroller/wordclock_esp8266 @.> Cc: CrimsonClyde @.>; Author @.> Subject: Re: [techniccontroller/wordclock_esp8266] Fix Time Calculation for "Past" and "To" Phrases in Word Clock (PR #22)

Hi Clyde, thank you for the fix. As I have no English version of the wordclock, I was never testing the code properly ;)

Best regards Edgar

— Reply to this email directly, view it on GitHub https://github.com/techniccontroller/wordclock_esp8266/pull/22#issuecomment-1880033337 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT5XOE4BFMAE7BMISX2EKLYNKCNDAVCNFSM6AAAAABBP4PZICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBQGAZTGMZTG4 . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AAT5XOFNTBVKF5HICJ75N73YNKCNDA5CNFSM6AAAAABBP4PZICWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTQB4EDS.gif Message ID: @. @.> >