From 3c3f2a2e2d4197dca866c7d1bd6ed2eefa787423 Mon Sep 17 00:00:00 2001 From: ChrGri Date: Mon, 25 Dec 2023 06:38:10 +0100 Subject: [PATCH] Bugfix: No joystick output --- Arduino/Esp32/Main/Main.ino | 86 +++++++------------ SimHubPlugin/.vs/User.PluginSdkDemo/v17/.suo | Bin 135680 -> 152576 bytes 2 files changed, 33 insertions(+), 53 deletions(-) diff --git a/Arduino/Esp32/Main/Main.ino b/Arduino/Esp32/Main/Main.ino index b03c9018..92b859bf 100644 --- a/Arduino/Esp32/Main/Main.ino +++ b/Arduino/Esp32/Main/Main.ino @@ -17,11 +17,7 @@ bool isv57LifeSignal_b = false; int32_t servo_offset_compensation_steps_i32 = 0; #endif -#ifdef Using_analog_output - int32_t Using_analog_output_ = 1; -#else - int32_t Using_analog_output_ = 0; -#endif + @@ -213,15 +209,9 @@ void setup() Serial.println(" "); // init controller - if(Using_analog_output_ !=1) - { - SetupController(); - delay(2000); - } - else - { - delay(10000); - } + SetupController(); + delay(2000); + // check whether iSV57 communication can be established @@ -678,19 +668,6 @@ void pedalUpdateTask( void * pvParameters ) joystickNormalizedToInt32 = NormalizeControllerOutputValue(loadcellReading, dap_calculationVariables_st.Force_Min, dap_calculationVariables_st.Force_Max, dap_config_st.payLoadPedalConfig_.maxGameOutput); //joystickNormalizedToInt32 = NormalizeControllerOutputValue(filteredReading, dap_calculationVariables_st.Force_Min, dap_calculationVariables_st.Force_Max, dap_config_st.payLoadPedalConfig_.maxGameOutput); xSemaphoreGive(semaphore_updateJoystick); - if(Using_analog_output_ =1) - { - int dac_value=(int)(joystickNormalizedToInt32*255/10000); - dacWrite(D_O,dac_value); - } - if(dap_config_st.payLoadPedalConfig_.Simulate_ABS_trigger==1) - { - int32_t ABS_trigger_value=dap_config_st.payLoadPedalConfig_.Simulate_ABS_value*100; - if(joystickNormalizedToInt32 > ABS_trigger_value) - { - absOscillation.trigger(); - } - } } } else @@ -699,6 +676,25 @@ void pedalUpdateTask( void * pvParameters ) //Serial.println("semaphore_updateJoystick == 0"); } + // provide joystick output on PIN + #ifdef Using_analog_output + int dac_value=(int)(joystickNormalizedToInt32*255/10000); + dacWrite(D_O,dac_value); + #endif + + + // simulate ABS trigger + if(dap_config_st.payLoadPedalConfig_.Simulate_ABS_trigger==1) + { + int32_t ABS_trigger_value=dap_config_st.payLoadPedalConfig_.Simulate_ABS_value*100; + if(joystickNormalizedToInt32 > ABS_trigger_value) + { + absOscillation.trigger(); + } + } + + + #ifdef PRINT_USED_STACK_SIZE unsigned int temp2 = uxTaskGetStackHighWaterMark(nullptr); Serial.print("PU task stack size="); Serial.println(temp2); @@ -888,41 +884,25 @@ void serialCommunicationTask( void * pvParameters ) } } + + // transmit controller output - if(Using_analog_output_ =1) + if (IsControllerReady()) { if(semaphore_updateJoystick!=NULL) { - if(xSemaphoreTake(semaphore_updateJoystick, (TickType_t)1)==pdTRUE) - { - joystickNormalizedToInt32_local = joystickNormalizedToInt32; - xSemaphoreGive(semaphore_updateJoystick); - } - //else - //{ - //Serial.println("semaphore_updateJoystick == 0"); - //} - } - } - else - { - if (IsControllerReady()) { - if(semaphore_updateJoystick!=NULL) + if(xSemaphoreTake(semaphore_updateJoystick, (TickType_t)1)==pdTRUE) { - if(xSemaphoreTake(semaphore_updateJoystick, (TickType_t)1)==pdTRUE) - { - joystickNormalizedToInt32_local = joystickNormalizedToInt32; - xSemaphoreGive(semaphore_updateJoystick); - } - //else - //{ - //Serial.println("semaphore_updateJoystick == 0"); - //} + joystickNormalizedToInt32_local = joystickNormalizedToInt32; + xSemaphoreGive(semaphore_updateJoystick); } - SetControllerOutputValue(joystickNormalizedToInt32_local); } + SetControllerOutputValue(joystickNormalizedToInt32_local); } + + + } } diff --git a/SimHubPlugin/.vs/User.PluginSdkDemo/v17/.suo b/SimHubPlugin/.vs/User.PluginSdkDemo/v17/.suo index 53f123177392a05c7e42584644511401e1634e20..ba4dcfae1af9f0e8cf0fae42b2b54d14315ef755 100644 GIT binary patch delta 1569 z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