// mavlink_motor_test_start - start motor test - spin a single motor at a specified pwm // returns MAV_RESULT_ACCEPTED on success, MAV_RESULT_FAILED on failure uint8_t QuadPlane::mavlink_motor_test_start(mavlink_channel_t chan, uint8_t motor_seq, uint8_t throttle_type, uint16_t throttle_value, float timeout_sec, uint8_t motor_count) { if (motors->armed()) { plane.gcs_send_text(MAV_SEVERITY_INFO, "Must be disarmed for motor test"); return MAV_RESULT_FAILED; } // if test has not started try to start it if (!motor_test.running) { // start test motor_test.running = true; // enable and arm motors set_armed(true); // turn on notify leds AP_Notify::flags.esc_calibration = true; } // set timeout motor_test.start_ms = AP_HAL::millis(); motor_test.timeout_ms = MIN(timeout_sec * 1000, MOTOR_TEST_TIMEOUT_MS_MAX); // store required output motor_test.seq = motor_seq; motor_test.throttle_type = throttle_type; motor_test.throttle_value = throttle_value; motor_test.motor_count = MIN(motor_count, 8); // return success return MAV_RESULT_ACCEPTED; }
void rollcontrol_init(void){ set_armed(false); sd = udp_socket(); if(sd < 0){ return; } if(connect(sd, RC_SERVO_ENABLE_ADDR, sizeof(struct sockaddr_in)) < 0){ perror("rollcontrol_init: connect() failed"); close(sd); } }
// motor_test_stop - stops the motor test void QuadPlane::motor_test_stop() { // exit immediately if the test is not running if (!motor_test.running) { return; } // flag test is complete motor_test.running = false; // disarm motors set_armed(false); // reset timeout motor_test.start_ms = 0; motor_test.timeout_ms = 0; // turn off notify leds AP_Notify::flags.esc_calibration = false; }