Files
track-core/include/app_track_decoder.hpp
T
crosstyan 1005e50be0 feat(track-core): add portable training runtimes
Move scheme and PID training runtime behavior into the pure track_core layer and expose render sinks for injected strip application.

Add ESP compatibility adapters, Python bindings/test scaffolding, and in-memory render support so app_track_bt can consume core render and runtime logic without duplicating it.

Cover circular/linear rendering boundaries, all scheme runtime types, scheme render_to parity, PID sample de-duplication, speed suppression, and live tuning in track-core tests.
2026-05-18 16:15:45 +08:00

60 lines
1.3 KiB
C++

#pragma once
#include <variant>
#include <vector>
#include "app_track_model.hpp"
#include "track_core/scheme_decoder.hpp"
namespace app::track {
struct TrackSchemeDecoder {
using proto_type = track_app_TrackScheme;
static inline const pb_msgdesc_t *pb_fields = &track_app_TrackScheme_msg;
TrackSchemeDecoder() = default;
[[nodiscard]]
static TrackSchemeDecoder from_proto(const proto_type &proto);
[[nodiscard]]
expected<track_core::DecodedScheme, error_t> decode_core() const;
uint8_t id = 0;
std::vector<uint8_t> binary;
Color color;
};
struct TrackSchemeMgr {
using proto_type = track_app_TrackSchemeMgr;
static inline const pb_msgdesc_t *pb_fields = &track_app_TrackSchemeMgr_msg;
struct Add {
using proto_type = track_app_TrackSchemeMgrAdd;
static inline const pb_msgdesc_t *pb_fields = &track_app_TrackSchemeMgrAdd_msg;
TrackSchemeDecoder scheme_decoder;
error_t err{ESP_OK};
static Add from_proto(const proto_type &proto);
};
struct Clear {};
using Unknown = std::monostate;
enum class MessageType : uint8_t {
NONE = 0,
ADD = 1,
CLEAR = 2
};
explicit TrackSchemeMgr() = default;
static TrackSchemeMgr from_proto(const proto_type &proto);
std::variant<Unknown, Add, Clear> choice{Unknown{}};
};
} // namespace app::track