Files
chataway/include/track_core/memory_strip.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

53 lines
1005 B
C++

#pragma once
#include <cstddef>
#include <cstdint>
#include <vector>
#include "track_core/model.hpp"
#include "track_core/render.hpp"
namespace track_core {
class MemoryStrip {
public:
explicit MemoryStrip(std::size_t led_count = 0);
[[nodiscard]]
TrackError begin();
[[nodiscard]]
TrackError clear();
[[nodiscard]]
TrackError fill(std::size_t start, std::size_t count, Color color);
[[nodiscard]]
TrackError show();
[[nodiscard]]
TrackError set_leds_count(std::size_t count);
[[nodiscard]]
std::size_t leds_count() const;
[[nodiscard]]
std::uint64_t frame_sequence() const;
[[nodiscard]]
std::span<const Color> pixels() const;
private:
std::vector<Color> pixels_;
std::uint64_t frame_sequence_{};
bool begun_{};
};
[[nodiscard]]
TrackError apply_render_plan(MemoryStrip &strip, const TrackRenderPlan &plan);
[[nodiscard]]
TrackRenderSink make_memory_strip_sink(MemoryStrip &strip);
} // namespace track_core