Calculate event recurrance
[wakeup.git] / doc / design.xml
index e531d81..6dea068 100644 (file)
     </chapter>
 
     <chapter>
+    <heading>Hardware</heading>
+<para>
+<picture src='../hardware/ledcontrol-sch.png' eps='../hardware/ledcontrol-sch'/>
+</para>
+<para>
+<picture src='../hardware/ledcontrol-pcb.png' eps='../hardware/ledcontrol-pcb'/>
+</para>
+<para>
+
+IO pin assignments:
+<table cpos='rll'>
+  <thead><col>Connector pin</col><col>RPi IO</col><col>Function</col></thead>
+  <row><col> 3</col><col>GPIO 2</col><col>Light switch</col></row>
+  <row><col> 5</col><col>GPIO 3</col><col>Red PWM</col></row>
+  <row><col> 7</col><col>GPIO 4</col><col>White PWM</col></row>
+  <row><col> 8</col><col>GPIO 14</col><col>Green PWM</col></row>
+  <row><col>10</col><col>GPIO 15</col><col>Blue PWM</col></row>
+  <row><col>35</col><col>GPIO 19</col><col>Curtain open out</col></row>
+  <row><col>36</col><col>GPIO 16</col><col>Curtain open in</col></row>
+  <row><col>37</col><col>GPIO 26</col><col>Curtain close out</col></row>
+  <row><col>38</col><col>GPIO 20</col><col>Curtain close in</col></row>
+</table>
+</para>
+
+    </chapter>
+
+    <chapter>
     <heading>Modules</heading>
 <para>
 The dataflow diagram shows the high level design.
@@ -373,12 +400,19 @@ When the next event does happen, meaning the time of the occurance is the curren
 Each action can for example be a change in lights or the opening or closing of curtains.
 Event methods:
 
-FromXML
-ToXML
-add_recurrance
-next_occurance
-add_action
-execute_actions
+<itemize>
+<item>FromXML</item>
+<item>ToXML</item>
+<item>add_recurrance</item>
+<item>next_occurance</item>
+<item>add_action</item>
+<item>execute_actions</item>
+</itemize>
+
+Calculating the next occurance after a certain time is done by adding the number of days or months untill the given time
+is passed or untill the end of the recurrence is reached. A recurrence pattern of weeks is converted to a pattern of n * 7 days.
+The end of the recurrence is specified as an end time or as a maximum number of occurences.
+A recurrence pattern specified as a set of weekdays requires a different calculation.
 </para>
     </section>
     </chapter>