Devices - Added option to disable default layouts

This commit is contained in:
Robert committed 2021-06-03 11:10:07 +02:00
1 parent fb3f7e0cc1
commit cef37677f2
6 files changed
+117 -10

No files matched your search

+12 -5
View File
@@ -354,19 +354,26 @@ namespace Artemis.Core.Services
}
// Finally fall back to a default layout
layout = ArtemisLayout.GetDefaultLayout(device);
if (layout != null)
ApplyDeviceLayout(device, layout);
if (!device.DisableDefaultLayout)
layout = ArtemisLayout.GetDefaultLayout(device);
ApplyDeviceLayout(device, layout);
return layout;
}
public void ApplyDeviceLayout(ArtemisDevice device, ArtemisLayout layout)
public void ApplyDeviceLayout(ArtemisDevice device, ArtemisLayout? layout)
{
if (layout == null)
{
if (device.Layout != null)
device.ClearLayout();
return;
}
if (layout.Source == LayoutSource.Default)
device.ApplyLayout(layout, false, false);
else
device.ApplyLayout(layout, device.DeviceProvider.CreateMissingLedsSupported, device.DeviceProvider.RemoveExcessiveLedsSupported);
UpdateLedGroup();
}