Skip to content

Commit

Permalink
HotFix for clutch and serial command
Browse files Browse the repository at this point in the history
1. Hotfix for Clutch crash
2. Adding ESP32S3 controlboard option to make the command different. To prevent ESP32 dive into pair loop
  • Loading branch information
tcfshcrw committed Sep 22, 2024
1 parent 8265d90 commit fbdeddd
Show file tree
Hide file tree
Showing 31 changed files with 1,035 additions and 806 deletions.
9 changes: 8 additions & 1 deletion ESP32/include/ESPNOW_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ void ESPNow_initialize()
}
}
}
#endif
#endif

if(dap_config_st.payLoadPedalConfig_.pedal_type==1)
{
Recv_mac=Gas_mac;
Expand All @@ -466,6 +467,12 @@ void ESPNow_initialize()
Recv_mac=Brk_mac;
ESPNow.add_peer(Recv_mac);
}
if(dap_config_st.payLoadPedalConfig_.pedal_type==0)
{
Recv_mac=Brk_mac;
ESPNow.add_peer(Recv_mac);
}




Expand Down
2 changes: 1 addition & 1 deletion ESP32/src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ pinMode(Pairing_GPIO, INPUT_PULLUP);
xTaskCreatePinnedToCore(
ESPNOW_SyncTask,
"ESPNOW_update_Task",
3000,
5000,
//STACK_SIZE_FOR_TASK_2,
NULL,
1,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified SimHubPlugin/.vs/User.PluginSdkDemo/v17/.suo
Binary file not shown.
110 changes: 110 additions & 0 deletions SimHubPlugin/.vs/User.PluginSdkDemo/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{833040C9-FE5E-4CCF-B21D-71979E049B6B}|User.PluginSdkDemo.csproj|c:\\users\\tcfshcrw\\documents\\github\\diy-sim-racing-ffb-pedal\\simhubplugin\\settingscontroldemo.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{833040C9-FE5E-4CCF-B21D-71979E049B6B}|User.PluginSdkDemo.csproj|solutionrelative:settingscontroldemo.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{833040C9-FE5E-4CCF-B21D-71979E049B6B}|User.PluginSdkDemo.csproj|C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\settingscontroldemo.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{833040C9-FE5E-4CCF-B21D-71979E049B6B}|User.PluginSdkDemo.csproj|solutionrelative:settingscontroldemo.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{833040C9-FE5E-4CCF-B21D-71979E049B6B}|User.PluginSdkDemo.csproj|C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\dataplugindemosettings.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{833040C9-FE5E-4CCF-B21D-71979E049B6B}|User.PluginSdkDemo.csproj|solutionrelative:dataplugindemosettings.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{833040C9-FE5E-4CCF-B21D-71979E049B6B}|User.PluginSdkDemo.csproj|C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\dataplugindemo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{833040C9-FE5E-4CCF-B21D-71979E049B6B}|User.PluginSdkDemo.csproj|solutionrelative:dataplugindemo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{00000000-0000-0000-0000-000000000000}|\u003CSolution\u003E|User.PluginSdkDemo||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 1796,
"SelectedChildIndex": 3,
"Children": [
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "DataPluginDemo.cs",
"DocumentMoniker": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\DataPluginDemo.cs",
"RelativeDocumentMoniker": "DataPluginDemo.cs",
"ToolTip": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\DataPluginDemo.cs",
"RelativeToolTip": "DataPluginDemo.cs",
"ViewState": "AQIAANAAAAAAAAAAAAAcwN8DAAA3AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-22T01:27:42.551Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "SettingsControlDemo.xaml.cs",
"DocumentMoniker": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\SettingsControlDemo.xaml.cs",
"RelativeDocumentMoniker": "SettingsControlDemo.xaml.cs",
"ToolTip": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\SettingsControlDemo.xaml.cs",
"RelativeToolTip": "SettingsControlDemo.xaml.cs",
"ViewState": "AQIAADoKAAAAAAAAAAAawMwEAAA7AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-22T01:27:42.579Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "DataPluginDemoSettings.cs",
"DocumentMoniker": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\DataPluginDemoSettings.cs",
"RelativeDocumentMoniker": "DataPluginDemoSettings.cs",
"ToolTip": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\DataPluginDemoSettings.cs",
"RelativeToolTip": "DataPluginDemoSettings.cs",
"ViewState": "AQIAAB0AAAAAAAAAAAAAwCgAAAA/AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-22T01:27:42.58Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "SettingsControlDemo.xaml",
"DocumentMoniker": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\SettingsControlDemo.xaml",
"RelativeDocumentMoniker": "SettingsControlDemo.xaml",
"ToolTip": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\SettingsControlDemo.xaml",
"RelativeToolTip": "SettingsControlDemo.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-09-22T01:27:42.788Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "User.PluginSdkDemo",
"DocumentMoniker": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\User.PluginSdkDemo.csproj",
"RelativeDocumentMoniker": "User.PluginSdkDemo.csproj",
"ToolTip": "C:\\Users\\tcfshcrw\\Documents\\GitHub\\DIY-Sim-Racing-FFB-Pedal\\SimHubPlugin\\User.PluginSdkDemo.csproj",
"RelativeToolTip": "User.PluginSdkDemo.csproj",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|",
"WhenOpened": "2024-01-21T21:54:53.464Z"
}
]
},
{
"DockedWidth": 583,
"SelectedChildIndex": -1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}"
}
]
}
]
}
]
}
1 change: 1 addition & 0 deletions SimHubPlugin/DataPluginDemoSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class DataPluginDemoSettings
public double kinematicDiagram_zeroPos_OY = 20;
public double kinematicDiagram_zeroPos_scale = 1.5;
public bool[] RTSDTR_False = new bool[3] { true,true,true};
public bool[] USING_ESP32S3 = new bool[3] { true, true, true };
public bool[] CV1_enable_flag = new bool[3] { false,false, false };
public int[] CV1_trigger = new int[3] { 0, 0, 0 };
public string[] CV1_bindings = new string[3] { "","",""};
Expand Down
22 changes: 13 additions & 9 deletions SimHubPlugin/SettingsControlDemo.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -924,15 +924,19 @@
<styles:SHToggleButton x:Name="dump_pedal_response_to_file" Content="" Checked="dump_pedal_response_to_file_checked" Unchecked="dump_pedal_response_to_file_unchecked" IsChecked="False" FontSize="10" Width="35" Height="15" HorizontalAlignment="Left" FontFamily="Arial" ToolTip="Dump pedal realtime status to file, it should be of when not in use" RenderTransformOrigin="0.5,0.5" Margin="-10,0,0,0" />
<Label Content="Log pedal states" Height="20" Width="130" Padding="0,0,0,0" VerticalContentAlignment="Center" FontFamily="Arial" HorizontalAlignment="Left" FontSize="10" Margin="4,0,0,0"/>
</StackPanel>
<StackPanel Height="20" Width="160" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,2,0,0">
<styles:SHToggleButton x:Name="CheckBox_USINGESP32S3" Content="" Checked="CheckBox_USINGESP32S3_Checked" Unchecked="CheckBox_USINGESP32S3_Unchecked" IsChecked="False" FontSize="10" Width="35" Height="15" HorizontalAlignment="Left" FontFamily="Arial" ToolTip="The option is for S3" RenderTransformOrigin="0.5,0.5" Margin="-10,0,0,0" />
<Label Content="ESP32S3 ControlBoard" Height="20" Width="130" Padding="0,0,0,0" VerticalContentAlignment="Center" FontFamily="Arial" HorizontalAlignment="Left" FontSize="10" Margin="4,0,0,0"/>
</StackPanel>
<StackPanel Height="20" Width="160" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,2,0,0">
<styles:SHToggleButton x:Name="CheckBox_RTSDTR" Content="" Checked="CheckBox_RTSDTR_Checked" Unchecked="CheckBox_RTSDTR_Unchecked" IsChecked="False" FontSize="10" Width="35" Height="15" HorizontalAlignment="Left" FontFamily="Arial" ToolTip="The option is for S3" RenderTransformOrigin="0.5,0.5" Margin="-10,0,0,0" />
<Label Content="RTS/DTR false" Height="20" Width="130" Padding="0,0,0,0" VerticalContentAlignment="Center" FontFamily="Arial" HorizontalAlignment="Left" FontSize="10" Margin="4,0,0,0"/>
</StackPanel>
<styles:SHButtonPrimary x:Name="btn_rudder" Click="btn_rudder_Click" Width="160" Height="28" Content="Rudder" Margin="0,2,0,0" HorizontalAlignment="Center" />
<styles:SHButtonPrimary x:Name="button_pedal_position_reset" Click="ResetPedalPosition_click" Width="160" Height="28" Content="Reset pedal position" Margin="0,2,0,0" HorizontalAlignment="Center" />
<styles:SHButtonPrimary x:Name="button_pedal_restart" Click="RestartPedal_click" Width="160" Content="Restart Pedal" Height="28" Margin="0,2,0,0" HorizontalAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_system_id" Click="StartSystemIdentification_click" Width="160" RenderTransformOrigin="0.522,1.216" Height="28" Content="System identification" Margin="0,2,0,0" HorizontalAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_reset_default" Click="btn_reset_default_Click" Width="160" Content="Reset to Default" Height="28" Margin="0,2,0,0" HorizontalAlignment="Center" ToolTip="Reset the config to default" />
<styles:SHButtonPrimary x:Name="btn_rudder" Click="btn_rudder_Click" Width="160" Height="25" Content="Rudder" Margin="0,2,0,0" HorizontalAlignment="Center" VerticalContentAlignment="Center" Padding="15,0,15,0" />
<styles:SHButtonPrimary x:Name="button_pedal_position_reset" Click="ResetPedalPosition_click" Width="160" Height="25" Content="Reset pedal position" Margin="0,2,0,0" HorizontalAlignment="Center" VerticalContentAlignment="Center" Padding="15,0,15,0" />
<styles:SHButtonPrimary x:Name="button_pedal_restart" Click="RestartPedal_click" Width="160" Content="Restart Pedal" Height="25" Margin="0,2,0,0" HorizontalAlignment="Center" MinHeight="20" Padding="15,0,15,0" VerticalContentAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_system_id" Click="StartSystemIdentification_click" Width="160" RenderTransformOrigin="0.522,1.216" Height="25" Content="System identification" Margin="0,2,0,0" HorizontalAlignment="Center" Padding="15,0,15,0" VerticalContentAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_reset_default" Click="btn_reset_default_Click" Width="160" Content="Reset to Default" Height="25" Margin="0,2,0,0" HorizontalAlignment="Center" ToolTip="Reset the config to default" Padding="15,0,15,0" VerticalContentAlignment="Center" />
</StackPanel>
</Border>
</TabItem>
Expand Down Expand Up @@ -968,10 +972,10 @@
</StackPanel>
<Slider x:Name="Slider_Pedal_interval_trigger" Style="{DynamicResource SliderStyle_single_H}" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top" Width="160" Height="10" Maximum="100" SmallChange="1" ValueChanged="Slider_Pedal_interval_trigger_ValueChanged" LargeChange="10" IsSnapToTickEnabled="True" Minimum="20" ToolTip="Adjust for the serial write interval, when meet I/O error, increase the interval"/>
</StackPanel>
<styles:SHButtonPrimary x:Name="btn_Bridge_restart" Click="btn_Bridge_restart_Click" Width="160" Content="Bridge Restart" Height="28" Margin="0,2,0,0" HorizontalAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_Pairing" Click="btn_Pairing_Click" Width="160" Content="Enable Pairing Mode" Height="28" Margin="0,2,0,0" HorizontalAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_PedalID_Reset" Click="btn_PedalID_Reset_Click" Width="160" Content="Reset Pedal ID" Height="28" Margin="0,2,0,0" HorizontalAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_OTA_enable" Click="btn_OTA_enable_Click" Width="160" Content="Enable FIrmware OTA" Height="28" Margin="0,2,0,0" HorizontalAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_Bridge_restart" Click="btn_Bridge_restart_Click" Width="160" Content="Bridge Restart" Height="25" Margin="0,2,0,0" HorizontalAlignment="Center" Padding="15,0,15,0" VerticalContentAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_Pairing" Click="btn_Pairing_Click" Width="160" Content="Enable Pairing Mode" Height="25" Margin="0,2,0,0" HorizontalAlignment="Center" Padding="15,0,15,0" VerticalContentAlignment="Center" />
<styles:SHButtonPrimary x:Name="btn_PedalID_Reset" Click="btn_PedalID_Reset_Click" Width="160" Content="Reset Pedal ID" Height="25" Margin="0,2,0,0" HorizontalAlignment="Center" VerticalContentAlignment="Center" Padding="15,0,15,0" />
<styles:SHButtonPrimary x:Name="btn_OTA_enable" Click="btn_OTA_enable_Click" Width="160" Content="Enable FIrmware OTA" Height="25" Margin="0,2,0,0" HorizontalAlignment="Center" Padding="15,0,15,0" VerticalContentAlignment="Center" />
</StackPanel>
</Border>
</TabItem>
Expand Down
29 changes: 28 additions & 1 deletion SimHubPlugin/SettingsControlDemo.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,14 @@ public void updateTheGuiFromConfig()
{
CheckBox_using_CDC_for_bridge.IsChecked = false;
}
if (Plugin.Settings.USING_ESP32S3[indexOfSelectedPedal_u] == true)
{
CheckBox_USINGESP32S3.IsChecked = true;
}
else
{
CheckBox_USINGESP32S3.IsChecked = false;
}



Expand Down Expand Up @@ -2619,13 +2627,16 @@ public void openSerialAndAddReadCallback(uint pedalIdx)
Plugin._serialPort[pedalIdx].RtsEnable = false;
Plugin._serialPort[pedalIdx].DtrEnable = false;
}
else
//

if (Plugin.Settings.USING_ESP32S3[pedalIdx] == true)
{
// ESP32 S3
Plugin._serialPort[pedalIdx].RtsEnable = false;
Plugin._serialPort[pedalIdx].DtrEnable = true;
}



System.Threading.Thread.Sleep(200);

Expand Down Expand Up @@ -6805,6 +6816,22 @@ unsafe private void btn_Pairing_Click(object sender, RoutedEventArgs e)


}

private void CheckBox_USINGESP32S3_Checked(object sender, RoutedEventArgs e)
{
if (Plugin != null)
{
Plugin.Settings.USING_ESP32S3[indexOfSelectedPedal_u] = true;
}
}

private void CheckBox_USINGESP32S3_Unchecked(object sender, RoutedEventArgs e)
{
if (Plugin != null)
{
Plugin.Settings.USING_ESP32S3[indexOfSelectedPedal_u] = false;
}
}
}

}
Binary file modified SimHubPlugin/bin/DiyActivePedal.dll
Binary file not shown.
Binary file modified SimHubPlugin/bin/DiyActivePedal.g.resources
Binary file not shown.
Binary file modified SimHubPlugin/bin/DiyActivePedal.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified SimHubPlugin/obj/Release/DiyActivePedal.dll
Binary file not shown.
Binary file modified SimHubPlugin/obj/Release/DiyActivePedal.g.resources
Binary file not shown.
Binary file modified SimHubPlugin/obj/Release/DiyActivePedal.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
library
C#
.cs
C:\Users\chris\OneDrive\Desktop\GIT\DIY-Sim-Racing-Active-Pedal\SimHubPlugin\obj\Release\
C:\Users\tcfshcrw\Documents\GitHub\DIY-Sim-Racing-FFB-Pedal\SimHubPlugin\obj\Release\
User.PluginSdkDemo
none
false
Expand Down
2 changes: 1 addition & 1 deletion SimHubPlugin/obj/Release/DiyActivePedal_MarkupCompile.lref
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


FC:\Users\chris\OneDrive\Desktop\GIT\DIY-Sim-Racing-Active-Pedal\SimHubPlugin\SettingsControlDemo.xaml;;
FC:\Users\tcfshcrw\Documents\GitHub\DIY-Sim-Racing-FFB-Pedal\SimHubPlugin\SettingsControlDemo.xaml;;

Binary file modified SimHubPlugin/obj/Release/SettingsControlDemo.baml
Binary file not shown.
Loading

0 comments on commit fbdeddd

Please sign in to comment.