betaflight / betaflight-tx-lua-scripts

Collection of scripts to configure Betaflight from your TX (currently only supported in OpenTx)
GNU General Public License v3.0
592 stars 143 forks source link

bfpids.lua clarity #449

Closed JimJJewett closed 1 year ago

JimJJewett commented 1 year ago

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
klutvott123 commented 1 year ago

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

github-actions[bot] commented 1 year ago

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.

github-actions[bot] commented 1 year ago

Issue closed automatically as inactive.