weixin_39869733
weixin_39869733
2020-11-29 18:36

AutoConnect for UDP links

This PR allows to set autoconnect for selected UDP link that helps if you use QGC for outgoing connection. Button indicator shows status of autoconnect configuration.

该提问来源于开源项目:mavlink/qgroundcontrol

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

13条回答

  • weixin_39869733 weixin_39869733 5月前

    Something like that? screenshot from 2016-12-05 17-52-47 When I said about existing "Default UDP Link" I meant that if one pushed “Disconnect”, it created a new copy of link and therefore a new button. It seems unnecessary or at least counterintuitive, because it creates a pile: screenshot from 2016-12-05 17-43-33 My PR takes another approach: instead of creating a new copy it simply reconnect to existing one (if autoconnect button is on).

    点赞 评论 复制链接分享
  • weixin_39954908 weixin_39954908 5月前

    Ok. you're running into bugs in QGC.

    Is there any reason to show autoconnect links here? Seems like they just confuse everyone. And then if people try to disconnect them, strange things happen. I think we should hide autoconnect links.

    Now back to this pull: * I think this should be called something other than "Autoconnect" since that term is already used for a different QGC feature. * I think it should be something like "Connect at QGC start" * I think the setting should be inside the Edit panel, not on the main panel. * If you disconnect a "Connect at QGC start" setting it does not reconnect immediately. It just disconnects and stays disconnected. This allows you to edit the settings again and adjust "Connect at start". * It should only be supported by UDP links.

    点赞 评论 复制链接分享
  • weixin_39619451 weixin_39619451 5月前

    Is there any reason to show autoconnect links here?

    Not that I can think of. The list was there before auto connect was in place. I guess the issue never came up. On the other hand, the example above shows that some times it can be useful :)

    点赞 评论 复制链接分享
  • weixin_39954908 weixin_39954908 5月前

    On the other hand, the example above shows that some times it can be useful :)

    Huh, how?

    点赞 评论 复制链接分享
  • weixin_39619451 weixin_39619451 5月前

    I was being sarcastic. The multiple buttons exacerbated the issue above.

    点赞 评论 复制链接分享
  • weixin_39954908 weixin_39954908 5月前

    Ah, ok. Do you think my proposal for the pull above makes sense?

    I'm also going to clean up the comm links pages to make it more clear what you can/can't do and why.

    点赞 评论 复制链接分享
  • weixin_39869733 weixin_39869733 5月前

    It seems to me that reconnection comes in handy in a scenario when one disconnects in QGC and reboots a vehicle. Otherwise you will have to constantly press the “Connect” button if you select “Connect at QGC start” beforehand. I do not find the latter convenient, either. So, for example it’s not necessary to make an option for serial connections in Comm Links, because it already always tries to connect. If you want I may create another indicator button.

    点赞 评论 复制链接分享
  • weixin_39954908 weixin_39954908 5月前

    Thanks. A useful change. But there are problems: * You should set autoconnect when you add/edit the config using a checkbox. It shouldn't be on the outside on the link list with the add/edit buttons. * Although autoconnect links are picked up dynamically if the user turns them on. They are not disconnected dynamically if the user turns them off. They should disconnect the socket if there is no vehicle and the user has disconnected the vehicle from it. * Autoconnect should only be allowed for UDP links since other link types will need more sophisticated code to check whether the port exists before it tries to connect. Otherwise it will through continuous errors when the device is not connected.

    点赞 评论 复制链接分享
  • weixin_39954908 weixin_39954908 5月前

    Thinking about this a little more. Can't you edit the default autoconnect udp link? If so, can't you just add target hosts to the default udp link and then this all works for free?

    点赞 评论 复制链接分享
  • weixin_39619451 weixin_39619451 5月前

    The only reason the active connection is disabled from editing is to avoid changing something that would disrupt the connection. There is no real technical reason other than preventing users from getting in trouble. For instance, if you were to change the connecting port in the middle of a connection, all hell would break loose.

    If you know what you are doing though, it's perfectly safe to edit it.

    点赞 评论 复制链接分享
  • weixin_39954908 weixin_39954908 5月前

    Ok, then I think we go with this PR with fixes.

    点赞 评论 复制链接分享
  • weixin_39869733 weixin_39869733 5月前

    Hello. - If set autoconnect in add/edit config then you can't change its state, because you can't edit connected links. - It will work as existing "UDPAutoconnect", but it reconnects a link instead of creating a new copy. - Yeah, button for "autoconnect" enabled only for UDP links.

    点赞 评论 复制链接分享
  • weixin_39954908 weixin_39954908 5月前

    If set autoconnect in add/edit config then you can't change its state, because you can't edit connected links.

    Hmm. That is an issue :) I would change the control to a checkbox then. IndicatorButton tends to only be used to setup buttons on the setup view.

    It will work as existing "UDPAutoconnect", but it reconnects a link instead of creating a new copy.

    Not sure what you mean here?

    点赞 评论 复制链接分享

相关推荐