Settings-Datei lesen fertig

This commit is contained in:
Bernhard
2026-01-20 20:11:36 +01:00
parent 874ebf51ba
commit 281e70d91e
6 changed files with 90 additions and 19 deletions

View File

@@ -55,7 +55,7 @@ void my_message_callback(struct mosquitto *mosq, void *userdata, const struct mo
int val = 9999;
if (sscanf(topic_value, "%d", &val))
{
mylog(LOG_INFO, "MQTT: Received value for mqtt_topic_motor1_gear: %d", val);
mylog(LOG_DEBUG, "MQTT: Received value for mqtt_topic_motor1_gear: %d", val);
iMqttMotor1Gear = val;
Can_SetMotorGear(0, val);
}
@@ -69,7 +69,7 @@ void my_message_callback(struct mosquitto *mosq, void *userdata, const struct mo
int val = 9999;
if (sscanf(topic_value, "%d", &val))
{
mylog(LOG_INFO, "MQTT: Received value for mqtt_topic_motor1_power: %d", val);
mylog(LOG_DEBUG, "MQTT: Received value for mqtt_topic_motor1_power: %d", val);
iMqttMotor1Power = val;
Can_SetMotorPower(0, val);
}
@@ -83,7 +83,7 @@ void my_message_callback(struct mosquitto *mosq, void *userdata, const struct mo
int val = 9999;
if (sscanf(topic_value, "%d", &val))
{
mylog(LOG_INFO, "MQTT: Received value for mqtt_topic_motor2_gear: %d", val);
mylog(LOG_DEBUG, "MQTT: Received value for mqtt_topic_motor2_gear: %d", val);
iMqttMotor2Gear = val;
Can_SetMotorGear(1, val);
}
@@ -97,7 +97,7 @@ void my_message_callback(struct mosquitto *mosq, void *userdata, const struct mo
int val = 9999;
if (sscanf(topic_value, "%d", &val))
{
mylog(LOG_INFO, "MQTT: Received value for mqtt_topic_motor2_power: %d", val);
mylog(LOG_DEBUG, "MQTT: Received value for mqtt_topic_motor2_power: %d", val);
iMqttMotor2Power = val;
Can_SetMotorPower(1, val);
}
@@ -152,7 +152,7 @@ int MqttClient_Connect()
{
/* Wenn wir Verbindungsfehler hatten, dann befinden wir uns wohl in Boot-Prozess und der Mosquitto ist
gerade erst gestartet. Wir müssen hier etwas warten, sonst funktioniert das Subscriben nicht */
sleep(10);
sleep(500);
}
// publish all topics we want to subscribe
@@ -226,7 +226,7 @@ int MqttClient_Connect()
iMqttMotor2ActualPowerW = -1;
MqttClient_Publish_MotorActualPowerW(1, 0);
mylog(LOG_INFO, "MQTT: Connected successfull!");
mylog(LOG_INFO, "MQTT: Connected successfull after %d errors!", iHadConnectError);
return 0;
}