kill all orphans and widows
[phd-thesis.git] / top / green.tex
index e86f0b2..132d9e9 100644 (file)
@@ -404,7 +404,7 @@ Next, the microcontroller goes to light sleep for the minimum of a predefined in
 In general, the microcontroller executes multiple \gls{MTASK} tasks at the same time.
 The \gls{MTASK} device repeatedly check for inputs from the server and executes all tasks that cannot be delayed to the next evaluation round one step.
 The tasks are stored in a priority queue to check efficiently which of them need to be stepped.
-The \gls{MTASK} tasks are ordered at their absolute latest start time in this queue; earliest deadline first.
+The \gls{MTASK} tasks are ordered at their latest start time in this queue; earliest deadline first.
 We use the earliest deadline to order tasks with equal latest deadline.
 
 It is very complicated to make an optimal scheduling algorithm for tasks to minimise the energy consumption.
@@ -487,7 +487,7 @@ There are several different types of interrupts possible that each fire in sligh
 The example shows a debounced light switch for the built-in \gls{LED} connected to \gls{GPIO} pin 13.
 When the user presses the button connected to \gls{GPIO} pin 11, the state of the \gls{LED} changes.
 As buttons sometimes induce noise shortly after pressing, events within \qty{30}{\ms} after pressing are ignored.
-In between the button presses, the device goes into deep sleep using the \arduinoinline{LowPower} library.
+In between the button presses, the device goes into deep sleep using the \arduinoinline{LowPower} library to handle the processor specific sleep interface.
 
 \Crefrange{lst:arduino_interrupt:defs_fro}{lst:arduino_interrupt:defs_to} defines the pin and debounce constants.
 \Cref{lst:arduino_interrupt:state} defines the current state of the \gls{LED}, it is declared \arduinoinline{volatile} to exempt it from compiler optimisations because it is accessed in the interrupt handler.
@@ -534,6 +534,9 @@ void buttonPressed() { /* ISR */ [+\label{lst:arduino_interrupt:isr_fro}+]
 \Cref{lst:mtask_interrupts} shows the interrupt interface in \gls{MTASK}.
 The \cleaninline{interrupt} class contains a single function that, given an interrupt mode and a \gls{GPIO} pin, produces a task that represents this interrupt.
 Lowercase variants of the various interrupt modes such as \cleaninline{change :== lit Change} are available as convenience macros (see \cref{sec:expressions}).
+When the \gls{MTASK} device executes this task, it installs an \gls{ISR} and sets the rewrite rate of the task to infinity, $\rewriterate{\infty}{\infty}$.
+The interrupt handler is set up in such a way that the rewrite rate is changed to $\rewriterate{0}{0}$ once the interrupt triggers.
+As a consequence, the task is executed on the next execution cycle.
 
 \begin{lstClean}[label={lst:mtask_interrupts},caption={The interrupt interface in \gls{MTASK}.}]
 class interrupt v where
@@ -542,10 +545,6 @@ class interrupt v where
 :: InterruptMode = Change | Rising | Falling | Low | High
 \end{lstClean}
 
-When the \gls{MTASK} device executes this task, it installs an \gls{ISR} and sets the rewrite rate of the task to infinity, $\rewriterate{\infty}{\infty}$.
-The interrupt handler is set up in such a way that the rewrite rate is changed to $\rewriterate{0}{0}$ once the interrupt triggers.
-As a consequence, the task is executed on the next execution cycle.
-
 The \cleaninline{pirSwitch} function in \cref{lst:pirSwitch} creates, given an interval in milliseconds, a task that reacts to motion detection by a \gls{PIR} sensor (connected to \gls{GPIO} pin 0) by lighting the \gls{LED} connected to \gls{GPIO} pin 13 for the given interval.
 The system turns on the \gls{LED} again when there is still motion detected after this interval.
 By changing the interrupt mode in this program text from \cleaninline{high} to \cleaninline{rising} the system lights the \gls{LED} only one interval when it detects motion, no matter how long this signal is present at the \gls{PIR} pin.