Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reading joystick buttons executables without including all #791

Merged
merged 1 commit into from
May 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 8 additions & 34 deletions src/tools/joystickCtrl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,63 +337,37 @@ class CtrlThread: public PeriodicThread

//get the list of the commands to be executed with the buttons
Bottle& exec_comm_bottle = rf.findGroup("BUTTONS_EXECUTE");
int joystick_actions_count = 0;
if (!exec_comm_bottle.isNull())
{
yInfo ( "associating the following actions to the buttons: \n");
do
{
for (int iii = 0; iii < 20; iii++){
char tmp[80];
sprintf(tmp, "button%d", joystick_actions_count);
sprintf(tmp, "button%d", iii);
if (exec_comm_bottle.check(tmp))
{
button_actions[joystick_actions_count] = exec_comm_bottle.find(tmp).toString();
printf ("%s %s\n", tmp, button_actions[joystick_actions_count].c_str());
}
else
{
break;
button_actions[iii] = exec_comm_bottle.find(tmp).toString();
printf ("%s %s\n", tmp, button_actions[iii].c_str());
}
joystick_actions_count++;
}
while (joystick_actions_count<20);
printf ("\n");
}
if (joystick_actions_count==0)
{
yInfo ( "no actions specified for the joystick buttons. \n");
}


//get the list of the commands to be executed with the hats
Bottle& hats_exec_bottle = rf.findGroup("HATS_EXECUTE");
int hats_actions_count = 0;
if (!hats_exec_bottle.isNull())
{
yInfo ( "associating the following actions to the hats: \n");
do
{
for (int iii = 0; iii < 20; iii++){
char tmp[80];
sprintf(tmp, "hat%d", hats_actions_count);
sprintf(tmp, "hat%d", iii);
if (hats_exec_bottle.check(tmp))
{
hat_actions[hats_actions_count] = hats_exec_bottle.find(tmp).toString();
printf ("%s %s\n", tmp, hat_actions[hats_actions_count].c_str());
}
else
{
break;
hat_actions[iii] = hats_exec_bottle.find(tmp).toString();
printf ("%s %s\n", tmp, hat_actions[iii].c_str());
}
hats_actions_count++;
}
while (hats_actions_count<20);
printf ("\n");
}
if (joystick_actions_count==0)
{
yInfo ( "no actions specified for the joystick hats. \n");
}


// start SDL subsystem
//SDL_Init(SDL_INIT_VIDEO);
Expand Down