Merge pull request #1414 from PepperDash/fix/debug-on-cslan-and-fw-dependency-check

fix: clean up unused using directives and add firmware version check …
This commit is contained in:
Neil Dorin 2026-05-05 10:58:32 -06:00 committed by GitHub
commit 1ecfca7e5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 4 deletions

View file

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Crestron.SimplSharp; using Crestron.SimplSharp;

View file

@ -51,8 +51,10 @@ namespace PepperDash.Core
if (service == null) return ""; if (service == null) return "";
// Use CSLAN IP if available, otherwise fallback to primary IP. This ensures we provide a reachable URL in dual-stack environments. // Use CSLAN IP if available, otherwise fallback to primary IP. This ensures we provide a reachable URL in dual-stack environments.
if (!string.IsNullOrEmpty(CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 1))) var cslanIp = CrestronEthernetHelper.GetEthernetParameter(
return $"wss://{CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 1)}:{_httpsServer.Port}{service.Path}"; CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 1);
if (!string.IsNullOrEmpty(cslanIp) && cslanIp != "Invalid Value")
return $"wss://{cslanIp}:{_httpsServer.Port}{service.Path}";
else else
return $"wss://{CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0)}:{_httpsServer.Port}{service.Path}"; return $"wss://{CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0)}:{_httpsServer.Port}{service.Path}";
} }

View file

@ -27,6 +27,8 @@ namespace PepperDash.Essentials
private CEvent _initializeEvent; private CEvent _initializeEvent;
private const long StartupTime = 500; private const long StartupTime = 500;
private const string minimumFirmwareVersion = "2.8006.00110";
/// <summary> /// <summary>
/// Initializes a new instance of the ControlSystem class /// Initializes a new instance of the ControlSystem class
/// </summary> /// </summary>
@ -46,6 +48,24 @@ namespace PepperDash.Essentials
/// <inheritdoc /> /// <inheritdoc />
public override void InitializeSystem() public override void InitializeSystem()
{ {
// Get FW version and stop if it's too low to run this version of Essentials. Must be greater than v2.8006.00110
var fwVersion = InitialParametersClass.FirmwareVersion;
Debug.LogInformation("Control System Hardware Version: {fwVersion}", fwVersion);
// split the version into parts and compare against minimumFirmwareVersion
var versionParts = fwVersion.Split('.').Select(int.Parse).ToArray();
var minParts = minimumFirmwareVersion.Split('.').Select(int.Parse).ToArray();
if (versionParts.Length < minParts.Length
|| versionParts[0] < minParts[0]
|| (versionParts[0] == minParts[0] && versionParts[1] < minParts[1])
|| (versionParts[0] == minParts[0] && versionParts[1] == minParts[1] && versionParts[2] <= minParts[2]))
{
Debug.LogFatal("Firmware version {fwVersion} is too low to run this version of Essentials. Please upgrade to greater than v{minimumFirmwareVersion}.", fwVersion, minimumFirmwareVersion);
return;
}
// If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate // If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate
// to allow any HD-BaseT DM endpoints to register first. // to allow any HD-BaseT DM endpoints to register first.
bool preventInitializationComplete = Global.ControlSystemIsDmpsType; bool preventInitializationComplete = Global.ControlSystemIsDmpsType;