File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -510,7 +510,7 @@ where
510510 // Enable IDPM.
511511 self . modify ( i2c, REG_CHARGE_OPTION_0_LO , |v| v | ( 1 << 1 ) ) ?;
512512
513- if self . chrg_ok {
513+ if self . chrg_ok && limit . max_input_current_ma > 0 {
514514 defmt:: trace!( "Programming maximum input current {} mA" , limit. max_input_current_ma) ;
515515
516516 // Enable or disable ICO.
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ impl Max14636 {
6565 !chg_al_n_low,
6666 !chg_det_low
6767 ) ;
68- PowerSupply :: Unknown
68+ PowerSupply :: Disconnected
6969 }
7070 }
7171 }
Original file line number Diff line number Diff line change @@ -72,7 +72,11 @@ pub enum PowerSupply {
7272impl PowerSupply {
7373 /// Merge two power supply reports, returning the best available power.
7474 pub fn merge ( & self , other : & Self ) -> Self {
75- self . max ( other) . clone ( )
75+ if * self == Self :: Disconnected || * other == Self :: Disconnected {
76+ Self :: Disconnected
77+ } else {
78+ self . max ( other) . clone ( )
79+ }
7680 }
7781
7882 /// Whether the power supply state is unknown.
You can’t perform that action at this time.
0 commit comments