File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ public class Config
1010 public string LogLevel { get ; set ; } = "Information" ;
1111 public bool EnableCSVLogging { get ; set ; } = false ;
1212 public LHMConfigParameters LHMConfig { get ; set ; } = new LHMConfigParameters ( ) ;
13+ public bool DisableLHMReleaseOnSuspend { get ; set ; } = false ;
1314 public List < ControlConfig > Controls { get ; set ; } = [ ] ;
1415 public List < SensorConfig > Sensors { get ; set ; } = [ ] ;
1516}
Original file line number Diff line number Diff line change @@ -14,9 +14,11 @@ namespace CoolingControl.Platform.LHM;
1414public class LHMAdapter : IPlatformAdapter , IDisposable
1515{
1616 private readonly Computer _computer ;
17+ private readonly ConfigHelper _config ;
1718
1819 public LHMAdapter ( ConfigHelper config )
1920 {
21+ _config = config ;
2022 _computer = new Computer
2123 {
2224 IsCpuEnabled = config . Config . LHMConfig . CpuEnabled ,
@@ -34,14 +36,21 @@ public LHMAdapter(ConfigHelper config)
3436
3537 public void Suspend ( )
3638 {
37- Log . Debug ( "Suspending hardware monitoring" ) ;
38- _computer . Close ( ) ;
39+ if ( ! _config . Config . DisableLHMReleaseOnSuspend )
40+ {
41+ Log . Debug ( "Suspending hardware monitoring" ) ;
42+ _computer . Close ( ) ;
43+ }
3944 }
4045
4146 public void Resume ( )
4247 {
43- Log . Debug ( "Resuming hardware monitoring" ) ;
44- _computer . Open ( ) ;
48+ if ( ! _config . Config . DisableLHMReleaseOnSuspend )
49+ {
50+
51+ Log . Debug ( "Resuming hardware monitoring" ) ;
52+ _computer . Open ( ) ;
53+ }
4554 }
4655
4756 public Dictionary < string , float ? > GetSensorValues ( HashSet < string > sensorIdentifiers )
You can’t perform that action at this time.
0 commit comments