January 2019
Intermediate to advanced
458 pages
10h 35m
English
This class contains the logic for registering and keeping track of which feature modules are currently active or inactive. Its header file looks as follows:
#include "ota_core.h"enum ModuleIndex { MOD_IDX_TEMPERATURE_HUMIDITY = 0, MOD_IDX_CO2, MOD_IDX_JURA, MOD_IDX_JURATERM, MOD_IDX_MOTION, MOD_IDX_PWM, MOD_IDX_IO, MOD_IDX_SWITCH, MOD_IDX_PLANT};typedef bool (*modStart)();typedef bool (*modShutdown)();
The inclusion of the OtaCore header is to allow us to use the logging feature. Beyond this, we create another enumeration, which maps a specific feature module to a particular bit in the feature module bitmask (active_mods).
Finally, function pointers are defined, which are used for respectively starting and shutting down a feature ...