fix(driver-focas): resolve Low code-review findings (Driver.FOCAS-007,008,009,010,011)
- Driver.FOCAS-007: optional ILogger<FocasDriver> + alarm-projection logger; log Debug around every formerly-empty catch (probe / shutdown / fixed-tree / recycle / alarms-read / projection). - Driver.FOCAS-008: cache the parsed FocasAddress per tag at InitializeAsync; Read/WriteAsync look it up instead of re-parsing on every call. - Driver.FOCAS-009: ProbeLoopAsync now wraps client.ProbeAsync in a linked CTS honouring Probe.Timeout so a hung CNC socket can't block past the configured limit. - Driver.FOCAS-010: FocasOperationModeExtensions.ToText delegates to FocasOpMode.ToText — single canonical op-mode label surface. - Driver.FOCAS-011: FocasAlarmType constants are typed short to match the cnc_rdalmmsg2 wire field and the projection switch arms. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -58,23 +58,13 @@ public static class FocasOperationModeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Canonical operator-facing label for an operation mode (e.g. <c>"AUTO"</c>,
|
||||
/// <c>"EDIT"</c>). Unknown codes fall back to the raw numeric value as a string
|
||||
/// so the UI still shows something interpretable.
|
||||
/// <c>"EDIT"</c>). Delegates to <see cref="FocasOpMode.ToText"/> so the wire layer
|
||||
/// and the fixed-tree projection render identical labels — historically these two
|
||||
/// surfaces diverged ("TJOG" vs "T-JOG", "TEACH_IN_HANDLE" vs "TEACH-IN-HANDLE",
|
||||
/// and different unknown-code fallbacks). Resolved by Driver.FOCAS-010.
|
||||
/// </summary>
|
||||
public static string ToText(this FocasOperationMode mode) => mode switch
|
||||
{
|
||||
FocasOperationMode.Mdi => "MDI",
|
||||
FocasOperationMode.Auto => "AUTO",
|
||||
FocasOperationMode.TJog => "T-JOG",
|
||||
FocasOperationMode.Edit => "EDIT",
|
||||
FocasOperationMode.Handle => "HANDLE",
|
||||
FocasOperationMode.Jog => "JOG",
|
||||
FocasOperationMode.TeachInHandle => "TEACH-IN-HANDLE",
|
||||
FocasOperationMode.Reference => "REFERENCE",
|
||||
FocasOperationMode.Remote => "REMOTE",
|
||||
FocasOperationMode.Test => "TEST",
|
||||
_ => ((short)mode).ToString(),
|
||||
};
|
||||
public static string ToText(this FocasOperationMode mode) =>
|
||||
FocasOpMode.ToText((short)mode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user