Clock backup
It was necessary to make sure that the unit maintains the time when it is not powered. I used an external circuit (RTC) to do this job. The RTC is connected to a backup battery. The circuit has very low consumption below 500 nA. Theoretically it should consume the CR2032 battery’s energy in about half a century. If the battery survives for so long...
When the time is set up, it is stored to the external RTC too. If the unit is powered down, the RTC is powered from the battery and the time is maintained. After power-up, the main program will connect with the external RTC to fetch the time. Moreover, the unit memorizes the scheduled table and state of the switch. It means, after power-up the unit reads the saved switch state. If it was on, the table is opened, and LEDs are started.
I also fixed several small bugs in the Windows application.
The following video shows the unit's time setup. After power-down and -up, the time is resumed. Similarly, the unit memorizes if the light was on or off.