Add SET_LIGHTING (0xB1) and AC22-style init LED shimmer.

Mutable status palette over serial; Unknown uses HSV saturation pulse instead of dim-red/fade-to-black.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
raduet
2026-07-30 17:12:09 +02:00
co-authored by Cursor
parent 940e3f4a3d
commit b98207da4c
9 changed files with 7690 additions and 7391 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ extern "C" {
/* USER CODE BEGIN EC */
#define FW_VERSION_MAJOR 1
#define FW_VERSION_MINOR 0
#define FW_VERSION_PATCH 28
#define FW_VERSION_PATCH 31
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
+3 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include "main.h"
#include "serial_control.h"
#pragma pack(push, 1)
@@ -40,6 +41,7 @@ typedef struct{
void LED_Task();
void LED_Write();
void LED_Init();
void LED_SetColor(RGB_Cycle_t *color);
void LED_SetColor(const RGB_Cycle_t *color);
void RGB_SetColor(RGB_t *color);
void WS2812_SetColor(RGB_t *color);
uint8_t LED_ApplyLightingConfig(const LightingConfigPacket_t *config);
+22
View File
@@ -22,6 +22,7 @@
// Сервисные команды
#define CMD_SET_CONFIG 0xB0
#define CMD_SET_LIGHTING 0xB1
// Перезагрузка для входа в бутлоадер
#define CMD_DEVICE_RESET 0xB5
@@ -147,6 +148,27 @@ typedef struct __attribute__((packed)) {
} ConfigBlock_t;
typedef struct __attribute__((packed)) {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t brightness;
uint8_t effect;
uint8_t speed;
uint8_t fadeTo;
} LightingRolePacket_t;
typedef struct __attribute__((packed)) {
uint8_t mode;
uint8_t flags;
uint8_t previewSec;
uint8_t reserved;
LightingRolePacket_t roles[5];
} LightingConfigPacket_t;
_Static_assert(sizeof(LightingRolePacket_t) == 7, "Lighting role packet must be 7 bytes");
_Static_assert(sizeof(LightingConfigPacket_t) == 39, "Lighting config packet must be 39 bytes");
// Предварительное объявление структуры протокола
typedef struct SerialControl_t SerialControl_t;