mirror of
https://github.com/esphome/esphome.git
synced 2025-10-31 23:21:54 +00:00
[select] Store options in flash to reduce RAM usage
This commit is contained in:
@@ -57,12 +57,12 @@ class LVGLSelect : public select::Select, public Component {
|
||||
// Widget uses std::vector<std::string>, SelectTraits uses FixedVector<const char*>
|
||||
// Convert by extracting c_str() pointers
|
||||
const auto &opts = this->widget_->get_options();
|
||||
std::vector<const char *> opt_ptrs;
|
||||
opt_ptrs.reserve(opts.size());
|
||||
for (const auto &opt : opts) {
|
||||
opt_ptrs.push_back(opt.c_str());
|
||||
FixedVector<const char *> opt_ptrs;
|
||||
opt_ptrs.init(opts.size());
|
||||
for (size_t i = 0; i < opts.size(); i++) {
|
||||
opt_ptrs[i] = opts[i].c_str();
|
||||
}
|
||||
this->traits.set_options({opt_ptrs.begin(), opt_ptrs.end()});
|
||||
this->traits.set_options(opt_ptrs);
|
||||
}
|
||||
|
||||
LvSelectable *widget_;
|
||||
|
||||
Reference in New Issue
Block a user