h-bridge wastegate not alive on bench #4965

life is sad when debugger is broken
This commit is contained in:
rusefillc 2023-01-17 13:46:54 -05:00
parent 64ecfd26ca
commit 1be06f8d08
4 changed files with 19 additions and 8 deletions

View File

@ -49,6 +49,10 @@ public:
m_pwm2.setFrequency(frequency);
}
const char *msg() {
return dcMotor.msg;
}
void stop() {
// todo: replace 'isStarted' with 'stop'
}
@ -174,5 +178,9 @@ void showDcMotorInfo(int i) {
DcHardware *dc = &dcHardware[i];
efiPrintf(" motor: dir=%d DC=%f", dc->dcMotor.isOpenDirection(), dc->dcMotor.get());
const char *disableMsg = dc->msg();
if (disableMsg != nullptr) {
efiPrintf("disabled [%s]", disableMsg);
}
}

View File

@ -555,7 +555,7 @@ void EtbController::setOutput(expected<percent_t> outputValue) {
m_motor->set(ETB_PERCENT_TO_DUTY(outputValue.Value));
} else {
// Otherwise disable the motor.
m_motor->disable();
m_motor->disable("setOutput");
}
}
@ -645,7 +645,7 @@ void EtbController::update() {
if (!isOk) {
// If engine is stopped and so configured, skip the ETB update entirely
// This is quieter and pulls less power than leaving it on all the time
m_motor->disable();
m_motor->disable("etb status");
return;
}
@ -746,7 +746,7 @@ struct EtbImpl final : public TBase {
float secondaryMin = Sensor::getRaw(functionToTpsSensorSecondary(myFunction));
// Finally disable and reset state
motor->disable();
motor->disable("autotune");
// Check that the calibrate actually moved the throttle
if (absF(primaryMax - primaryMin) < 0.5f) {

View File

@ -13,7 +13,7 @@
TwoPinDcMotor::TwoPinDcMotor(OutputPin& disablePin)
: m_disable(&disablePin)
{
disable();
disable("init");
}
void TwoPinDcMotor::configure(IPwm& enable, IPwm& dir1, IPwm& dir2, bool isInverted) {
@ -27,13 +27,14 @@ void TwoPinDcMotor::enable() {
if (m_disable) {
m_disable->setValue(false);
}
msg = nullptr;
}
void TwoPinDcMotor::disable() {
void TwoPinDcMotor::disable(const char *msg) {
if (m_disable) {
m_disable->setValue(true);
}
this->msg = msg;
// Also set the duty to zero
set(0);
}

View File

@ -32,10 +32,12 @@ public:
*/
virtual float get() const = 0;
virtual void disable() = 0;
virtual void disable(const char *msg) = 0;
virtual void enable() = 0;
virtual bool isOpenDirection() const = 0;
const char *msg = nullptr;
};
struct IPwm;
@ -94,7 +96,7 @@ public:
bool isOpenDirection() const override;
void enable() override;
void disable() override;
void disable(const char *msg) override;
void setType(ControlType type) { m_type = type; }
};