fix: Refactor activation logic and improve logging

Replaced Initialize() with CustomActivate() returning a bool for activation success. Added logging for activation and slot usage. Now returns false if slot not found and returns registration status at the end.
This commit is contained in:
Nick Genovese 2026-08-14 10:35:07 -04:00
parent 1eed8a5c34
commit 21faed417b

View file

@ -33,8 +33,10 @@ namespace PepperDash.Essentials.Core.Touchpanels
_buttons = buttons ?? new Dictionary<string, KeypadButton>(); _buttons = buttons ?? new Dictionary<string, KeypadButton>();
} }
public override void Initialize() public override bool CustomActivate()
{ {
Debug.LogInformation(this, "Activating MPC4 Touchpanel Controller with key {0}", Key);
if (_processor.MPC4x102TouchscreenSlot != null) if (_processor.MPC4x102TouchscreenSlot != null)
{ {
Debug.LogMessage(LogEventLevel.Information, this, "Using MPC4x102TouchscreenSlot"); Debug.LogMessage(LogEventLevel.Information, this, "Using MPC4x102TouchscreenSlot");
@ -58,7 +60,7 @@ namespace PepperDash.Essentials.Core.Touchpanels
else else
{ {
Debug.LogMessage(LogEventLevel.Error, this, "Failed to find MPC4 Touchpanel Controller with key {0}, check configuration", Key); Debug.LogMessage(LogEventLevel.Error, this, "Failed to find MPC4 Touchpanel Controller with key {0}, check configuration", Key);
return; return false;
} }
if (_touchpanel.Registerable) if (_touchpanel.Registerable)
@ -81,6 +83,8 @@ namespace PepperDash.Essentials.Core.Touchpanels
} }
ListButtons(); ListButtons();
return _touchpanel.Registered;
} }
/// <summary> /// <summary>