Skip to content

Commit 20a6a33

Browse files
authored
Merge pull request #37 from nutdotnet/35-interval
Correct Interval/Delay value
2 parents a3f55db + 993d200 commit 20a6a33

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

WinNUT_V2/WinNUT-Client/Pref_Gui.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Public Class Pref_Gui
246246
LogFile.LogTracing(String.Format("Check that the value of {0} for {1} is correct.", sender.Text, sender.Name), LogLvl.LOG_DEBUG, Me)
247247
Select Case sender.Name
248248
Case "Tb_Delay_Com"
249-
MinValue = 0
249+
MinValue = 1
250250
MaxValue = 60
251251
Case "Tb_Port"
252252
MinValue = 1

WinNUT_V2/WinNUT-Client/WinNUT.vb

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -845,25 +845,11 @@ Public Class WinNUT
845845
LogFile.DeleteLogFile()
846846
End If
847847

848-
'Dim NeedReconnect As Boolean = False
849-
850-
'With UPS_Device.Nut_Config
851-
' If .AutoReconnect <> Arr_Reg_Key.Item("autoreconnect") Or
852-
' .Host <> Arr_Reg_Key.Item("ServerAddress") Or
853-
' .Port <> Arr_Reg_Key.Item("Port") Or
854-
' .UPSName <> Arr_Reg_Key.Item("UPSName") Or
855-
' UPS_Device.PollingInterval <> Arr_Reg_Key.Item("Delay") Or
856-
' .Login <> Arr_Reg_Key.Item("NutLogin") Or
857-
' UPS_Device.NutPassword <> Arr_Reg_Key.Item("NutPassword") Then
858-
' NeedReconnect = True
859-
' UPS_Device.NutPassword = Arr_Reg_Key.Item("NutPassword")
860-
' End If
861-
' If UPS_Device.UPS_Follow_FSD <> Arr_Reg_Key.Item("Follow_FSD") Then
862-
' UPS_Device.UPS_Follow_FSD = Arr_Reg_Key.Item("Follow_FSD")
863-
' End If
864-
' UPS_Device.Battery_Limit = Arr_Reg_Key.Item("ShutdownLimitBatteryCharge")
865-
' UPS_Device.Backup_Limit = Arr_Reg_Key.Item("ShutdownLimitUPSRemainTime")
866-
'End With
848+
' Validate interval value because it's been incorrectly stored in older versions.
849+
If Arr_Reg_Key.Item("Delay") <= 0 Then
850+
LogFile.LogTracing("Incorrect value of " & Arr_Reg_Key.Item("Delay") & " for Delay/Interval, resetting to default.", LogLvl.LOG_ERROR, Me)
851+
Arr_Reg_Key.Item("Delay") = 1000
852+
End If
867853

868854
' Automatically reconnect if already connected and prefs are changed.
869855
If (UPS_Device IsNot Nothing) AndAlso UPS_Device.IsConnected And isChanged Then

0 commit comments

Comments
 (0)