MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / lua_DroneCAN_get_FlexDebug

Function lua_DroneCAN_get_FlexDebug

libraries/AP_Scripting/lua_bindings.cpp:1252–1275  ·  view source on GitHub ↗

get FlexDebug from a DroneCAN node */

Source from the content-addressed store, hash-verified

1250 get FlexDebug from a DroneCAN node
1251 */
1252int lua_DroneCAN_get_FlexDebug(lua_State *L)
1253{
1254 binding_argcheck(L, 4);
1255
1256 const uint8_t bus = get_uint8_t(L, 1);
1257 const uint8_t node_id = get_uint8_t(L, 2);
1258 const uint16_t msg_id = get_uint16_t(L, 3);
1259 uint32_t tstamp_us = get_uint32(L, 4, 0, UINT32_MAX);
1260
1261 const auto *dc = AP_DroneCAN::get_dronecan(bus);
1262 if (dc == nullptr) {
1263 return 0;
1264 }
1265 dronecan_protocol_FlexDebug msg;
1266
1267 if (!dc->get_FlexDebug(node_id, msg_id, tstamp_us, msg)) {
1268 return 0;
1269 }
1270
1271 *new_uint32_t(L) = tstamp_us;
1272 lua_pushlstring(L, (const char *)msg.u8.data, msg.u8.len);
1273
1274 return 2;
1275}
1276#endif // HAL_ENABLE_DRONECAN_DRIVERS
1277
1278#endif // AP_SCRIPTING_ENABLED

Callers

nothing calls this directly

Calls 2

lua_pushlstringFunction · 0.85
get_FlexDebugMethod · 0.80

Tested by

no test coverage detected