Setting home position error

i want to set home position via mavlink but its not working.

i using c# mavlink library

//##### TRY 1 ########
PointLatLng point = new PointLatLng(40.85761, 29.27437);
Msg_command_long m = new Msg_command_long();
m.command = (UInt16)MAV_CMD.MAV_CMD_DO_SET_HOME;
m.param1 = 1.0f;
m.param2 = 0.0f;
m.param3 = 0.0f;
m.param4 = 0.0f;
m.param5 = (int)(point.Lat * 1.0e7);
m.param6 = (int)(point.Lng * 1.0e7);
m.param7 = 10.0f;
m.target_component = 1;
m.target_system = 1;
SendPacket(m);
//##### END TRY 1 ########

//##### TRY 2 ########
PointLatLng point = new PointLatLng(40.85761, 29.27437);
MAVLink.mavlink_set_home_position_t mt = new MAVLink.mavlink_set_home_position_t();
mt.target_system = 1;
mt.q = new float[] { 1, 1, 1, 1 };
mt.latitude = (int)(point.Lat * 1.0e7);
mt.longitude = (int)(point.Lng * 1.0e7);
mt.x = (int)(point.Lat * 1.0e7);
mt.y = (int)(point.Lng * 1.0e7);
mt.z = 10;
mt.altitude = 10;
mt.time_usec = 500;

        byte[] b = mv.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.SET_HOME_POSITION, mt);
        Serial.Write(b, 0, b.Length);

//##### END TRY 2 ########

i try and try but its not work. what is the problem? and get home position not working also.

its fixed, Receiving home location automatically

Hi @enosoft ,

I would be interested to know how you fixed it, if you still remember. I’m almost running the same issue here, having some difficulties to generate and send packets with C# librairy.