fix: Simplify touchscreen slot selection logic

Replaced switch statement for touchscreen type selection with a single cast assignment to MPC3Basic. This streamlines initialization and removes explicit handling for each touchscreen type. Error logging is retained for failed casts.
This commit is contained in:
Nick Genovese 2026-08-12 12:44:43 -04:00
parent d713d65c7a
commit 31fd665594

View file

@ -28,28 +28,7 @@ namespace PepperDash.Essentials.Core.Touchpanels
public Mpc4TouchpanelController(string key, string name, CrestronControlSystem processor, Dictionary<string, KeypadButton> buttons)
: base(key, name)
{
switch (processor.TouchscreenType)
{
case eTouchscreenType.MPC4x102:
_touchpanel = processor.MPC4x102TouchscreenSlot;
break;
case eTouchscreenType.MPC4x201:
_touchpanel = processor.MPC4x201TouchscreenSlot;
break;
case eTouchscreenType.MPC4x301:
_touchpanel = processor.MPC4x301TouchscreenSlot;
break;
case eTouchscreenType.MPC4x302:
_touchpanel = processor.MPC4x302TouchscreenSlot;
break;
default:
Debug.LogMessage(LogEventLevel.Error, this, "Unsupported touchpanel type '{0}' for MPC4 Touch Controller", processor.TouchscreenType);
break;
}
_touchpanel = processor.ControllerTouchScreenSlotDevice as MPC3Basic;
if (_touchpanel == null)
{