ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.99k stars 17.53k forks source link

Impossible to use BLHeli bidir soft mode with master #17559

Open shellixyz opened 3 years ago

shellixyz commented 3 years ago

Bug report

Issue details

It is impossible to use BLHeli's bidir soft mode since RCOutput::set_reversible_mask() switches the ESC to 3D mode overriding the mode set in BLHeli suite if the output is marked as reversible

Version

current master branch

Platform [X] All [ ] AntennaTracker [ ] Copter [ ] Plane [ ] Rover [ ] Submarine

andyp1per commented 3 years ago

Can you expand a little on what you are trying to do and expect to happen?

shellixyz commented 3 years ago

Sure. BLH32 has two "3D" aka reversible modes. 3D and bidir soft. Bidir soft is a less aggressive reversion compared to 3D. It seems like RCOutput::set_reversible_mask() now forces 3D mode when the output is configured as bidirectional with SERVO_BLH_BDMASK no matter what has been configured on the ESC manually so it is not possible to use the soft bidir mode.

https://github.com/ArduPilot/ardupilot/blob/e5a33e8efc3f6b8fe4983577a338f665220e37d4/libraries/AP_HAL_ChibiOS/RCOutput_serial.cpp#L134

    for (uint8_t i=0; i<HAL_PWM_COUNT; i++) {
        if (chanmask & (1U<<i)) {
            switch (_dshot_esc_type) {
                case DSHOT_ESC_BLHELI:
                    send_dshot_command(DSHOT_3D_ON, i, 0, 10, true);
                    break;
                default:
                    break;
            }
        }
    }

Unfortunately it looks like there is only a DSHOT command to enable 3D mode but no command to enable soft bidir instead.

https://github.com/bitdump/BLHeli/blob/75db1a03ca97959dc63ef0dcc68e1fd9f2eff993/BLHeli_32%20ARM/BLHeli_32%20Firmware%20specs/Digital_Cmd_Spec.txt#L11

shellixyz commented 3 years ago

I guess what could be done is add a param to chose whether AP should force 3D mode by itself or leave the current ESC setting

andyp1per commented 3 years ago

Ok so I guess currently you can leave SERVO_DSHOT_ESC = 0 and it will work but then you lose the other dshot command features. I can ask Steffen about adding soft bi-dir. You are right that adding a parameter probably makes sense, or maybe an option bit to 3DMASK.

shellixyz commented 3 years ago

Ok so I guess currently you can leave SERVO_DSHOT_ESC = 0 and it will work but then you lose the other dshot command features.

No DSHOT commands means no bidir with DSHOT at all and also less importantly for me at least no audio notifications and no LED control

andyp1per commented 3 years ago

No DSHOT commands means no bidir with DSHOT at all

I don't understand what you mean here? dshot commands are not required for bi-directional dshot and soft 3D can be set on the ESC?

shellixyz commented 3 years ago

No DSHOT commands means no bidir with DSHOT at all

I don't understand what you mean here? dshot commands are not required for bi-directional dshot and soft 3D can be set on the ESC?

My bad, you are right, DSHOT commands are not needed for bidir/revthrust so yes indeed SERVO_DSHOT_ESC = 0 would fix the issue but then losing the other DSHOT command features