Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Servo output based on arming state. (like servo 30 function) #26492

Open
VinceHogg opened this issue Mar 12, 2024 · 3 comments
Open

Servo output based on arming state. (like servo 30 function) #26492

VinceHogg opened this issue Mar 12, 2024 · 3 comments

Comments

@VinceHogg
Copy link

Servo function 30 is described as 'engine run enable' or 'motor enable' and is supposed to output 2 PWM values depending on arming state. It would also be useful for turning on or off equipment before flight. However in copter 4.4.4 it seems to do nothing. Perhaps it works when ICE_ENABLE=1 ? This parameter in not in copter.
Could it be enabled for all vehicles as a general propose feature?

Thanks.

@IamPete1
Copy link
Member

Run enable is a helicopter feature.

It would be a quite simple lua script to do as you describe. Something like:

-- use scripting 1 servo output
local SRV_function = 94

-- set scaled range as 0 to 1
SRV_Channels:set_range(SRV_function, 1.0)

function update()
  if arming:is_armed() then
    SRV_Channels:set_output_scaled(SRV_function, 1.0)
  else
    SRV_Channels:set_output_scaled(SRV_function, 0.0)
  end

  return update, 100 -- run at 10 Hz
end

return update() 

@VinceHogg
Copy link
Author

Thanks for that. It may be simple but its been 20 years since I did any programming. I should get my self more familiar with it.
It may be a good idea to open that servo 30 feature for all vehicles and perhaps rename. It could still be used for the original purpose.

@peterbarker
Copy link
Contributor

Thanks for that. It may be simple but its been 20 years since I did any programming. I should get my self more familiar with it. It may be a good idea to open that servo 30 feature for all vehicles and perhaps rename. It could still be used for the original purpose.

I don't think re-purposing 30 is a good idea; it might be that the user wants to remain armed while also killing the motor. For example, we have an option to turn on the safety switch when you disarm - a user might want their ailerons to continue to function even when they've chosen to kill the motor in-flight.

@VinceHogg is @IamPete1 's script enough to get you by?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants