Sunday, August 6, 2017

Scheduling, finally

In working on the last bit of implementation for the part of the sched class I noticed a few things:

  • too many 16 bit values for high resolution 
  • high resolution in timing that doesn't matter
  • reliance on inaccurate intervals rather than RTC adjusted time
  • attempt at reuse for both scheduling and logging (as log timestamps)
So I simplified the storage to the following 8 bytes:
  • Year (3 bits) + Month (4 bits) + Flag (1 bit)
  • Date (8 bits)
  • Hour (5 bits) + flags (3 bits)
  • Minutes (4 bits) + flags (2 bits)
  • Interval4 - (8 bits)
    • 4 min resolution
    • max of 1020 minutes (17 hours)
  • IntervalMax (8 bits) - number of recurring events
  • Page (8 bits)
  • Entry (8 bits)
This isn't loaded into SRAM; the Year+Month and Date values are tested (either for a match or for 'any') first. If those match, the event would fire 'today', and the schedule should be loaded.

The flag bits in hour and minute 'start time' aren't specified yet; I have a hunch they will be used to clarify how the interval relates to the start time & recurrence.

Also, rather than counting down, I switched to using the interval and the start time to calculate the next time of day to fire. 'Minutes' are stored in four bits:


0 0
1 4
2 8
3 12
4 16
5 20
6 24
7 28
8 32
9 36
10 40
11 44
12 48
13 52
14 56
15 n/a (maybe 30?)



No comments:

Post a Comment