For cases like these, where you have several boolean values that are used in evaluating for several situations, I use what I call a boolean state table to represent the desired functionality.
Here's a screenshot from my old
software development guide:
The example this was for had a left and right drive control for inputs 1 and 2, bumper switches on 3 and 4, and an "auto navigation" toggle on input 5.
One way of coding this is to take each row and evaluate it with boolean logic, then bundle the results into a boolean array. With the boolean array you can use the following code:
