File tree Expand file tree Collapse file tree
OpenHardwareMonitorLib/Hardware/Battery Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ public Battery
139139
140140 public float ? Voltage => _voltage . Value ;
141141
142+ private void ActivateSensorIfValueNotNull ( ISensor sensor )
143+ {
144+ if ( sensor . Value != null )
145+ ActivateSensor ( sensor ) ;
146+ else
147+ DeactivateSensor ( sensor ) ;
148+ }
149+
142150 public override void Update ( )
143151 {
144152 Kernel32 . BATTERY_WAIT_STATUS bws = default ;
@@ -262,6 +270,15 @@ public override void Update()
262270 {
263271 _cycleCount . Value = null ;
264272 }
273+
274+ ActivateSensorIfValueNotNull ( _remainingCapacity ) ;
275+ ActivateSensorIfValueNotNull ( _chargeLevel ) ;
276+ ActivateSensorIfValueNotNull ( _voltage ) ;
277+ ActivateSensorIfValueNotNull ( _chargeDischargeCurrent ) ;
278+ ActivateSensorIfValueNotNull ( _chargeDischargeRate ) ;
279+ ActivateSensorIfValueNotNull ( _remainingTime ) ;
280+ ActivateSensorIfValueNotNull ( _temperature ) ;
281+ ActivateSensorIfValueNotNull ( _cycleCount ) ;
265282 }
266283
267284 public override void Close ( )
You can’t perform that action at this time.
0 commit comments