This module takes over all analog functions of the firmware. This includes measuring track voltage and current, measuring temperature, and monitoring all of those measurements.
Initialization takes place in init(). This function performs the following operations:
Once started, the ADC task runs continuously. It measures voltages and currents at a frequency of 8kHz. A total of 160 samples are recorded within one conversion frame meaning one frame lasts exactly 20ms. All measurements are written to the corresponding voltages or currents queue.
If the measured currents indicate a short circuit, the bug LED is switched, state is set to short circuit and a Z21 track short circuit message is broadcast.
Once started, the temperature task runs continuously. The internal temperature sensor is read once per second and the result is converted into degrees Celsius. The result is written to the corresponding queue.
The convert.hpp header provides some conversion functions to convert between raw ADC values and Si units. The following functions are defined: