mavlink / qgroundcontrol

Cross-platform ground control station for drones (Android, iOS, Mac OS, Linux, Windows)
http://qgroundcontrol.io
3.26k stars 3.59k forks source link

Camera IO Fact failed cannot restore UI #8779

Open anxueshen opened 4 years ago

anxueshen commented 4 years ago

Hi developer: I am a new QGC users. And I use one camera(From YUNEEC) compatible with QGC. I found when I click the change camera mode button , for Example from video mode to photo mode. The UI changed to photo mode immediately. But if the camera change mode return failed. The UI is not reset to origin video mode. In the QGCCameraIO.cc

        if(ack.param_result == PARAM_ACK_FAILED) {
            if(++_sentRetries < 3) {
                //-- Try again
                qCWarning(CameraIOLog) << "Param set failed:" << _fact->name() << _sentRetries;
                _paramWriteTimer.start();
            }
            return;
        }
...
//-- If UI changed and value was not set, restore UI

If the camera ack param result is PARAM_ACK_FAILED. The QGC Client will retry to send mavlink message three times. But there is return in the following line and will always execute. So The restore UI function will never called when the ack message is still failed. So in my opinion. I think the right logic is when retry three times all failed then restore the origin UI.

        if(ack.param_result == PARAM_ACK_FAILED) {
            if(++_sentRetries < 3) {
                //-- Try again
                qCWarning(CameraIOLog) << "Param set failed:" << _fact->name() << _sentRetries;
                _paramWriteTimer.start();
               return;    ///< put return here
            }
       }
...
//-- If UI changed and value was not set, restore UI

Does that make sense to you?

Best Regard

DonLakeFlyer commented 4 years ago

Seems like a correct analysis, but Gus will have t verify.