diff --git a/csharp/App/SaliMax/src/Program.cs b/csharp/App/SaliMax/src/Program.cs index fe654c6db..821ec9f11 100644 --- a/csharp/App/SaliMax/src/Program.cs +++ b/csharp/App/SaliMax/src/Program.cs @@ -322,7 +322,7 @@ internal static class Program }); } - private static void ApplyDefaultSettings(this SystemControlRegisters? sc) + private static void ApplyDefaultSettingsAc(this SystemControlRegisters? sc) { if (sc is null) return; @@ -333,7 +333,7 @@ internal static class Program #if DEBUG sc.CommunicationTimeout = TimeSpan.FromMinutes(2); #else - sc.CommunicationTimeout = TimeSpan.FromSeconds(10); + sc.CommunicationTimeout = TimeSpan.FromSeconds(20); #endif sc.PowerSetPointActivation = PowerSetPointActivation.Immediate; @@ -342,38 +342,32 @@ internal static class Program sc.SubSlaveErrorHandling = SubSlaveErrorHandling.Off; sc.ResetAlarmsAndWarnings = true; } - - private static DcDcDevicesRecord ResetAlarms(this DcDcDevicesRecord dcDcStatus) + + private static void ApplyDefaultSettingsDc(this SystemControlRegisters? sc) { - var sc = dcDcStatus.SystemControl; + if (sc is null) + return; + + sc.SystemConfig = DcDcOnly; - if (sc is not null) - sc.ResetAlarmsAndWarnings = sc.Alarms.Any(); - - foreach (var d in dcDcStatus.Devices) - d.Control.ResetAlarmsAndWarnings = d.Status.Alarms.Any() || d.Status.Warnings.Any(); - - return dcDcStatus; - } - - private static AcDcDevicesRecord ResetAlarms(this AcDcDevicesRecord acDcRecord) - { - var sc = acDcRecord.SystemControl; - - if (sc is not null) - sc.ResetAlarmsAndWarnings = sc.Alarms.Any() || sc.Warnings.Any(); - - foreach (var d in acDcRecord.Devices) - d.Control.ResetAlarmsAndWarnings = d.Status.Alarms.Any() || d.Status.Warnings.Any(); - - return acDcRecord; +#if DEBUG + sc.CommunicationTimeout = TimeSpan.FromMinutes(2); +#else + sc.CommunicationTimeout = TimeSpan.FromSeconds(20); +#endif + + sc.PowerSetPointActivation = PowerSetPointActivation.Immediate; + sc.UseSlaveIdForAddressing = true; + sc.SlaveErrorHandling = SlaveErrorHandling.Relaxed; + sc.SubSlaveErrorHandling = SubSlaveErrorHandling.Off; + sc.ResetAlarmsAndWarnings = true; } private static async Task UploadCsv(StatusRecord status, UnixTime timeStamp) { timeStamp.WriteLine(); - var csv = status.ToCsv().WriteLine(); + var csv = status.ToCsv();//.WriteLine(); var s3Path = timeStamp + ".csv"; var request = S3Config.CreatePutRequest(s3Path); var response = await request.PutAsync(new StringContent(csv));