Lua script written for Parameter change

Hi,

I need a Lua script written to modify the MOT_BOOST with voltage. I want to increase or decrease it by .1 by checking voltage every 30 seconds and adjusting it based on a voltage range either increase by .1 or decrease by .1.

Can anyone write this for me?

Jeff

First of all I think you should see if that param needs a reboot to take new value.

No it doesn’t, we change this all the time when we are flying. It would just save the manual entry every so often!

You will need 4.1, and to put in the correct equation for voltage to MOT_BOOST_SCALE.

local boost = Parameter()
boost:init('MOT_BOOST_SCALE')

function update()

local voltage = battery:voltage(0)
boost:set( voltage * 1 + 1)

return update, 30000

end

return update

I have not tested in any way.

Hi Peter!

This is a great start! Thank you so much!!!

Will this work with a voltage range?

For example if voltage is higher than 49.5 reduce mot boost by 0.10? And if voltage is lower than 48.5v then raise mot boost by 0.10?

And if it is ok, as in the voltage is Inbetween then the parameter won’t be changed etc?

Jeff