MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / updateData

Method updateData

app/src/UI/Widgets/Painter.cpp:367–405  ·  view source on GitHub ↗

* @brief Pulls the latest group snapshot, optionally calls onFrame(), repaints cache. */

Source from the content-addressed store, hash-verified

365 * @brief Pulls the latest group snapshot, optionally calls onFrame(), repaints cache.
366 */
367void Widgets::Painter::updateData()
368{
369 if (m_previewMode)
370 return;
371
372 if (m_index < 0)
373 return;
374
375 const auto* dashboard = &UI::Dashboard::instance();
376 const auto count = dashboard->widgetCount(SerialStudio::DashboardPainter);
377 if (m_index >= count)
378 return;
379
380 const auto& group = dashboard->getGroupWidget(SerialStudio::DashboardPainter, m_index);
381 m_bridge->setGroup(&group);
382 m_bridge->setFrame(++m_frameSeq, QDateTime::currentMSecsSinceEpoch());
383
384 DataModel::DeviceWriteApi::setJSDefaultSourceId(&m_engine, group.sourceId);
385
386 if (m_compileDirty) {
387 if (!compile(m_userCode))
388 return;
389 }
390
391 if (!m_runtimeOk)
392 return;
393
394 if (m_hasOnFrame) {
395 QJSValueList noArgs;
396 auto r = m_watchdog.call(m_onFrameFn, noArgs);
397 if (r.isError()) [[unlikely]] {
398 setLastError(QStringLiteral("onFrame: ") + r.property(QStringLiteral("message")).toString());
399 setRuntimeOk(false);
400 return;
401 }
402 }
403
404 renderFrame();
405}
406
407/**
408 * @brief Preview-mode tick: same as updateData() but feeds from m_previewGroup.

Callers

nothing calls this directly

Calls 5

setGroupMethod · 0.80
setFrameMethod · 0.80
isErrorMethod · 0.80
widgetCountMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected