Skip to content

Commit

Permalink
Merge pull request eu07#23 from marcinn/feature/add-missing-enable-di…
Browse files Browse the repository at this point in the history
…sable-commands

Add useful enable and disable commands
  • Loading branch information
Milek7 authored Sep 30, 2022
2 parents 08427d0 + 3bd90ec commit ccf537e
Show file tree
Hide file tree
Showing 7 changed files with 481 additions and 55 deletions.
393 changes: 340 additions & 53 deletions Train.cpp

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions Train.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ class TTrain {
static void OnCommand_manualbrakeincrease( TTrain *Train, command_data const &Command );
static void OnCommand_manualbrakedecrease( TTrain *Train, command_data const &Command );
static void OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Command );
static void OnCommand_alarmchainenable(TTrain *Train, command_data const &Command);
static void OnCommand_alarmchaindisable(TTrain *Train, command_data const &Command);
static void OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command );
static void OnCommand_sandboxactivate( TTrain *Train, command_data const &Command );
static void OnCommand_autosandboxtoggle(TTrain *Train, command_data const &Command);
Expand Down Expand Up @@ -386,10 +388,20 @@ class TTrain {
static void OnCommand_redmarkerenableright( TTrain *Train, command_data const &Command );
static void OnCommand_redmarkerdisableright( TTrain *Train, command_data const &Command );
static void OnCommand_headlighttogglerearleft( TTrain *Train, command_data const &Command );
static void OnCommand_headlightenablerearleft( TTrain *Train, command_data const &Command );
static void OnCommand_headlightdisablerearleft( TTrain *Train, command_data const &Command );
static void OnCommand_headlighttogglerearright( TTrain *Train, command_data const &Command );
static void OnCommand_headlightenablerearright( TTrain *Train, command_data const &Command );
static void OnCommand_headlightdisablerearright( TTrain *Train, command_data const &Command );
static void OnCommand_headlighttogglerearupper( TTrain *Train, command_data const &Command );
static void OnCommand_headlightenablerearupper( TTrain *Train, command_data const &Command );
static void OnCommand_headlightdisablerearupper( TTrain *Train, command_data const &Command );
static void OnCommand_redmarkertogglerearleft( TTrain *Train, command_data const &Command );
static void OnCommand_redmarkerenablerearleft( TTrain *Train, command_data const &Command );
static void OnCommand_redmarkerdisablerearleft( TTrain *Train, command_data const &Command );
static void OnCommand_redmarkertogglerearright( TTrain *Train, command_data const &Command );
static void OnCommand_redmarkerenablerearright( TTrain *Train, command_data const &Command );
static void OnCommand_redmarkerdisablerearright( TTrain *Train, command_data const &Command );
static void OnCommand_redmarkerstoggle( TTrain *Train, command_data const &Command );
static void OnCommand_endsignalstoggle( TTrain *Train, command_data const &Command );
static void OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &Command );
Expand All @@ -408,7 +420,11 @@ class TTrain {
static void OnCommand_instrumentlightenable( TTrain *Train, command_data const &Command );
static void OnCommand_instrumentlightdisable( TTrain *Train, command_data const &Command );
static void OnCommand_dashboardlighttoggle( TTrain *Train, command_data const &Command );
static void OnCommand_dashboardlightenable( TTrain *Train, command_data const &Command );
static void OnCommand_dashboardlightdisable( TTrain *Train, command_data const &Command );
static void OnCommand_timetablelighttoggle( TTrain *Train, command_data const &Command );
static void OnCommand_timetablelightenable( TTrain *Train, command_data const &Command );
static void OnCommand_timetablelightdisable( TTrain *Train, command_data const &Command );
static void OnCommand_doorlocktoggle( TTrain *Train, command_data const &Command );
static void OnCommand_doortoggleleft( TTrain *Train, command_data const &Command );
static void OnCommand_doortoggleright( TTrain *Train, command_data const &Command );
Expand Down Expand Up @@ -436,9 +452,13 @@ class TTrain {
static void OnCommand_hornhighactivate( TTrain *Train, command_data const &Command );
static void OnCommand_whistleactivate( TTrain *Train, command_data const &Command );
static void OnCommand_radiotoggle( TTrain *Train, command_data const &Command );
static void OnCommand_radioenable( TTrain *Train, command_data const &Command );
static void OnCommand_radiodisable( TTrain *Train, command_data const &Command );
static void OnCommand_radiochannelincrease( TTrain *Train, command_data const &Command );
static void OnCommand_radiochanneldecrease( TTrain *Train, command_data const &Command );
static void OnCommand_radiostopsend( TTrain *Train, command_data const &Command );
static void OnCommand_radiostopenable( TTrain *Train, command_data const &Command );
static void OnCommand_radiostopdisable( TTrain *Train, command_data const &Command );
static void OnCommand_radiostoptest( TTrain *Train, command_data const &Command );
static void OnCommand_radiocall3send( TTrain *Train, command_data const &Command );
static void OnCommand_radiovolumeincrease(TTrain *Train, command_data const &Command);
Expand Down
20 changes: 20 additions & 0 deletions command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ commanddescription_sequence Commands_descriptions = {
{ "manualbrakeincrease", command_target::vehicle, command_mode::oneoff },
{ "manualbrakedecrease", command_target::vehicle, command_mode::oneoff },
{ "alarmchaintoggle", command_target::vehicle, command_mode::oneoff },
{ "alarmchainenable", command_target::vehicle, command_mode::oneoff},
{ "alarmchaindisable", command_target::vehicle, command_mode::oneoff},
{ "wheelspinbrakeactivate", command_target::vehicle, command_mode::oneoff },
{ "sandboxactivate", command_target::vehicle, command_mode::oneoff },
{ "autosandboxtoggle", command_target::vehicle, command_mode::oneoff },
Expand Down Expand Up @@ -134,9 +136,13 @@ commanddescription_sequence Commands_descriptions = {
{ "hornhighactivate", command_target::vehicle, command_mode::oneoff },
{ "whistleactivate", command_target::vehicle, command_mode::oneoff },
{ "radiotoggle", command_target::vehicle, command_mode::oneoff },
{ "radioenable", command_target::vehicle, command_mode::oneoff },
{ "radiodisable", command_target::vehicle, command_mode::oneoff },
{ "radiochannelincrease", command_target::vehicle, command_mode::oneoff },
{ "radiochanneldecrease", command_target::vehicle, command_mode::oneoff },
{ "radiostopsend", command_target::vehicle, command_mode::oneoff },
{ "radiostopenable", command_target::vehicle, command_mode::oneoff },
{ "radiostopdisable", command_target::vehicle, command_mode::oneoff },
{ "radiostoptest", command_target::vehicle, command_mode::oneoff },
{ "radiocall3send", command_target::vehicle, command_mode::oneoff },
{ "radiovolumeincrease", command_target::vehicle, command_mode::oneoff },
Expand Down Expand Up @@ -216,10 +222,20 @@ commanddescription_sequence Commands_descriptions = {
{ "redmarkerenableright", command_target::vehicle, command_mode::oneoff },
{ "redmarkerdisableright", command_target::vehicle, command_mode::oneoff },
{ "headlighttogglerearleft", command_target::vehicle, command_mode::oneoff },
{ "headlightenablerearleft", command_target::vehicle, command_mode::oneoff },
{ "headlightdisablerearleft", command_target::vehicle, command_mode::oneoff },
{ "headlighttogglerearright", command_target::vehicle, command_mode::oneoff },
{ "headlightenablerearright", command_target::vehicle, command_mode::oneoff },
{ "headlightdisablerearright", command_target::vehicle, command_mode::oneoff },
{ "headlighttogglerearupper", command_target::vehicle, command_mode::oneoff },
{ "headlightenablerearupper", command_target::vehicle, command_mode::oneoff },
{ "headlightdisablerearupper", command_target::vehicle, command_mode::oneoff },
{ "redmarkertogglerearleft", command_target::vehicle, command_mode::oneoff },
{ "redmarkerenablerearleft", command_target::vehicle, command_mode::oneoff },
{ "redmarkerdisablerearleft", command_target::vehicle, command_mode::oneoff },
{ "redmarkertogglerearright", command_target::vehicle, command_mode::oneoff },
{ "redmarkerenablerearright", command_target::vehicle, command_mode::oneoff },
{ "redmarkerdisablerearright", command_target::vehicle, command_mode::oneoff },
{ "redmarkerstoggle", command_target::vehicle, command_mode::oneoff },
{ "endsignalstoggle", command_target::vehicle, command_mode::oneoff },
{ "headlightsdimtoggle", command_target::vehicle, command_mode::oneoff },
Expand All @@ -241,7 +257,11 @@ commanddescription_sequence Commands_descriptions = {
{ "instrumentlightenable", command_target::vehicle, command_mode::oneoff },
{ "instrumentlightdisable", command_target::vehicle, command_mode::oneoff },
{ "dashboardlighttoggle", command_target::vehicle, command_mode::oneoff },
{ "dashboardlightenable", command_target::vehicle, command_mode::oneoff },
{ "dashboardlightdisable", command_target::vehicle, command_mode::oneoff },
{ "timetablelighttoggle", command_target::vehicle, command_mode::oneoff },
{ "timetablelightenable", command_target::vehicle, command_mode::oneoff },
{ "timetablelightdisable", command_target::vehicle, command_mode::oneoff },
{ "generictoggle0", command_target::vehicle, command_mode::oneoff },
{ "generictoggle1", command_target::vehicle, command_mode::oneoff },
{ "generictoggle2", command_target::vehicle, command_mode::oneoff },
Expand Down
20 changes: 20 additions & 0 deletions command.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ enum class user_command {
manualbrakeincrease,
manualbrakedecrease,
alarmchaintoggle,
alarmchainenable,
alarmchaindisable,
wheelspinbrakeactivate,
sandboxactivate,
autosandboxtoggle,
Expand Down Expand Up @@ -127,9 +129,13 @@ enum class user_command {
hornhighactivate,
whistleactivate,
radiotoggle,
radioenable,
radiodisable,
radiochannelincrease,
radiochanneldecrease,
radiostopsend,
radiostopenable,
radiostopdisable,
radiostoptest,
radiocall3send,
radiovolumeincrease,
Expand Down Expand Up @@ -211,10 +217,20 @@ enum class user_command {
redmarkerenableright,
redmarkerdisableright,
headlighttogglerearleft,
headlightenablerearleft,
headlightdisablerearleft,
headlighttogglerearright,
headlightenablerearright,
headlightdisablerearright,
headlighttogglerearupper,
headlightenablerearupper,
headlightdisablerearupper,
redmarkertogglerearleft,
redmarkerenablerearleft,
redmarkerdisablerearleft,
redmarkertogglerearright,
redmarkerenablerearright,
redmarkerdisablerearright,
redmarkerstoggle,
endsignalstoggle,
headlightsdimtoggle,
Expand All @@ -236,7 +252,11 @@ enum class user_command {
instrumentlightenable,
instrumentlightdisable,
dashboardlighttoggle,
dashboardlightenable,
dashboardlightdisable,
timetablelighttoggle,
timetablelightenable,
timetablelightdisable,
generictoggle0,
generictoggle1,
generictoggle2,
Expand Down
20 changes: 20 additions & 0 deletions driverkeyboardinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ driverkeyboard_input::default_bindings() {
{ user_command::manualbrakeincrease, GLFW_KEY_KP_1 | keymodifier::control },
{ user_command::manualbrakedecrease, GLFW_KEY_KP_7 | keymodifier::control },
{ user_command::alarmchaintoggle, GLFW_KEY_B | keymodifier::shift | keymodifier::control },
// alarmchainenable,
// alarmchaindisable,
{ user_command::wheelspinbrakeactivate, GLFW_KEY_KP_ENTER },
{ user_command::sandboxactivate, GLFW_KEY_S | keymodifier::shift },
// autosandboxtoggle,
Expand Down Expand Up @@ -135,9 +137,13 @@ driverkeyboard_input::default_bindings() {
{ user_command::hornhighactivate, GLFW_KEY_S },
{ user_command::whistleactivate, GLFW_KEY_Z },
{ user_command::radiotoggle, GLFW_KEY_R | keymodifier::control },
// radioenable
// radiodisable
{ user_command::radiochannelincrease, GLFW_KEY_EQUAL },
{ user_command::radiochanneldecrease, GLFW_KEY_MINUS },
{ user_command::radiostopsend, GLFW_KEY_PAUSE | keymodifier::shift | keymodifier::control },
// radiostopenable
// radiostopdisable
{ user_command::radiostoptest, GLFW_KEY_R | keymodifier::shift | keymodifier::control },
{ user_command::radiocall3send, GLFW_KEY_BACKSPACE },
// radiovolumeincrease,
Expand Down Expand Up @@ -216,10 +222,20 @@ driverkeyboard_input::default_bindings() {
// redmarkerenableright,
// redmarkerdisableright,
{ user_command::headlighttogglerearleft, GLFW_KEY_Y | keymodifier::control },
// headlightenablerearleft
// headlightdisablerearleft
{ user_command::headlighttogglerearright, GLFW_KEY_I | keymodifier::control },
// headlightenablerearright
// headlightdisablerearright
{ user_command::headlighttogglerearupper, GLFW_KEY_U | keymodifier::control },
// headlightenablerearupper
// headlightdisablerearupper
{ user_command::redmarkertogglerearleft, GLFW_KEY_Y | keymodifier::control | keymodifier::shift },
// redmarkerenablerearleft
// redmarkerdisablerearleft
{ user_command::redmarkertogglerearright, GLFW_KEY_I | keymodifier::control | keymodifier::shift },
// redmarkerenablerearright
// redmarkerdisablerearright
{ user_command::redmarkerstoggle, GLFW_KEY_E | keymodifier::shift },
{ user_command::endsignalstoggle, GLFW_KEY_E },
{ user_command::headlightsdimtoggle, GLFW_KEY_L | keymodifier::control },
Expand All @@ -241,7 +257,11 @@ driverkeyboard_input::default_bindings() {
// instrumentlightenable,
// instrumentlightdisable,
{ user_command::dashboardlighttoggle, GLFW_KEY_SEMICOLON | keymodifier::shift },
// dashboardlightenable
// dashboardlightdisable
{ user_command::timetablelighttoggle, GLFW_KEY_APOSTROPHE | keymodifier::shift },
// timetablelightenable
// timetablelightdisable
{ user_command::generictoggle0, GLFW_KEY_0 },
{ user_command::generictoggle1, GLFW_KEY_1 },
{ user_command::generictoggle2, GLFW_KEY_2 },
Expand Down
32 changes: 31 additions & 1 deletion drivermouseinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ mouse_slider::bind( user_command const &Command ) {
auto const brakerangemultiplier { powerrange / LocalBrakePosNo };

m_valuerange = 1.0;
m_value =
m_value =
0.5
+ 0.5 * ( vehicle->CoupledCtrl ?
vehicle->MainCtrlPos + vehicle->ScndCtrlPos :
Expand Down Expand Up @@ -550,6 +550,12 @@ drivermouse_input::default_bindings() {
{ "alarmchain:", {
user_command::alarmchaintoggle,
user_command::none } },
{ "alarmchainon:", {
user_command::alarmchainenable,
user_command::none} },
{ "alarmchainoff:", {
user_command::alarmchainenable,
user_command::none} },
{ "brakeprofile_sw:", {
user_command::brakeactingspeedincrease,
user_command::brakeactingspeeddecrease } },
Expand Down Expand Up @@ -770,6 +776,12 @@ drivermouse_input::default_bindings() {
{ "radio_sw:", {
user_command::radiotoggle,
user_command::none } },
{ "radioon_sw:", {
user_command::radioenable,
user_command::none } },
{ "radiooff_sw:", {
user_command::radiodisable,
user_command::none } },
{ "radiochannel_sw:", {
user_command::radiochannelincrease,
user_command::radiochanneldecrease } },
Expand All @@ -782,6 +794,12 @@ drivermouse_input::default_bindings() {
{ "radiostop_sw:", {
user_command::radiostopsend,
user_command::none } },
{ "radiostopon_sw:", {
user_command::radiostopenable,
user_command::none } },
{ "radiostopoff_sw:", {
user_command::radiostopdisable,
user_command::none } },
{ "radiotest_sw:", {
user_command::radiostoptest,
user_command::none } },
Expand Down Expand Up @@ -851,9 +869,21 @@ drivermouse_input::default_bindings() {
{ "dashboardlight_sw:", {
user_command::dashboardlighttoggle,
user_command::none } },
{ "dashboardlighton_sw:", {
user_command::dashboardlightenable,
user_command::none } },
{ "dashboardlightoff_sw:", {
user_command::dashboardlightdisable,
user_command::none } },
{ "timetablelight_sw:", {
user_command::timetablelighttoggle,
user_command::none } },
{ "timetablelighton_sw:", {
user_command::timetablelightenable,
user_command::none } },
{ "timetablelightoff_sw:", {
user_command::timetablelightdisable,
user_command::none } },
{ "cablight_sw:", {
user_command::interiorlighttoggle,
user_command::none } },
Expand Down
31 changes: 30 additions & 1 deletion vr/openvr_imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,12 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
{ "alarmchain:", {
user_command::alarmchaintoggle,
user_command::none } },
{ "alarmchainon:", {
user_command::alarmchainenable,
user_command::none} },
{ "alarmchainoff:", {
user_command::alarmchainenable,
user_command::none} },
{ "brakeprofile_sw:", {
user_command::brakeactingspeedincrease,
user_command::brakeactingspeeddecrease } },
Expand Down Expand Up @@ -651,6 +657,12 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
{ "radio_sw:", {
user_command::radiotoggle,
user_command::none } },
{ "radioon_sw:", {
user_command::radioenable,
user_command::none } },
{ "radiooff_sw:", {
user_command::radiodisable,
user_command::none } },
{ "radiochannel_sw:", {
user_command::radiochannelincrease,
user_command::radiochanneldecrease } },
Expand All @@ -663,6 +675,12 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
{ "radiostop_sw:", {
user_command::radiostopsend,
user_command::none } },
{ "radiostopon_sw:", {
user_command::radiostopenable,
user_command::none } },
{ "radiostopoff_sw:", {
user_command::radiostopdisable,
user_command::none } },
{ "radiotest_sw:", {
user_command::radiostoptest,
user_command::none } },
Expand Down Expand Up @@ -729,9 +747,21 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
{ "dashboardlight_sw:", {
user_command::dashboardlighttoggle,
user_command::none } },
{ "dashboardlighton_sw:", {
user_command::dashboardlightenable,
user_command::none } },
{ "dashboardlightoff_sw:", {
user_command::dashboardlightdisable,
user_command::none } },
{ "timetablelight_sw:", {
user_command::timetablelighttoggle,
user_command::none } },
{ "timetablelighton_sw:", {
user_command::timetablelightenable,
user_command::none } },
{ "timetablelightoff_sw:", {
user_command::timetablelightdisable,
user_command::none } },
{ "cablight_sw:", {
user_command::interiorlighttoggle,
user_command::none } },
Expand Down Expand Up @@ -942,4 +972,3 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
};

bool vr_openvr::backend_register = vr_interface_factory::get_instance()->register_backend("openvr", vr_openvr::create_func);

0 comments on commit ccf537e

Please sign in to comment.