only:alphax-8chan

This commit is contained in:
rusefillc 2023-03-27 11:00:01 -04:00
parent d77ca5da5e
commit a61f39fa5f
4 changed files with 10 additions and 5 deletions

View File

@ -15,6 +15,7 @@
brain_pin_e pinEnable,
brain_pin_e pinDir1,
brain_pin_e pinDir2,
const char *disPinMsg,
brain_pin_e pinDisable,
bool isInverted,
ExecutorInterface* executor,
@ -88,7 +89,7 @@ DcHardware *getdcHardware() {
return &dcHardware[0];
}
DcMotor* initDcMotor(const dc_io& io, size_t index, bool useTwoWires) {
DcMotor* initDcMotor(const char *disPinMsg,const dc_io& io, size_t index, bool useTwoWires) {
auto& hw = dcHardware[index];
hw.start(
@ -96,6 +97,7 @@ DcMotor* initDcMotor(const dc_io& io, size_t index, bool useTwoWires) {
io.controlPin,
io.directionPin1,
io.directionPin2,
disPinMsg,
io.disablePin,
// todo You would not believe how you invert TLE9201 #4579
engineConfiguration->stepperDcInvertedPins,
@ -114,6 +116,7 @@ DcMotor* initDcMotor(brain_pin_e coil_p, brain_pin_e coil_m, size_t index) {
Gpio::Unassigned, /* pinEnable */
coil_p,
coil_m,
nullptr,
Gpio::Unassigned, /* pinDisable */
engineConfiguration->stepperDcInvertedPins,
&engine->executor,

View File

@ -11,7 +11,7 @@
#include <cstddef>
DcMotor* initDcMotor(const dc_io& io, size_t index, bool useTwoWires);
DcMotor* initDcMotor(const char *disPinMsg, const dc_io& io, size_t index, bool useTwoWires);
DcMotor* initDcMotor(brain_pin_e coil_p, brain_pin_e coil_m, size_t index);
// Manual control of motors for use by console commands
@ -54,6 +54,7 @@ public:
brain_pin_e pinEnable,
brain_pin_e pinDir1,
brain_pin_e pinDir2,
const char *disPinMsg,
brain_pin_e pinDisable,
bool isInverted,
ExecutorInterface* executor,

View File

@ -1039,7 +1039,8 @@ void doInitElectronicThrottle() {
// do not touch HW pins if function not selected, this way Lua can use DC motor hardware pins directly
continue;
}
auto motor = initDcMotor(engineConfiguration->etbIo[i], i, engineConfiguration->etb_use_two_wires);
auto motor = initDcMotor("ETB disable",
engineConfiguration->etbIo[i], i, engineConfiguration->etb_use_two_wires);
auto controller = engine->etbControllers[i];
if (!controller) {

View File

@ -115,9 +115,9 @@ void initIdleHardware() {
hw = &iacHbridgeHw;
} else if (engineConfiguration->useHbridgesToDriveIdleStepper) {
auto motorA = initDcMotor(engineConfiguration->stepperDcIo[0],
auto motorA = initDcMotor("DC dis-1", engineConfiguration->stepperDcIo[0],
ETB_COUNT + 0, engineConfiguration->stepper_dc_use_two_wires);
auto motorB = initDcMotor(engineConfiguration->stepperDcIo[1],
auto motorB = initDcMotor("DC dis-2", engineConfiguration->stepperDcIo[1],
ETB_COUNT + 1, engineConfiguration->stepper_dc_use_two_wires);
iacHbridgeHw.initialize(