Radio Controlled Timer, Step E

  • Set up a table for sunrise/sunset per month
  • Set up good morning/good night.
  • Save/read from 1829 EEPROM

For every month set up a table with sunrise / sunset.

Use good morning at 06:00 and good night at 23:00 for all months.

A day in Jan

  • 06:00 turn on (Good morning)
  • 09:16 turn off (Sunrise)
  • 15:04 turn on (Sunset)
  • 23:00 turn off (Good night)

09:16 and 15:04 = sunrise / sunset 15 Jan where I live.

And in June with sunrise at 02:51 and sunset in 23:51, always off.

One problem with good morning / good night is daylight saving. As the RTC will run on non-daylight-saving time all year the 06:00 an 23:00 has to be adjusted one hour during daylight-saving months.

A table for this is also needed.

All these times (sunrise / sunset / good morning, good night) will be possible to change from a PC program communicating with the 1829 via UART in a later part. But initial values defined in the source code as EEPROM data.

Unit testing of EEPROM requires 2 memory buffers for EEPROM data.

  • A save area for EEPROM during unit testing as EEPROM unit testing writes to EEPROM and “destroys” the data from the source code. After EEPROM unit tests this has to be restored as future unit tests may depend on the data in the source files.
  • A buffer for writing/reading of unit test data. This buffer specific for unit tests.

One buffer = 63 bytes so two buffers cant’t be fit in a 80 byte RAM page. Two RAM pages needed.

Also some restructuring of unit test code.

No change in schema from step D.

Code on Github