static void print_one_field(mavlink_message_t *msg, const mavlink_field_info_t *f, int idx) { #define PRINT_FORMAT(f, def) (f->print_format?f->print_format:def) switch (f->type) { case MAVLINK_TYPE_CHAR: printf(PRINT_FORMAT(f, "%c"), _MAV_RETURN_char(msg, f->wire_offset+idx*1)); break; case MAVLINK_TYPE_UINT8_T: printf(PRINT_FORMAT(f, "%u"), _MAV_RETURN_uint8_t(msg, f->wire_offset+idx*1)); break; case MAVLINK_TYPE_INT8_T: printf(PRINT_FORMAT(f, "%d"), _MAV_RETURN_int8_t(msg, f->wire_offset+idx*1)); break; case MAVLINK_TYPE_UINT16_T: printf(PRINT_FORMAT(f, "%u"), _MAV_RETURN_uint16_t(msg, f->wire_offset+idx*2)); break; case MAVLINK_TYPE_INT16_T: printf(PRINT_FORMAT(f, "%d"), _MAV_RETURN_int16_t(msg, f->wire_offset+idx*2)); break; case MAVLINK_TYPE_UINT32_T: printf(PRINT_FORMAT(f, "%lu"), (unsigned long)_MAV_RETURN_uint32_t(msg, f->wire_offset+idx*4)); break; case MAVLINK_TYPE_INT32_T: printf(PRINT_FORMAT(f, "%ld"), (long)_MAV_RETURN_int32_t(msg, f->wire_offset+idx*4)); break; case MAVLINK_TYPE_UINT64_T: printf(PRINT_FORMAT(f, "%llu"), (unsigned long long)_MAV_RETURN_uint64_t(msg, f->wire_offset+idx*8)); break; case MAVLINK_TYPE_INT64_T: printf(PRINT_FORMAT(f, "%lld"), (long long)_MAV_RETURN_int64_t(msg, f->wire_offset+idx*8)); break; case MAVLINK_TYPE_FLOAT: printf(PRINT_FORMAT(f, "%f"), (double)_MAV_RETURN_float(msg, f->wire_offset+idx*4)); break; case MAVLINK_TYPE_DOUBLE: printf(PRINT_FORMAT(f, "%f"), _MAV_RETURN_double(msg, f->wire_offset+idx*8)); break; } }
/** * @brief Get field current_battery from sys_status message * * @return Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current */ int16_t mavlink_msg_sys_status_get_current_battery(const mavlink_message_t* msg) { return _MAV_RETURN_int16_t(msg, 16); }
/** * @brief Get field heading from vfr_hud message * * @return Current heading in degrees, in compass units (0..360, 0=north) */ int16_t _get_heading(const mavlink_message_t* msg) { return _MAV_RETURN_int16_t(msg, 16); }