aboutsummaryrefslogtreecommitdiff
path: root/main/ws2812b_writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/ws2812b_writer.c')
-rw-r--r--main/ws2812b_writer.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/main/ws2812b_writer.c b/main/ws2812b_writer.c
index 7d0e30f..f7176f1 100644
--- a/main/ws2812b_writer.c
+++ b/main/ws2812b_writer.c
@@ -85,17 +85,19 @@ void calculate_colors(
portTASK_FUNCTION(ws2812b_write_task, params)
{
ws_params_t* ws_params = (ws_params_t*) params;
-
reset_parameters(ws_params);
ws2812b_buffer_t* buffer = ws2812b_new_buffer(SIZE);
+
for (;;) {
- calculate_colors(ws_params, buffer);
- ws2812b_write(ws_params->drv, buffer);
- vTaskDelay(1);
- // TODO make this happen as a separate, timer task.
- ws_params->state.time += ws_params->state.timetick;
+ // Copy the parameters to avoid a change occuring during the calculation.
+ ws_params_t copy_params;
+ memcpy(&copy_params, ws_params, sizeof(ws_params_t));
+
+ calculate_colors(&copy_params, buffer);
+ ws2812b_write(copy_params.drv, buffer);
+ vTaskDelay(1);
}
}