This commit is contained in:
Imbus 2025-07-10 19:37:28 +02:00
parent e6a05046e8
commit e11be74632
2 changed files with 11 additions and 11 deletions

View file

@ -3,13 +3,13 @@
#include "tasks.h"
#include <stdbool.h>
extern QueueHandle_t blink_rate_q;
extern QueueHandle_t blink_cmd_q;
void app_main(void) {
TaskHandle_t task_handle_blink;
TaskHandle_t task_handle_blink_cycle;
blink_rate_q = xQueueCreate(10, sizeof(BlinkCmd_t));
blink_cmd_q = xQueueCreate(10, sizeof(BlinkCmd_t));
// Static here, since main exits, this becomes a dead pointer almost instantly
static BlinkCmd_t initial_command = {.variant = BLINK_STATE, .state = 1};

View file

@ -11,7 +11,7 @@
#include "tasks.h"
QueueHandle_t blink_rate_q;
QueueHandle_t blink_cmd_q;
void blink_cmd_print(const BlinkCmd_t *cmd) {
printf("BlinkCmd { ");
@ -52,7 +52,7 @@ void task_blink(void *pvParams) {
}
while (1) {
if (pdPASS == xQueueReceive(blink_rate_q, &command, 0))
if (pdPASS == xQueueReceive(blink_cmd_q, &command, 0))
blink_cmd_print(&command);
switch (command.variant) {
@ -79,28 +79,28 @@ void task_blink_cycle(void *pvParams) {
vTaskDelay(pdMS_TO_TICKS(2000));
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
printf("Error sending blink command...");
}
vTaskDelay(pdMS_TO_TICKS(2000));
cmd.rate = 50;
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
printf("Error sending blink command...");
}
vTaskDelay(pdMS_TO_TICKS(2000));
cmd.rate = 25;
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
printf("Error sending blink command...");
}
vTaskDelay(pdMS_TO_TICKS(2000));
cmd.rate = 500;
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
printf("Error sending blink command...");
}
@ -108,7 +108,7 @@ void task_blink_cycle(void *pvParams) {
cmd.variant = BLINK_STATE;
cmd.state = 1;
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
printf("Error sending blink command...");
}
@ -116,7 +116,7 @@ void task_blink_cycle(void *pvParams) {
cmd.variant = BLINK_RATE;
cmd.rate = 200;
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
printf("Error sending blink command...");
}
@ -124,7 +124,7 @@ void task_blink_cycle(void *pvParams) {
cmd.variant = BLINK_STATE;
cmd.state = 0;
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
printf("Error sending blink command...");
}