Show a warning if the low FSR threshold is set too low.
This commit is contained in:
parent
37e5b445cd
commit
bbb49b6ae4
@ -145,8 +145,13 @@ Use if the platform is too sensitive.</clr:String>
|
||||
<Label Margin="5,0,0,0" x:Name="LowerValue" Content="0" Width="30" HorizontalContentAlignment="Right"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
/>
|
||||
<Image x:Name="ThresholdWarning"
|
||||
Source="Resources/threshold_warning.png" Width="9" Height="28"
|
||||
Margin="10,0,0,0"
|
||||
Visibility="Visible"
|
||||
/>
|
||||
<controls:DoubleSlider x:Name="Slider"
|
||||
Margin="32,5,0,0"
|
||||
Margin="24,5,0,0"
|
||||
MinimumDistance="10"
|
||||
LowerValue="20" UpperValue="35"
|
||||
VerticalAlignment="Top"
|
||||
@ -854,6 +859,14 @@ a panel to activate and deactivate.
|
||||
|
||||
A panel will activate when it reaches the right side of the
|
||||
slider, and deactivate when it reaches the left side of the slider.</TextBlock>
|
||||
<TextBlock x:Name="ThresholdWarningText" DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="0,15,0,0"
|
||||
xml:space="preserve"
|
||||
TextAlignment="Center"
|
||||
Foreground="#F00"
|
||||
>Low thresholds above 140 are recommended. Higher thresholds allow the
|
||||
panel to detect releases more quickly.
|
||||
</TextBlock>
|
||||
|
||||
|
||||
<DockPanel DockPanel.Dock="Bottom"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="0,0,5,0">
|
||||
|
@ -182,6 +182,19 @@ namespace smx_config
|
||||
RefreshUploadPadText(args);
|
||||
RefreshSelectedColorPicker();
|
||||
|
||||
// Show the threshold warning explanation if any panels are showing the threshold warning icon.
|
||||
bool ShowThresholdWarningText = false;
|
||||
foreach(Tuple<int, SMX.SMXConfig> activePad in ActivePad.ActivePads())
|
||||
{
|
||||
SMX.SMXConfig config = activePad.Item2;
|
||||
for(int panelIdx = 0; panelIdx < 9; ++panelIdx)
|
||||
{
|
||||
if(config.ShowThresholdWarning(panelIdx))
|
||||
ShowThresholdWarningText = true;
|
||||
}
|
||||
}
|
||||
ThresholdWarningText.Visibility = ShowThresholdWarningText? Visibility.Visible : Visibility.Hidden;
|
||||
|
||||
// If a second controller has connected and we're on Both, see if we need to prompt
|
||||
// to sync configs. We only actually need to do this if a controller just connected.
|
||||
if(args.ConfigurationChanged)
|
||||
|
BIN
smx-config/Resources/threshold_warning.png
Normal file
BIN
smx-config/Resources/threshold_warning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -112,6 +112,24 @@ namespace SMX
|
||||
return masterVersion >= 4 && (configFlags & SMXConfigFlags.PlatformFlags_FSR) != 0;
|
||||
}
|
||||
|
||||
// Return true if the low threshold is set too low.
|
||||
//
|
||||
// Higher low threshold values make the panel respond to the panel being released more
|
||||
// quickly. It shouldn't be set too low.
|
||||
public bool ShowThresholdWarning(int panel)
|
||||
{
|
||||
if(!fsr())
|
||||
return false;
|
||||
|
||||
// Don't show warnings for disabled panels.
|
||||
if(!GetEnabledPanels()[panel])
|
||||
return false;
|
||||
|
||||
int lower = panelSettings[panel].fsrLowThreshold[0];
|
||||
int MinimumRecommendedLowThreshold = 140;
|
||||
return lower < MinimumRecommendedLowThreshold;
|
||||
}
|
||||
|
||||
// enabledSensors is a mask of which panels are enabled. Return this as an array
|
||||
// for convenience.
|
||||
public bool[] GetEnabledPanels()
|
||||
|
@ -218,6 +218,9 @@
|
||||
<Resource Include="Resources\sensor_right.png" />
|
||||
<Resource Include="Resources\sensor_up.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\threshold_warning.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -122,6 +122,7 @@ namespace smx_config
|
||||
|
||||
DoubleSlider slider;
|
||||
Label LowerLabel, UpperLabel;
|
||||
Image ThresholdWarning;
|
||||
|
||||
OnConfigChange onConfigChange;
|
||||
|
||||
@ -132,6 +133,7 @@ namespace smx_config
|
||||
slider = GetTemplateChild("Slider") as DoubleSlider;
|
||||
LowerLabel = GetTemplateChild("LowerValue") as Label;
|
||||
UpperLabel = GetTemplateChild("UpperValue") as Label;
|
||||
ThresholdWarning = GetTemplateChild("ThresholdWarning") as Image;
|
||||
|
||||
slider.ValueChanged += delegate(DoubleSlider slider) { SaveToConfig(); };
|
||||
|
||||
@ -249,6 +251,10 @@ namespace smx_config
|
||||
UpperLabel.Content = upper.ToString();
|
||||
}
|
||||
|
||||
int panelIdx = panelNameToIndex[Type];
|
||||
bool ShowThresholdWarning = config.ShowThresholdWarning(panelIdx);
|
||||
ThresholdWarning.Visibility = ShowThresholdWarning? Visibility.Visible:Visibility.Hidden;
|
||||
|
||||
RefreshVisibility();
|
||||
UpdatingUI = false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user