mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
feat: Add Mpc4TouchpanelController for MPC4 processors
Introduced Mpc4TouchpanelController to manage touchpanel behavior for MPC4 class processors, including button initialization, feedback, and event handling. Updated ControlSystem.cs to detect MPC4 models, deserialize button configs, and register the controller with DeviceManager.
This commit is contained in:
parent
e23c987516
commit
f5d6a076ad
2 changed files with 326 additions and 0 deletions
|
|
@ -436,6 +436,25 @@ namespace PepperDash.Essentials
|
|||
"WARNING: Config file defines processor type as '{deviceType:l}' but actual processor is '{processorType:l}'! Some ports may not be available",
|
||||
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
|
||||
|
||||
// Check if the processor is an MPC4 model
|
||||
if (prompt.IndexOf("mpc4", StringComparison.OrdinalIgnoreCase) > -1)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, "MPC4 processor type detected. Adding Mpc4TouchpanelController.");
|
||||
|
||||
var butToken = devConf.Properties["buttons"];
|
||||
if (butToken == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Warning,
|
||||
"Error: Unable to deserialize buttons collection for device: {deviceKey}", devConf.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
var buttons = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.Dictionary<string, Core.Touchpanels.KeypadButton>>(butToken.ToString());
|
||||
var tpController = new Core.Touchpanels.Mpc4TouchpanelController(
|
||||
string.Format("{0}-keypadButtons", devConf.Key), devConf.Name, Global.ControlSystem, buttons);
|
||||
|
||||
DeviceManager.AddDevice(tpController);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue