From 9038d950368371cfb73de1abde9a729d850752bb Mon Sep 17 00:00:00 2001 From: tcfshcrw <48719709+tcfshcrw@users.noreply.github.com> Date: Fri, 30 Aug 2024 05:06:28 +0800 Subject: [PATCH] maxforce and preload change to float bump dap version to 141 --- ESP32/include/DiyActivePedal_types.h | 6 ++--- ESP_bridge/include/DiyActivePedal_types.h | 6 ++--- SimHubPlugin/DataPluginDemo.cs | 6 ++--- SimHubPlugin/SettingsControlDemo.xaml | 2 +- SimHubPlugin/SettingsControlDemo.xaml.cs | 30 +++++++++++------------ 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ESP32/include/DiyActivePedal_types.h b/ESP32/include/DiyActivePedal_types.h index 59ee7941..f83e30c7 100644 --- a/ESP32/include/DiyActivePedal_types.h +++ b/ESP32/include/DiyActivePedal_types.h @@ -3,7 +3,7 @@ #include // define the payload revision -#define DAP_VERSION_CONFIG 140 +#define DAP_VERSION_CONFIG 141 // define the payload types #define DAP_PAYLOAD_TYPE_CONFIG 100 @@ -72,8 +72,8 @@ struct payloadPedalConfig { uint8_t pedalEndPosition; // configure pedal forces - uint16_t maxForce; - uint16_t preloadForce; + float maxForce; + float preloadForce; // design force vs travel curve // In percent diff --git a/ESP_bridge/include/DiyActivePedal_types.h b/ESP_bridge/include/DiyActivePedal_types.h index 60f6c867..a7fcd0db 100644 --- a/ESP_bridge/include/DiyActivePedal_types.h +++ b/ESP_bridge/include/DiyActivePedal_types.h @@ -3,7 +3,7 @@ #include // define the payload revision -#define DAP_VERSION_CONFIG 140 +#define DAP_VERSION_CONFIG 141 // define the payload types #define DAP_PAYLOAD_TYPE_CONFIG 100 @@ -76,8 +76,8 @@ struct payloadPedalConfig { uint8_t pedalEndPosition; // configure pedal forces - uint16_t maxForce; - uint16_t preloadForce; + float maxForce; + float preloadForce; // design force vs travel curve // In percent diff --git a/SimHubPlugin/DataPluginDemo.cs b/SimHubPlugin/DataPluginDemo.cs index db36b578..2fc7bef9 100644 --- a/SimHubPlugin/DataPluginDemo.cs +++ b/SimHubPlugin/DataPluginDemo.cs @@ -25,7 +25,7 @@ static class Constants { // payload revisiom - public const uint pedalConfigPayload_version = 140; + public const uint pedalConfigPayload_version = 141; // pyload types @@ -106,8 +106,8 @@ public struct payloadPedalConfig public byte pedalEndPosition; // configure pedal forces - public Int16 maxForce; - public Int16 preloadForce; + public float maxForce; + public float preloadForce; // design force vs travel curve // In percent diff --git a/SimHubPlugin/SettingsControlDemo.xaml b/SimHubPlugin/SettingsControlDemo.xaml index 013352c4..ebfc04f0 100644 --- a/SimHubPlugin/SettingsControlDemo.xaml +++ b/SimHubPlugin/SettingsControlDemo.xaml @@ -661,7 +661,7 @@ diff --git a/SimHubPlugin/SettingsControlDemo.xaml.cs b/SimHubPlugin/SettingsControlDemo.xaml.cs index f6bf96f4..e1b178ce 100644 --- a/SimHubPlugin/SettingsControlDemo.xaml.cs +++ b/SimHubPlugin/SettingsControlDemo.xaml.cs @@ -546,7 +546,7 @@ public SettingsControlDemo() DrawGridLines_kinematicCanvas(100,20,1.5); CustomEffectTab.Visibility = Visibility.Hidden; Label_RSSI.Visibility= Visibility.Hidden; - Rangeslider_force_range.TickFrequency = 10; + Rangeslider_force_range.TickFrequency = 1; @@ -1091,16 +1091,16 @@ public void updateTheGuiFromConfig() Rangeslider_force_range.LowerValue = dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.preloadForce; if (indexOfSelectedPedal_u != 1) { - Rangeslider_force_range.Maximum = 500; + Rangeslider_force_range.Maximum = 50; } else { - Rangeslider_force_range.Maximum = 2000; + Rangeslider_force_range.Maximum = 200; } if (Plugin != null) { - Label_max_force.Content = "Max force:\n" + dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.maxForce / 10 + "kg"; - Label_min_force.Content = "Preload:\n" + dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.preloadForce / 10 + "kg"; + Label_max_force.Content = "Max force:\n" + dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.maxForce + "kg"; + Label_min_force.Content = "Preload:\n" + dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.preloadForce + "kg"; } label_damping.Content = "Damping factor: " + (float)(dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.dampingPress * 0.00015f)+"s"; @@ -2704,8 +2704,8 @@ public void connection_timmer_tick(object sender, EventArgs e) Plugin.ESPsync_serialPort.Open(); System.Threading.Thread.Sleep(200); // ESP32 S3 - Plugin.ESPsync_serialPort.RtsEnable = false; - Plugin.ESPsync_serialPort.DtrEnable = true; + //Plugin.ESPsync_serialPort.RtsEnable = false; + //Plugin.ESPsync_serialPort.DtrEnable = true; //SystemSounds.Beep.Play(); Plugin.Sync_esp_connection_flag = true; btn_connect_espnow_port.Content = "Disconnect"; @@ -4325,7 +4325,7 @@ private void Debug_checkbox_Checked(object sender, RoutedEventArgs e) Line_H_HeaderTab.X2 = 1088; CustomEffectTab.Visibility = Visibility.Visible; Slider_LC_rate.TickFrequency = 1; - Rangeslider_force_range.TickFrequency = 1; + Rangeslider_force_range.TickFrequency = 0.1; } @@ -4354,7 +4354,7 @@ private void Debug_checkbox_Unchecked(object sender, RoutedEventArgs e) Line_H_HeaderTab.X2 = 723; CustomEffectTab.Visibility = Visibility.Hidden; Slider_LC_rate.TickFrequency = 10; - Rangeslider_force_range.TickFrequency = 10; + Rangeslider_force_range.TickFrequency = 1; } @@ -5628,19 +5628,19 @@ private void Rangeslider_travel_range_UpperValueChanged(object sender, RangePara private void Rangeslider_force_range_UpperValueChanged(object sender, RangeParameterChangedEventArgs e) { - dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.maxForce = (Int16)e.NewValue; + dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.maxForce = (float)e.NewValue; if (Plugin != null) { - Label_max_force.Content = "Max force:\n" + (float)dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.maxForce/10.0f + "kg"; + Label_max_force.Content = "Max force:\n" + (float)dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.maxForce + "kg"; } } private void Rangeslider_force_range_LowerValueChanged(object sender, RangeParameterChangedEventArgs e) { - dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.preloadForce = (Int16)e.NewValue; + dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.preloadForce = (float)e.NewValue; if (Plugin != null) { - Label_min_force.Content = "Preload:\n" + (float)dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.preloadForce/10.0f + "kg"; + Label_min_force.Content = "Preload:\n" + (float)dap_config_st[indexOfSelectedPedal_u].payloadPedalConfig_.preloadForce + "kg"; } } @@ -5902,8 +5902,8 @@ private void btn_connect_espnow_port_Click(object sender, RoutedEventArgs e) Plugin.ESPsync_serialPort.Open(); System.Threading.Thread.Sleep(200); // ESP32 S3 - Plugin.ESPsync_serialPort.RtsEnable = false; - Plugin.ESPsync_serialPort.DtrEnable = true; + //Plugin.ESPsync_serialPort.RtsEnable = false; + //Plugin.ESPsync_serialPort.DtrEnable = true; SystemSounds.Beep.Play(); Plugin.Sync_esp_connection_flag = true; btn_connect_espnow_port.Content = "Disconnect";