@@ -91,7 +91,7 @@ static void handle_mavlink_command(mavlink_command_long_t* command, mavlink_mess
9191 } break ;
9292
9393 case MAV_CMD_PREFLIGHT_CALIBRATION :
94- if (command -> param1 == 1 ) { // calibration gyr
94+ if (command -> param1 == 1 ) { // calibration gyr
9595 mavproxy_cmd_set (MAVCMD_CALIBRATION_GYR , NULL );
9696 } else if (command -> param2 == 1 ) { // calibration mag
9797 mavproxy_cmd_set (MAVCMD_CALIBRATION_MAG , NULL );
@@ -452,15 +452,18 @@ static fmt_err_t handle_mavlink_message(mavlink_message_t* msg, mavlink_system_t
452452
453453 if (this_system .sysid == manual_control .target && (time_now - rc_last_pub_timestamp ) >= 1000 ) {
454454 GCS_Cmd_Bus gcs_cmd ;
455- mcn_copy_from_hub (MCN_HUB (gcs_cmd ), & gcs_cmd );
456455
457456 Pilot_Cmd_Bus pilot_cmd = { 0 };
458457 pilot_cmd .timestamp = time_now ;
459458 pilot_cmd .stick_throttle = (manual_control .z - 500 ) / 500.0f ;
460459 pilot_cmd .stick_yaw = manual_control .r / 1000.0f ;
461460 pilot_cmd .stick_roll = manual_control .y / 1000.0f ;
462461 pilot_cmd .stick_pitch = manual_control .x / 1000.0f ;
463- pilot_cmd .mode = gcs_cmd .mode ;
462+ if (mcn_copy_from_hub (MCN_HUB (gcs_cmd ), & gcs_cmd ) == FMT_EOK ) {
463+ pilot_cmd .mode = gcs_cmd .mode ;
464+ } else {
465+ pilot_cmd .mode = PilotMode_None ;
466+ }
464467
465468 /* publish virtual joystick data */
466469 mcn_publish (MCN_HUB (pilot_cmd ), & pilot_cmd );
0 commit comments