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

Method updateData

app/src/UI/Widgets/Compass.cpp:131–154  ·  view source on GitHub ↗

* @brief Updates the compass heading from the dashboard source. */

Source from the content-addressed store, hash-verified

129 * @brief Updates the compass heading from the dashboard source.
130 */
131void Widgets::Compass::updateData()
132{
133 if (!isEnabled())
134 return;
135
136 if (!VALIDATE_WIDGET(SerialStudio::DashboardCompass, m_index))
137 return;
138
139 const auto& dataset = GET_DATASET(SerialStudio::DashboardCompass, m_index);
140 if (!std::isfinite(dataset.numericValue))
141 return;
142
143 double v = std::fmod(dataset.numericValue, 360.0);
144 if (v < 0.0)
145 v += 360.0;
146
147 const auto card = cardinalDirection(v);
148 if (!DSP::notEqual(v, m_value) && card == m_cardinal)
149 return;
150
151 m_value = v;
152 m_cardinal = card;
153 Q_EMIT updated();
154}
155
156//--------------------------------------------------------------------------------------------------
157// Cardinal resolver

Callers

nothing calls this directly

Calls 4

VALIDATE_WIDGETFunction · 0.85
isfiniteFunction · 0.85
fmodFunction · 0.85
notEqualFunction · 0.85

Tested by

no test coverage detected