Skip to content

Commit

Permalink
Ignores disable
Browse files Browse the repository at this point in the history
  • Loading branch information
bdring committed Apr 16, 2022
1 parent bc2a117 commit 3f52ca4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion FluidNC/src/Motors/RcServo.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace MotorDrivers {
void init() override;
void read_settings() override;
bool set_homing_mode(bool isHoming) override;
void set_disable(bool disable) override;
virtual void set_disable(bool disable) override;

This comment has been minimized.

Copy link
@MitchBradley

MitchBradley Apr 16, 2022

Collaborator

I think the addition of virtual here is unnecessary and, strictly speaking, incorrect. Solenoid derives from RcServo .. Servo .. MotorDriver. set_disable is virtual in MotorDriver, thereby establishing the abstract interface for any MotorDriver subclass. I tried compiling this patch without the "virtual" here and it worked.

void update() override;

void _write_pwm(uint32_t duty);
Expand Down
6 changes: 3 additions & 3 deletions FluidNC/src/Motors/Solenoid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ namespace MotorDrivers {
_pwm_chan_num = ledcInit(_output_pin, -1, double(_pwm_freq), SERVO_PWM_RESOLUTION_BITS); // Allocate a channel
_current_pwm_duty = 0;

_disabled = true;

startUpdateTask(_update_rate_ms);
}

Expand All @@ -80,7 +78,7 @@ namespace MotorDrivers {
void Solenoid::set_location() {
bool is_solenoid_on;

if (_disabled || _has_errors) {
if (_has_errors) {
return;
}

Expand Down Expand Up @@ -120,6 +118,8 @@ namespace MotorDrivers {
_write_pwm(pwm_cnt[_current_mode]);
}

void Solenoid::set_disable(bool disable) {} // NOP

namespace {
MotorFactory::InstanceBuilder<Solenoid> registration("solenoid");
}
Expand Down
1 change: 1 addition & 0 deletions FluidNC/src/Motors/Solenoid.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace MotorDrivers {

void set_location();
void init() override;
void set_disable(bool disable) override;

float _transition_point;

Expand Down

0 comments on commit 3f52ca4

Please sign in to comment.