Skip to content

Conversation

punkkills
Copy link

Hey, first off, forgive me if I am not doing this correctly. While I'm a software engineer, I don't have any experience with git or it's workflow :D.

This code lets you disable pit mode with a switch through telemetry. It has some safety features built in. It also does not require that the telemetry screen is visible.

You need to assign the pm_arm and pm_d-arm functions to different positions of a switch. In order for pit mode to be deactivated, (armed) the function pm_d-arm first has to run, followed by pm_arm. This allows some safety such that you can't just power up your quad with the video arming switch enabled and start transmitting, you must first first hit the disarmed state.

Next, I added a background task and refactored the telemetry communication stuff to that so the switch can be used with the telemetry screen closed.

@ronerone
Copy link

@punkkills Hi!
This is a great improvement that i would have requested.
It will help some pilots during preflight steps in races, but moreover, it will help begginers as i am save their tramp from overheating before flying.
Thank you for that, i'm looking forward to getting it in new release.

Ronan.

Usage: - Apply pm_amr and pm_d-arm as custom functions (bind them to a swich or logical variable) - The VTX telemetry screen must be open - If the quad is in pit mode, activate pm_arm . You must have previously activated pm_d-arm to prevent disabling pit mode by accident (such as leaving the stick in the armed position) - The VTX screen will be saved with pit mode disabled Fixing arm and disarm scripts Added support for background processing Background processing allows the pit mode switch to be used even when the telemetry page is not open Updated x7 and horus with background scripts Don't wait for timeout when changing vtx channels Before this change, the 3 second timeout would be hit before vtx changes were read
@raphaelcoeffic
Copy link
Member

@punkkills Thx a lot! That opens quite some use-cases! However, as I wrote you, I see that more as a work-around for now, as BF is going to have support for switches for these kind of changes rather soon. So I'd prefer leave this one as a PR for now. Please tell me your thoughts.

@mikeller
Copy link
Member

mikeller commented Mar 6, 2017

@raphaelcoeffic: I think support for switches might be some way out yet, since there is some work needed on the code that handles switches, because we're just about to max out on the number of switches that the current code can handle.
Also, in practical terms, I think the usefulness of switches is far more limited than the usefulness of MSP over SmartPort. After all, switches tie up the limited resource of channels, so a lot of users will probably have to remove another switch to free up a channel in order to fit in a new switch.

@punkkills
Copy link
Author

@raphaelcoeffic I'll leave it up to you. As @mikeller mentioned, I was interested in the prospect of not needing another channel in BF (depending on if it was implemented as a mode or an adjustment). In my opinion (biased :D) it adds a lot of value right now and maybe into the future if the BF feature is a ways off. If you aren't interested in pulling it, I would probably put it out there for people to use but wouldn't be excited about diverging from what you have put together.

@raphaelcoeffic
Copy link
Member

@mikeller so what you're saying is that it will take longer that I think, and at the end, it might not be as useful as I think it could?

@mikeller
Copy link
Member

mikeller commented Mar 7, 2017

@raphaelcoeffic At the moment there is only space for one more switch in the 32 bit set that is used for switches, so adding the pit mode switch will be possible quickly, but that's it. As to usefulness, I think seen on its own it will be very useful, but since the number of switches that can be reasonably used is limited by the number of RX channels, using it through MSP is going to be more useful for users that do not have any more unused RX channels available.

@raphaelcoeffic
Copy link
Member

@punkkills just a quick question: are you using a SmartAudio VTX? I'm just wondering because there is no way to power up the Tramp in pit-mode for now. If this is the case, do you set your TBS unify into race-mode by pressing the button while powering up? (at least the first time)

@punkkills
Copy link
Author

punkkills commented Mar 7, 2017

Yes, I'm using a Unify Race. I didn't realize the tramp couldn't be powered up in pit mode. On the Unify, you put it into pit mode by pressing the button on power up like you say. When you disable pit mode with the switch, it is temporary and will boot in pit mode on next power cycle. You have to power up with the button again to make it transmit on startup.

mikeller pushed a commit that referenced this pull request Nov 11, 2017
Creating enumerations and intuitive naming conventions to self-document the code
@mikeller
Copy link
Member

This repository has been rebased on the more advanced https://github.com/codecae/betaflight-tx-lua-revised. Please update your pull request if it is still relevant, or close it otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment