mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 10:58:28 +00:00
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:
parent
1eed8a5c34
commit
21faed417b
1 changed files with 6 additions and 2 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue