Error when adding servo motor

I added a servo motor to ch5 in AP_Motor_Matrix.cpp.

I think I referred to TriCopter or something like that, and the following code is what I found.

AUXServo = SRV_Channels::get_channel_for(SRV_Channel::k_motor5, -1);
if (!AUXServo) {
gcs().send_text(MAV_SEVERITY_ERROR, “MotorsMatrix: unable to setup AUXServo channel”);
// don’t set initialised_ok
return;
}
add_motor_num(CH_5);

This code does not generate an error at build.
It works fine with CubeBlack, but with Durandal I get a 0x40000020 error code on the HUD after connecting MP.
It means that the parameters cannot be read from the built-in flash.

I confirmed this result with Copter-4.2.1 and 4.1.5.

The workaround is to specify the channel directly in the last parameter of SRV_Channels::get_channel_for as follows

AUXServo = SRV_Channels::get_channel_for(SRV_Channel::k_motor5, 4);

I do not know if this is a Durandal-only phenomenon.

That is all I have to report.

Thank you.

what are you trying to do?

Hi geofrancis-san,

I add servo motors to multicopter.
The rotor rotation surface is tilted and so on.

https://youtu.be/_6mO_9fbohE
https://youtu.be/x70SiNi3QL0

1 Like