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

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.

1 Like