px4io fix code style

This commit is contained in:
Daniel Agar
2019-08-19 15:11:39 -04:00
parent 310fd80405
commit 737f5d4e3d
2 changed files with 8 additions and 7 deletions
+4 -4
View File
@@ -1304,11 +1304,11 @@ PX4IO::io_set_control_state(unsigned group)
for (unsigned i = 0; i < _max_controls; i++) {
/* ensure FLOAT_TO_REG does not produce an integer overflow */
const float ctrl = math::constrain(controls.control[i], -1.0f, 1.0f);
if(!isfinite(ctrl)){
if (!isfinite(ctrl)) {
regs[i] = INT16_MAX;
}
else
{
} else {
regs[i] = FLOAT_TO_REG(ctrl);
}
+4 -3
View File
@@ -412,13 +412,14 @@ mixer_callback(uintptr_t handle,
switch (source) {
case MIX_FMU:
if (control_index < PX4IO_CONTROL_CHANNELS && control_group < PX4IO_CONTROL_GROUPS) {
if(r_page_controls[CONTROL_PAGE_INDEX(control_group, control_index)] == INT16_MAX){
if (r_page_controls[CONTROL_PAGE_INDEX(control_group, control_index)] == INT16_MAX) {
//catch NAN values encoded as INT16 max for disarmed outputs
control = NAN;
}
else{
} else {
control = REG_TO_FLOAT(r_page_controls[CONTROL_PAGE_INDEX(control_group, control_index)]);
}
break;
}