Added configurable LED sample size

This commit is contained in:
SpoinkyNL committed 2019-12-19 23:18:09 +01:00
1 parent 2f8671045c
commit b1870e9e64
10 files changed
+132 -17

No files matched your search

@@ -80,8 +80,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
// Remove the tool from the canvas
if (_activeToolViewModel != null)
{
CanvasViewModels.Remove(_activeToolViewModel);
NotifyOfPropertyChange(() => CanvasViewModels);
lock (CanvasViewModels)
{
CanvasViewModels.Remove(_activeToolViewModel);
NotifyOfPropertyChange(() => CanvasViewModels);
}
}
// Set the new tool
@@ -89,8 +92,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
// Add the new tool to the canvas
if (_activeToolViewModel != null)
{
CanvasViewModels.Add(_activeToolViewModel);
NotifyOfPropertyChange(() => CanvasViewModels);
lock (CanvasViewModels)
{
CanvasViewModels.Add(_activeToolViewModel);
NotifyOfPropertyChange(() => CanvasViewModels);
}
}
}
}
@@ -130,6 +130,28 @@
<ComboBox Width="80" SelectedItem="{Binding SelectedTargetFrameRate}" ItemsSource="{Binding TargetFrameRates}" DisplayMemberPath="Item1"/>
</StackPanel>
</Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">LED sample size</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
Sets the amount of samples that is taken to determine each LEDs color.
Best you leave it on 1 but included for completeness, a higher value increases CPU-usage quite rapidly.
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<ComboBox Width="80" SelectedItem="{Binding SampleSize}" ItemsSource="{Binding SampleSizes}"/>
</StackPanel>
</Grid>
</StackPanel>
</materialDesign:Card>
</StackPanel>
@@ -45,8 +45,13 @@ namespace Artemis.UI.Screens.Settings
TargetFrameRates = new List<Tuple<string, int>>();
for (var i = 10; i <= 30; i += 5)
TargetFrameRates.Add(new Tuple<string, int>(i + " FPS", i));
// Anything else is kinda broken right now
SampleSizes = new List<int> {1, 9};
}
public List<int> SampleSizes { get; set; }
public BindableCollection<DeviceSettingsViewModel> DeviceSettingsViewModels { get; set; }
public List<Tuple<string, double>> RenderScales { get; set; }
@@ -61,7 +66,7 @@ namespace Artemis.UI.Screens.Settings
{
get => TargetFrameRates.FirstOrDefault(t => Math.Abs(t.Item2 - TargetFrameRate) < 0.01);
set => TargetFrameRate = value.Item2;
}
}
public double RenderScale
{
@@ -85,6 +90,16 @@ namespace Artemis.UI.Screens.Settings
}
}
public int SampleSize
{
get => _settingsService.GetSetting("Core.SampleSize", 1).Value;
set
{
_settingsService.GetSetting("Core.SampleSize", 1).Value = value;
_settingsService.GetSetting("Core.SampleSize", 1).Save();
}
}
public string Title => "Settings";
protected override void OnActivate()