41 lines
1.3 KiB
C++
41 lines
1.3 KiB
C++
#include <iostream>
|
|
|
|
#include "track_core/memory_strip.hpp"
|
|
|
|
int main() {
|
|
track_core::TrackConfig config{
|
|
.draw_kind = track_core::TrackDrawKind::circular,
|
|
.line_length_m = 10.0F,
|
|
.active_line_length_m = 4.0F,
|
|
.head_offset_m = 0.0F,
|
|
.line_leds_num = 20,
|
|
};
|
|
track_core::TrackInfo info{
|
|
.kind = track_core::SchemeKind::speed_input_time_segmented_mileage_free,
|
|
.color = track_core::Color::green(),
|
|
.id = 1,
|
|
.is_running = true,
|
|
.num_segments = 1,
|
|
};
|
|
track_core::TrackReport report{
|
|
.id = 1,
|
|
.state = track_core::TrackState::run,
|
|
.mileage_m = 8.5F,
|
|
.speed_m_s = 1.0F,
|
|
.time_elapsed_ms = 0,
|
|
};
|
|
|
|
track_core::MemoryStrip strip(config.line_leds_num);
|
|
const auto plan = track_core::make_track_render_plan(config, info, report);
|
|
static_cast<void>(track_core::apply_render_plan(strip, plan));
|
|
static_cast<void>(strip.show());
|
|
|
|
std::cout << "frame=" << strip.frame_sequence() << " leds=" << strip.leds_count() << "\n";
|
|
for (std::size_t i = 0; i < plan.span_count; ++i) {
|
|
const auto &span = plan.spans[i];
|
|
std::cout << "span start=" << span.start_led
|
|
<< " count=" << span.led_count
|
|
<< " color=" << span.color.hex() << "\n";
|
|
}
|
|
}
|