Original Projects and Builds >> NodeMCU IoT Clock >> NodeMCU IoT Clock Source Code

Message started by Administrator on Dec 20th, 2016, 7:27pm

Title: NodeMCU IoT Clock Source Code
Post by Administrator on Dec 20th, 2016, 7:27pm

Initial release:

Please see status and bug list here:

Title: Re: NodeMCU IoT Clock Source Code
Post by Administrator on Nov 3rd, 2017, 9:34pm

New Release (Finally) Uploaded.  (Just in time to test Fall back, for those in areas that use DST)

Bug Fixes and Improvements:

-- Spring Forward and Fall Back were tied to wrong dates. Spring was in November, and Fall was in March.
   Other not - as - glaring errors and optimizations in this section of the main code.
   Still no promises, but at least the worst, and most obvious errors were fixed.

-- Another DST related error in the Daytime connection to the time server.
  2 issues caused the initial connection to the Daytime server (port 13) and determination of whether DST was in effect to fail. -- Fixed.  Initial Connection to the Daytime server, can of course fail due to external problems, but it seems to work most of the time.

-- Various code clean up and space (heap) savings

-- New feature:  In Clock Only mode, the time moves around the display every minute.  This helps keep screen brightness uniform on many (most) types of displays. (Note: The timer is caught and sync'ed the 1st minute, so it does not actually move the time until the second minute. This also means that alarms set for within less 2 minutes after a reboot may not work, but I do not consider that to be a bug.) (Note: There is still 1 or 2 characters at each end that is are used in 24HR mode.)

-- The 1 minute timer is now synced to seconds.  Alarms occur on the minute, or approximately 1 second after.  The movement of the display in clock only mode uses this, so the clock moves on the minute, and not at a random number of seconds.

Startup time reduced to 5 seconds. Depending on how you connect to the NodeMCU, this should not be a problem if you need to "file.rename("init.lua","not_init.lua")", or similar.

NOT Fixed:

When an alarm is playing, the relevant sound file is (obviously) open each time the sound is playing. If the user then requests (or refreshes) the web page, the webserver must open the relevant HTML file. While newer NodeMCU firmwares will allow 2 files to be open at once, the version I used did not.  The result is that there is a very high probability of a crash when attempting to cancel an alarm or hitting snooze. While a crash serves (in a rather un-elegant way) to silence the alarm, and the clock resumes normal function after it reboots, this renders the snooze function unusable. Newer versions of NodeMCU have serious issues with End User Setup, so I have to stick with the old firmware for now.  Given the current state of NodeMCU, this may never be fixed.

Setting the 2 alarms within 10 minutes of each other may still cause unpredictable results. (Code not checked/tested for this condition.)

Punctuation in the Alarm Messages still causes messages to be displayed "funny" (control character codes are displayed).

In addition to the above, more checks for valid inputs (settings) are needed.  Ex: Proper format for Alarm Time.

Weather not yet implemented.  Still anticipating possible memory problems when this code is added.

Title: Re: NodeMCU IoT Clock Source Code
Post by Administrator on Nov 6th, 2017, 9:22pm

Status Update, and additional minor bugs:

-- It did correctly update for the US end of DST !!  :)
(I'd also like to note that our "Atomic" (WWVB) clock in the kitchen still has not gotten a signal, and remains 1 hour off.)

-- On the main settings page, if one changes the time zone, or the time server, and then presses the keyboard enter button instead of clicking the Submit button, it would not save the settings. This has been fixed by simply changing what is looked for in the post response.

-- In time only mode, code was added to move the time on the display to maintain uniform display brightness. Since the time display in 24 hour mode is shorter (fewer characters) than time in AM/PM format, in 24 hour format, it will favor the left of the display, and never use the last few characters of the display.

These have been fixed, and will be in the next .tar.gz I upload.

Here's a picture of my development clock, using a 40 character dot matrix VFD.  It is running the 20 character code, however. Forums » Powered by YaBB 2.1!
YaBB © 2000-2005. All Rights Reserved.