15 :
src_(static_cast<light::AddressableLight *>(src->get_output())),
39 for (
auto &seg : this->segments_) {
40 seg.set_dst_offset(off);
41 off += seg.get_size();
44 int32_t
size()
const override {
45 auto &last_seg = this->segments_[this->segments_.size() - 1];
46 return last_seg.get_dst_offset() + last_seg.get_size();
49 for (
auto &seg : this->segments_) {
50 seg.get_src()->clear_effect_data();
55 for (
auto seg : this->segments_) {
56 seg.get_src()->schedule_show();
64 uint32_t hi = this->segments_.size() - 1;
66 uint32_t mid = (lo + hi) / 2;
67 int32_t begin = this->segments_[mid].get_dst_offset();
68 int32_t
end = begin + this->segments_[mid].get_size();
71 }
else if (index >= end) {
77 auto &seg = this->segments_[lo];
79 int32_t seg_off = index - seg.get_dst_offset();
82 if (seg.is_reversed()) {
83 src_off = seg.get_src_offset() + seg.get_size() - seg_off - 1;
85 src_off = seg.get_src_offset() + seg_off;
88 auto view = (*seg.get_src())[src_off];
89 view.raw_set_color_correction(&this->correction_);
AddressableSegment(light::LightState *src, int32_t src_offset, int32_t size, bool reversed)
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
void set_dst_offset(int32_t dst_offset)
void clear_effect_data() override
int32_t size() const override
PartitionLightOutput(std::vector< AddressableSegment > segments)
void write_state(light::LightState *state) override
light::AddressableLight * get_src() const
int32_t get_src_offset() const
light::LightTraits get_traits() override
light::AddressableLight * src_
This class is used to represent the capabilities of a light.
int32_t get_dst_offset() const
light::ESPColorView get_view_internal(int32_t index) const override
Implementation of SPI Controller mode.
std::vector< AddressableSegment > segments_