From 31fd66559411065e379a834f18441e215cd95b36 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Wed, 12 Aug 2026 12:44:43 -0400 Subject: [PATCH] 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. --- .../Touchpanels/Mpc4Touchpanel.cs | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Touchpanels/Mpc4Touchpanel.cs b/src/PepperDash.Essentials.Core/Touchpanels/Mpc4Touchpanel.cs index 19eb0d87..4d16f184 100644 --- a/src/PepperDash.Essentials.Core/Touchpanels/Mpc4Touchpanel.cs +++ b/src/PepperDash.Essentials.Core/Touchpanels/Mpc4Touchpanel.cs @@ -28,28 +28,7 @@ namespace PepperDash.Essentials.Core.Touchpanels public Mpc4TouchpanelController(string key, string name, CrestronControlSystem processor, Dictionary 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) {