betaflight/betaflight-tx-lua-scripts

bfpids.lua clarity

JimJJewett opened this issue · 3 comments

It may just be my unfamiliarity with lua, but it looks like local function run_pids() in

https://github.com/betaflight/betaflight-tx-lua-scripts/blob/master/src/SCRIPTS/FUNCTIONS/bfpids.lua

has some gaps in the pidSelector range. It isn't clear what happens if pidSelector is exactly 99 or 165.
Similar question for pidSelector >= 231, pidSelector <= -99, or -33<= pidSelector <= 33. This might have caused one of the open issues about seizing up.

if pidSelector > 33 and pidSelector < 99 then
    readoutMsp(MSP_PID_FORMAT, msg_p)
elseif pidSelector > 99 and pidSelector < 165 then
    readoutMsp(MSP_PID_FORMAT, msg_i)
elseif pidSelector > 165 and pidSelector < 231 then
    readoutMsp(MSP_PID_FORMAT, msg_d)
elseif pidSelector > -99 and pidSelector < -33 then
    readoutMsp(MSP_PID_ADVANCED_FORMAT, msg_dsetpt)
end

I don't think it really matters here. Please link to the issue you're referring to 🙂

This code doesn't run unless setup by the user to run as a function script. It also haven't been maintained for a long time

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within a week.

Issue closed automatically as inactive.