It's been almost 4 months, but it's time to put the wraps on the code for the
GPS clock. I've been so busy with other 3D printing and 3D rendering projects. Not to mention, my job gets in the way of productivity sometimes. More often than not, I get home from work and my brain is just shot.
In any case, it's time to finish up some of the GPS code that's been giving me trouble.
The last I left it, the GPS clock auto-synced at midnight. This posed some issues. With my timezone offset of -5, I know that when it's midnight in Greenwich, it's 7PM here. I needed to add some compensation in my code to subtract a day from the day of the month and the day of the week. However, if I do a manual sync, that all goes out the window.
If I do a manual sync before 7PM here, it knocks a day off the day the month and the day of the week. I needed to add some code that would be able to distinguish the difference between a manual sync and an auto sync. However, that's further complicated by the fact that even a manual sync can be done before or after it's already tomorrow in Greenwich.
I decided to put in a screen prompt that asks if it's already tomorrow in Greenwich. This should fix it.
Starting from the GPS Menu, I just have to scroll down to the SYNC option on the bottom.
Previously, I'd just press select on the 5-way joystick, and a sync would occur.
Now, a new prompt pops up that asks me if it's already tomorrow in Greenwich. I can toggle between YES and NO, and press the center select button on the 5-way switch to confirm.
I'm then taken back to the main GPS menu, where DONE is displayed for 3 seconds. In the background, a sync occurs. It'll knock a day of the day of month and the day of week if I selected YES. If I selected NO, then a sync will occur without any compensation.
To make things even easier. I decided to have the clock auto-sync at noon instead of midnight. This way it's always the same day here as it is there. I don't have to do any kind of compensation when I auto-sync at noon.
Of course, this new method and menu option doesn't cover all the error cases. What happens if I do a manual sync when it's tomorrow in Greenwich and a new month? What if I do manual sync at 10PM on New Year's Eve? My day and day of week will be right, but my month and year will be +1. I can't possibly program all these crazy error cases. The times that I'll actually have to do a manual sync will be far and few between. Doing a manual sync when it's already a new month or year in Greenwich will be even rarer. For now, I think it'll work for me just fine.
The only thing left to do was 3D print a joystick for the 5-way switch. This, however, proved to be far more difficult than I had anticipated.
I've printed almost a dozen different joysticks and nothing seems to work. I just can't seem to print one small enough without it coming out all crazy looking.
There isn't just the problem of printing a small joystick. There's also the problem of gluing it on. I had one or two that came out pretty good, but the slightest amount of glue on the joystick is enough to jam the whole thing up. I couldn't click left any more. There also wasn't enough play in the switch to register a center click either.
Believe it or not, a pen refill cut to size actually works. Although it looks absolutely horrible.
I'd really hate to think that this $2 button is going to be the death of this $100 clock! I should have just stuck with my original design and used buttons.
See this project from start to finish: GPS Clock Prototyping, Part I GPS Clock Prototyping, Part II Arduino Mega 2560 GPS Clock Prototyping, Part III GPS Clock Prototyping, Part IV GPS Clock Prototyping, Part V GPS Clock Assembly, Part I GPS Clock Assembly, Part II GPS Clock Assembly, Part III GPS Clock Assembly, Part IV
GPS Clock Rework - Ditching the Joystick, Part I GPS Clock Rework - Ditching the Joystick, Part II GPS Clock Rework - Ditching the Joystick, Part III