Closed leewujung closed 6 years ago
My implementation of this feature is currently under development. So far it reads in a file of sunset/sunrise times for a specified daily period. A fixed duration for this cycle on/off feature can also be set. Need to (1) give the user the option to disable the cycle on/off feature and (2) add a parameter for a buffer in seconds before sunset and after sunrise as a margin of safety.
UPDATE (2018-07-10T18:00): (1) and (2) appear to be working. (1) implemented as macro instead of command line flag. And for (2), the safety margin defaults at 3600 s, which seems functional.
UPDATE (2018-07-11T13:00): Changed implementation of dawn/dusk off/on cycle to calculate sunset/sunrise times based on latitude and longitude coordinates and the date. (Thank you to http://stjarnhimlen.se/comp/riset.html.) This is considerably more robust as the user cannot make a mistake with generating the times from the US Naval Observatory. This change also made the code more efficient and less confusing.
UPDATE (2018-07-11T17:00): Fixed an annoying bugs(mktime() gives UTC epoch for local time while timegm() returns the same but for UTC time); just need to check that the cycling is properly working. Having trouble with setting the board's clock to time.nist.gov when connect to internet-connected laptop. Restarting the board seems to delete the configuration.
UPDATE (2018-07-12T14:00): Figured out how to reliably synchronise local time on the board with the host laptop (connected via USB-Serial for the serial console and via Ethernet for the local network required by the NFS and NTP servers). See README.md connection instructions for a detailed step-by-step.