Alles wieder hinzufügen???

This commit is contained in:
Bernhard
2025-12-17 19:35:30 +01:00
parent 555aa89479
commit c16ac482bd

10
io/io.c
View File

@@ -9,6 +9,8 @@ struct GPIO_KEY_DATA gpioKeyPwrDown;
char nInitialized = 0; char nInitialized = 0;
/// @brief Initialize the io pins
/// @return
int IO_Init() int IO_Init()
{ {
if (wiringPiSetupPinType(WPI_PIN_BCM)) if (wiringPiSetupPinType(WPI_PIN_BCM))
@@ -193,13 +195,13 @@ void IO_DoCyclic()
// plus key is pressed -> increase power // plus key is pressed -> increase power
if (motctrl[0].iMotorGear == MOTOR_GEAR_NEUTRAL) if (motctrl[0].iMotorGear == MOTOR_GEAR_NEUTRAL)
{ {
mylog(LOG_INFO, "KEY-Plus: Start motor."); mylog(LOG_INFO, "IO: KEY-Plus: Start motor.");
Can_SetMotorGear(0, 1); Can_SetMotorGear(0, 1);
Can_SetMotorPower(0, MOTOR_PWR_MIN_PCT); Can_SetMotorPower(0, MOTOR_PWR_MIN_PCT);
} }
else else
{ {
mylog(LOG_INFO, "KEY-Plus: Increase power."); mylog(LOG_INFO, "IO: KEY-Plus: Increase power.");
Can_SetMotorPower(0, motctrl[0].iMotorPowerPct + MOTOR_PWR_STEP); Can_SetMotorPower(0, motctrl[0].iMotorPowerPct + MOTOR_PWR_STEP);
} }
} }
@@ -209,12 +211,12 @@ void IO_DoCyclic()
// minus key is pressed -> decrease power // minus key is pressed -> decrease power
if (motctrl[0].iMotorPowerPct > MOTOR_PWR_MIN_PCT) if (motctrl[0].iMotorPowerPct > MOTOR_PWR_MIN_PCT)
{ {
mylog(LOG_INFO, "KEY-Minus: Decrease power."); mylog(LOG_INFO, "IO: KEY-Minus: Decrease power.");
Can_SetMotorPower(0, motctrl[0].iMotorPowerPct - MOTOR_PWR_STEP); Can_SetMotorPower(0, motctrl[0].iMotorPowerPct - MOTOR_PWR_STEP);
} }
else else
{ {
mylog(LOG_INFO, "KEY-Minus: Stop motor."); mylog(LOG_INFO, "IO: KEY-Minus: Stop motor.");
Can_SetMotorGear(0, 0); Can_SetMotorGear(0, 0);
} }
} }