Skip to content

Commit 62534c2

Browse files
committed
optimized the enable_active_high setting for enable/disable
1 parent 8ecc1b6 commit 62534c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/drivers/BLDCDriver6PWM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ BLDCDriver6PWM::BLDCDriver6PWM(int phA_h,int phA_l,int phB_h,int phB_l,int phC_h
2424
// enable motor driver
2525
void BLDCDriver6PWM::enable(){
2626
// enable_pin the driver - if enable_pin pin available
27-
if ( _isset(enable_pin) ) digitalWrite(enable_pin, enable_active_high?HIGH:LOW);
27+
if ( _isset(enable_pin) ) digitalWrite(enable_pin, enable_active_high);
2828
// set zero to PWM
2929
setPwm(0, 0, 0);
3030
}
@@ -35,7 +35,7 @@ void BLDCDriver6PWM::disable()
3535
// set zero to PWM
3636
setPwm(0, 0, 0);
3737
// disable the driver - if enable_pin pin available
38-
if ( _isset(enable_pin) ) digitalWrite(enable_pin, enable_active_high?LOW:HIGH);
38+
if ( _isset(enable_pin) ) digitalWrite(enable_pin, !enable_active_high);
3939

4040
}
4141

0 commit comments

Comments
 (0)