MQTT-Handling optimiert
This commit is contained in:
@@ -140,7 +140,6 @@ void Can_SetMotorGear(int iMotorIndex, int iGear)
|
||||
{
|
||||
if (motctrl[iMotorIndex].iMotorGear != MOTOR_GEAR_FORWARD)
|
||||
{
|
||||
MqttClient_Publish_MotorGear(iMotorIndex, iGear);
|
||||
motctrl[iMotorIndex].iMotorGear = MOTOR_GEAR_FORWARD;
|
||||
// motor is switched to forward -> set min. power
|
||||
Can_SetMotorPower(iMotorIndex, 1);
|
||||
@@ -152,7 +151,6 @@ void Can_SetMotorGear(int iMotorIndex, int iGear)
|
||||
{
|
||||
if (motctrl[iMotorIndex].iMotorGear != MOTOR_GEAR_REVERSE)
|
||||
{
|
||||
MqttClient_Publish_MotorGear(iMotorIndex, iGear);
|
||||
motctrl[iMotorIndex].iMotorGear = MOTOR_GEAR_REVERSE;
|
||||
// motor is switched to reverse -> set min. power
|
||||
Can_SetMotorPower(iMotorIndex, 1);
|
||||
@@ -164,7 +162,6 @@ void Can_SetMotorGear(int iMotorIndex, int iGear)
|
||||
{
|
||||
if (motctrl[iMotorIndex].iMotorGear != MOTOR_GEAR_NEUTRAL)
|
||||
{
|
||||
MqttClient_Publish_MotorGear(iMotorIndex, iGear);
|
||||
motctrl[iMotorIndex].iMotorGear = MOTOR_GEAR_NEUTRAL;
|
||||
}
|
||||
// motor is switch to neutral -> set power to 0
|
||||
@@ -172,6 +169,7 @@ void Can_SetMotorGear(int iMotorIndex, int iGear)
|
||||
WriteOutputPin(GPIO_LED_MOTRUN, LOW);
|
||||
mylog(LOG_INFO, "CAN: Motor[%d]: Set gear neutral.", iMotorIndex);
|
||||
}
|
||||
MqttClient_Publish_MotorGear(iMotorIndex, iGear);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user