MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / curr_state_to_string

Method curr_state_to_string

OpenHD/ohd_telemetry/src/rc/JoystickReader.cpp:257–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257std::string JoystickReader::curr_state_to_string(
258 const JoystickReader::CurrChannelValues& curr_channel_values) {
259 std::stringstream ss;
260 ss << "Connected:" << (curr_channel_values.considered_connected ? "Y" : "N")
261 << "\n";
262 ss << "Name:" << curr_channel_values.joystick_name << "\n";
263 ss << "Values:[";
264 for (int i = 0; i < curr_channel_values.values.size(); i++) {
265 ss << (int)curr_channel_values.values[i];
266 if (i == curr_channel_values.values.size() - 1) {
267 ss << "]\n";
268 } else {
269 ss << ",";
270 }
271 }
272 const auto delay_since_last_update =
273 std::chrono::steady_clock::now() - curr_channel_values.last_update;
274 ss << "Delay since last update:"
275 << std::chrono::duration_cast<std::chrono::milliseconds>(
276 delay_since_last_update)
277 .count()
278 << "ms";
279 return ss.str();
280}
281
282void JoystickReader::write_matching_axis(
283 std::array<uint16_t, JoystickReader::N_CHANNELS>& rc_data,

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected