Skip to content

Commit

Permalink
Bug fix for Rudder
Browse files Browse the repository at this point in the history
1. add deadzone+/-2% for rudder joystick
2. fix a bug when apply a profile but without pedal type change
  • Loading branch information
tcfshcrw committed Aug 2, 2024
1 parent 39b3be5 commit 2dc60c0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
24 changes: 21 additions & 3 deletions ESP32/src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* Todo*/
// https://github.com/espressif/arduino-esp32/issues/7779


#define ESTIMATE_LOADCELL_VARIANCE
#define ISV_COMMUNICATION
//#define PRINT_SERVO_STATES
Expand Down Expand Up @@ -287,7 +286,10 @@ void setup()
delay(3000);
Serial.println("This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.");
Serial.println("Please check github repo for more detail: https://github.com/ChrGri/DIY-Sim-Racing-FFB-Pedal");
//printout the github releasing version



// check whether iSV57 communication can be established
// and in case, (a) send tuned servo parameters and (b) prepare the servo for signal read
#ifdef ISV_COMMUNICATION
Expand Down Expand Up @@ -1587,12 +1589,28 @@ void serialCommunicationTask( void * pvParameters )
}
//Serial.print(" 4");
//Serial.print("\r\n");
if(dap_calculationVariables_st.rudder_brake_status&&dap_calculationVariables_st.Rudder_status)
if(dap_calculationVariables_st.Rudder_status)
{
SetControllerOutputValue_rudder(JOYSTICK_RANGE/2,joystickNormalizedToInt32_local);
if(dap_calculationVariables_st.rudder_brake_status)
{
SetControllerOutputValue_rudder(JOYSTICK_RANGE/2,joystickNormalizedToInt32_local);
}
else
{
//deadzone 2%
if(joystickNormalizedToInt32_local<=(int32_t)(JOYSTICK_RANGE*0.48)||joystickNormalizedToInt32_local>=(int32_t)(JOYSTICK_RANGE*0.52))
{
SetControllerOutputValue(joystickNormalizedToInt32_local);
}
else
{
SetControllerOutputValue(JOYSTICK_RANGE/2);
}
}
}
else
{
//general output
SetControllerOutputValue(joystickNormalizedToInt32_local);
}

Expand Down
2 changes: 2 additions & 0 deletions SimHubPlugin/SettingsControlDemo.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3563,6 +3563,8 @@ void Parsefile(uint profile_index)
{
dap_config_st[pedalIdx].payloadPedalConfig_.kf_modelNoise = 5;
}
dap_config_st[pedalIdx].payloadPedalConfig_.pedal_type = (byte)pedalIdx;

}

}
Expand Down
Binary file modified SimHubPlugin/bin/DiyActivePedal.dll
Binary file not shown.

0 comments on commit 2dc60c0

Please sign in to comment.