def cmd_magcal(self, args):
        '''control magnetometer calibration'''
        if len(args) < 1:
            print("Usage: magcal <start|accept|cancel>")
            return

        if args[0] == 'start':
            self.master.mav.command_long_send(
                self.settings.target_system,  # target_system
                0, # target_component
                mavutil.mavlink.MAV_CMD_DO_START_MAG_CAL, # command
                0, # confirmation
                0, # p1: mag_mask
                0, # p2: retry
                1, # p3: autosave
                0, # p4: delay
                0, # param5
                0, # param6
                0) # param7
        elif args[0] == 'accept':
            self.master.mav.command_long_send(
                self.settings.target_system,  # target_system
                0, # target_component
                mavutil.mavlink.MAV_CMD_DO_ACCEPT_MAG_CAL, # command
                0, # confirmation
                0, # p1: mag_mask
                0, # param2
                1, # param3
                0, # param4
                0, # param5
                0, # param6
                0) # param7
        elif args[0] == 'cancel':
            self.master.mav.command_long_send(
                self.settings.target_system,  # target_system
                0, # target_component
                mavutil.mavlink.MAV_CMD_DO_CANCEL_MAG_CAL, # command
                0, # confirmation
                0, # p1: mag_mask
                0, # param2
                1, # param3
                0, # param4
                0, # param5
                0, # param6
                0)
control magnetometer calibration