fix(track-core): sync track proto fields

This commit is contained in:
2026-06-17 15:05:37 +08:00
parent 5ed07253d8
commit 7a988778f4
5 changed files with 55 additions and 6 deletions
+7
View File
@@ -17,6 +17,9 @@ struct TrackSchemeDecoder {
[[nodiscard]]
static TrackSchemeDecoder from_proto(const proto_type &proto);
[[nodiscard]]
proto_type to_proto() const;
[[nodiscard]]
expected<track_core::DecodedScheme, error_t> decode_core() const;
@@ -37,6 +40,8 @@ struct TrackSchemeMgr {
error_t err{ESP_OK};
static Add from_proto(const proto_type &proto);
[[nodiscard]]
proto_type to_proto() const;
};
struct Clear {};
@@ -52,6 +57,8 @@ struct TrackSchemeMgr {
explicit TrackSchemeMgr() = default;
static TrackSchemeMgr from_proto(const proto_type &proto);
[[nodiscard]]
proto_type to_proto() const;
std::variant<Unknown, Add, Clear> choice{Unknown{}};
};
+9 -3
View File
@@ -809,6 +809,7 @@ struct TrackTestParameters {
uint16_t segment_led_start{0};
uint16_t segment_led_count{0};
uint16_t highlight_last_n_leds{0};
uint8_t blink_palette_index{0};
static TrackTestParameters from_proto(const proto_type &proto) {
TrackTestParameters params;
@@ -821,6 +822,7 @@ struct TrackTestParameters {
params.segment_led_start = proto.segment_led_start;
params.segment_led_count = proto.segment_led_count;
params.highlight_last_n_leds = proto.highlight_last_n_leds;
params.blink_palette_index = proto.blink_palette_index;
return params;
}
@@ -835,10 +837,10 @@ struct TrackTestParameters {
proto.segment_led_start = segment_led_start;
proto.segment_led_count = segment_led_count;
proto.highlight_last_n_leds = highlight_last_n_leds;
proto.blink_palette_index = blink_palette_index;
return proto;
}
void log(const char *tag, esp_log_level_t level) const {
ESP_LOG_LEVEL(level, tag,
"TrackTestParameters{"
@@ -847,13 +849,17 @@ struct TrackTestParameters {
".blink_period_ms=%" PRIu32 ", "
".rainbow_move_speed_leds_per_sec=%" PRIu32 ", "
".segment_led_start=%" PRIu16 ", "
".segment_led_count=%" PRIu16 "}",
".segment_led_count=%" PRIu16 ", "
".highlight_last_n_leds=%" PRIu16 ", "
".blink_palette_index=%" PRIu8 "}",
blink_color.string().c_str(),
blink_duty_cycle_percent,
blink_period_ms,
rainbow_move_speed_leds_per_sec,
segment_led_start,
segment_led_count);
segment_led_count,
highlight_last_n_leds,
blink_palette_index);
}
};