Do you have any code usage examples?
For example, changing the flight mode
l = mavlink_msg_set_mode_pack(1,200, &msg,0, 1, 1);// Set flight mode>1 is Circular
l = mavlink_msg_to_send_buffer(sendda,&msg);
HAL_UART_Transmit(&huart2, sendda, l, 100);
Firstly, I imported the MAVLINK library into STM32CUBEIDE and it can be compiled correctly.
And some simple data transmission was carried out, which can be sent normally. For example, switching flight modes.
When I want to perform some more complex operations, I haven’t found the corresponding code examples, and I’m not sure about the specific packaging method.
For example, my STM32 microcontroller is connected to a GPS and a data transmission. I need to have the microcontroller transmit data to the airplane to set the current location as home every minute. (So I can fly while driving. Don’t worry about the plane returning to its original takeoff point)
l = mavlink_msg_command_int_pack(0xff, 0XBE, &msg,1, 0,0, 0, 0,0, 0, 0, 0, 380000000, 111222333 , 156);
l = mavlink_msg_to_send_buffer(sendda,&msg);
HAL_UART_Transmit(&huart2, sendda, l, 100);
This data packet did not change the location of the airplane home, and I do not know the specific data packaging function. Perhaps it is necessary to receive data packets from the aircraft and verify them.
So may I ask if there are any code usage examples