MCPcopy Create free account
hub / github.com/FastLED/FastLED / executeUiUpdates

Method executeUiUpdates

src/platforms/shared/ui/json/ui_manager.cpp.hpp:175–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173
174
175void JsonUiManager::executeUiUpdates(const fl::json &doc) FL_NOEXCEPT {
176
177 if (doc.is_object()) {
178
179 // Iterate through all keys in the JSON object
180 for (auto key : doc.keys()) {
181 const char* id_or_name = key.c_str();
182
183 auto component = findUiComponent(id_or_name);
184 if (component) {
185 const fl::json v = doc[key.c_str()];
186 component->updateInternal(v);
187 } else {
188 FL_ERROR("could not find component with ID or name: " << id_or_name);
189 }
190 }
191 } else {
192 // Debug: Show what we actually received instead of just asserting
193 fl::string debugJson = doc.to_string();
194 FL_WARN("*** UI UPDATE ERROR: Expected JSON object but got " <<
195 (doc.is_array() ? "array" : "non-object") <<
196 ": " << debugJson.substr(0, 200).c_str() << "...");
197
198 // Use a warning instead of assertion to prevent crashes
199 // FL_ASSERT(false, "JSON document is not an object, cannot execute UI updates");
200 }
201}
202
203void JsonUiManager::onEndFrame() FL_NOEXCEPT {
204 processPendingUpdates();

Callers

nothing calls this directly

Calls 7

is_objectMethod · 0.45
keysMethod · 0.45
c_strMethod · 0.45
updateInternalMethod · 0.45
to_stringMethod · 0.45
is_arrayMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected