Compare commits

...

2 Commits

Author SHA1 Message Date
fa0562e4ea increase to 10Hz poll rate 2022-02-25 15:56:43 +01:00
71dcd107a2 disable prints for petter performance 2022-02-25 15:55:45 +01:00
2 changed files with 6 additions and 6 deletions

4
main.c
View File

@@ -181,9 +181,9 @@ int main()
timer_blink_outs = millis();
}
if(millis() - timer_modbus_poll > 200){
timer_modbus_poll += 200;
if(millis() - timer_modbus_poll > 100){
do_kraftsensor();
timer_modbus_poll += 100;
}
#if PLC_MQTT_ENABLED

8
mqtt.c
View File

@@ -22,7 +22,7 @@ void messageArrived(MessageData* md)
MQTTString* topic = md->topicName;
strncpy(_topic_name, topic->lenstring.data, topic->lenstring.len);
strncpy(_message, message->payload, message->payloadlen);
printf("<<MQTT Sub: [%s] %s", _topic_name , _message);
//printf("<<MQTT Sub: [%s] %s", _topic_name , _message);
//md->topicName->
/*
@@ -39,7 +39,7 @@ void mqtt_pub(Client* mqtt_client, char * mqtt_topic, char * mqtt_msg, int mqtt_
static uint8_t mqtt_err_cnt = 0;
int32_t mqtt_rc;
printf(">>MQTT pub msg nr%lu ", ++mqtt_pub_count);
//printf(">>MQTT pub msg nr%lu ", ++mqtt_pub_count);
MQTTMessage pubMessage;
pubMessage.qos = QOS0;
pubMessage.id = mes_id++;
@@ -50,11 +50,11 @@ void mqtt_pub(Client* mqtt_client, char * mqtt_topic, char * mqtt_msg, int mqtt_
if (mqtt_rc == SUCCESSS)
{
mqtt_err_cnt = 0;
printf(" - OK\r\n");
//printf(" - OK\r\n");
}
else
{
printf(" - ERROR\r\n");
printf("mqtt pub - ERROR\r\n");
//Reboot device after 20 continuous errors (~ 20sec)
while(1);
//if(mqtt_err_cnt++ > 20)