A few lines up you convert from 2 to bool and then here back - I think this shows that either the int should be passed, or the mavlink output be done externally. This creates a lot of magic numbers.