get FlexDebug from a DroneCAN node */
| 1250 | get FlexDebug from a DroneCAN node |
| 1251 | */ |
| 1252 | int 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 |
nothing calls this directly
no test coverage detected