Skip to content

Commit

Permalink
SITL: correct parsing of joystick buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Jan 31, 2024
1 parent 03da814 commit 99bff2f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libraries/SITL/SIM_XPlane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ bool XPlane::handle_axis(const char *label, class ::AP_JSONParser &json_parser)
return false;
}

::printf("axis: axis=%u type=%u channel=%u input_min=%f input_max=%f\n",
j->axis, (unsigned)j->type, j->channel, j->input_min, j->input_max);

j->next = joyinputs;
joyinputs = j;

Expand Down Expand Up @@ -217,7 +220,7 @@ bool XPlane::handle_button(const char *label, class ::AP_JSONParser &json_parser
if (!json_parser.shift_token_int32_t(value)) {
return false;
}
j->channel = value;
j->mask = value;
continue;
}
if (streq(n, "type")) {
Expand All @@ -231,6 +234,9 @@ bool XPlane::handle_button(const char *label, class ::AP_JSONParser &json_parser
return false;
}

::printf("button: axis=%u type=%u channel=%u input_min=%f input_max=%f\n",
j->axis, (unsigned)j->type, j->channel, j->input_min, j->input_max);

j->next = joyinputs;
joyinputs = j;

Expand Down Expand Up @@ -328,7 +334,7 @@ bool XPlane::handle_dref(const char *name, class ::AP_JSONParser &json_parser)
}
}

::printf("%s t=%s range=%f fv=%f channel=%u\n", d->name, type_s, d->range, d->fixed_value, (unsigned)d->channel);
::printf("DREF: %s t=%s range=%f fv=%f channel=%u\n", d->name, type_s, d->range, d->fixed_value, (unsigned)d->channel);

// add to linked list
d->next = drefs;
Expand Down

0 comments on commit 99bff2f

Please sign in to comment.