Nacelle specific code fore 2026 Controls .
For releases and prepared demos, please see the Releases section.
A number of function prototypes are defined include\NacelleTasks.hpp. These correspond to FreeRTOS tasks, which are comparable to threads.
Fun fact: Espressif had reimplemented the C++
std::threadlibrary on top of FreeRTOS tasks.
For example, here is the function prototype for the task that updates the finite state machine:
/**
* @brief Task to control run the FSM
*/
[[noreturn]] void vTaskUpdateFSM([[maybe_unused]] void *pvParameters);Here is the full list of tasks:
- The finite state machine, as seen in the FSM diagram:

- Poll sensors, such as the encoder in the nacelle
- Adjust the pitch (actuator)
- Process received data. Since we don't have a lot of control over the internal WiFi task, we didn't want to slow down the rx callback. Instead it just copies the data to a FreeRTOS queue. This tasks then treats the data like a struct and processes it, copying the data into the appropriate variables (stored in
NacelleContainer.hpp) - Send data
- We never finished writing the configure tasks, but the idea would be for it to recall any setup code for broken sensors and the like.
- LED - flash the LED so that we know it's still working without using too much power
- LOG - write data to terminal
- We never added Telnet support, but this task would have ran the Telnet server's main loop
- We never added over the air support, but this task would have ran the OTA sever's main loop
The data type TaskInfo and a number of function prototypes are defined in include\NacelleTasks.hpp. TaskInfo is used to keep track of one task over the operation of the turbine. An etl::array of these in NacelleContainer.hpp keeps track of all of them, which can be indexed into using the MAIN_TASK_IDS enum found in the same header. This makes it "easy" to get the FreeRTOS handle in order to suspend or resume the task, as well as to create them in the first place. In fact xTaskCreate is only found once in the code: in the Arduino setup() function in main.cpp. Since TaskInfo contains everything needed to create a new task, the setup() "simply" loops through the previously mentioned array of TaskInfo structs, calling xTaskCreate on each.
.devcontainer- Microsoft Devcontainer config.github- GitHub config.idea- CLion config.pio- Platformio stuffbuild- Platformio build directorylibdeps- Platformio libraries
.PVS-Studio- PVS Studio stuff.vscode- VSCode configboards- Custom board definitionsdemos- Nacelle specific demos, Arduino compatible for ease of useActuatorDemo- Manually control the actuatorCommunicationDemos- Comms demo and MAC Address getterEncoderDemoNacelleDemo- Manually control the actuator
docs- documentationconfig- Doxygen configcpp- Notes on C++doxygen-out- Autogenerated Doxygen API dos- Miscellaneous Windows Scripts/ batch files (
.bat)
include- Miscellaneous header filesEncoder.hppNacelleConfig.hpp- Nacelle specific configurationNacelleContainer.hpp- Hold shared variablesNacelleFSM- Finite state machine implementation for the nacelleNacelleTasks.hpp- FreeRTOS task function declarations and related datatypes
lib- Private libraries2026-Controls-Core- Common files -CalPolyWindPower/2026-Controls_Core
logs- Log files from the serial console / monitorsrc- Miscellaneous source filestest- Where tests would go if he had themplatformio.ini- Platformio config- MISRA - Rules for automotive code quality
- [This repo] Common Files (Include in Nacelle & Load as git sub-module):
CalPolyWindPower/2026-Controls_Core(Included as a sub-module in both the nacelle & load side controller) - Nacelle:
CalPolyWindPower/2026-Controls_Nacelle - Load:
CalPolyWindPower/2026-Controls_Load - Controller & Code Performance Experiments
CalPolyWindPower/ArduinoBenchmark