|
|
|
@ -2,6 +2,7 @@
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
#include <avr/wdt.h>
|
|
|
|
#include <avr/wdt.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
@ -89,6 +90,12 @@ void send_values(void){
|
|
|
|
|
|
|
|
|
|
|
|
itoa((250*60)/ICR5, msg, 10);
|
|
|
|
itoa((250*60)/ICR5, msg, 10);
|
|
|
|
mqtt_pub(&mqtt_client, "/Filamentanlage/05_Abzug/state/spule/speed", msg, strlen(msg));
|
|
|
|
mqtt_pub(&mqtt_client, "/Filamentanlage/05_Abzug/state/spule/speed", msg, strlen(msg));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sprintf(msg, "%d", windings);
|
|
|
|
|
|
|
|
mqtt_pub(&mqtt_client, "/Filamentanlage/05_Abzug/state/spule/windings", msg, strlen(msg));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sprintf(msg, "%ld", spule_trans_pos);
|
|
|
|
|
|
|
|
mqtt_pub(&mqtt_client, "/Filamentanlage/05_Abzug/state/spule/trans_pos", msg, strlen(msg));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// send settings wich only change on buttion press
|
|
|
|
// send settings wich only change on buttion press
|
|
|
|
@ -96,8 +103,6 @@ void send_settings(void){
|
|
|
|
//TODO only send on change or improve performance otherwise
|
|
|
|
//TODO only send on change or improve performance otherwise
|
|
|
|
char msg[10];
|
|
|
|
char msg[10];
|
|
|
|
|
|
|
|
|
|
|
|
//PORTH &= ~(1<<5);
|
|
|
|
|
|
|
|
//PORTH |= (1<<5);
|
|
|
|
|
|
|
|
/* Abzug */
|
|
|
|
/* Abzug */
|
|
|
|
sprintf(msg, "%d", abzug_speed);
|
|
|
|
sprintf(msg, "%d", abzug_speed);
|
|
|
|
mqtt_pub(&mqtt_client, "/Filamentanlage/05_Abzug/state/abzug/speed", msg, strlen(msg));
|
|
|
|
mqtt_pub(&mqtt_client, "/Filamentanlage/05_Abzug/state/abzug/speed", msg, strlen(msg));
|
|
|
|
@ -196,7 +201,7 @@ int main()
|
|
|
|
|
|
|
|
|
|
|
|
set_Output(LED_FEHLER, OFF);
|
|
|
|
set_Output(LED_FEHLER, OFF);
|
|
|
|
|
|
|
|
|
|
|
|
set_Output(BitPH5, ON);
|
|
|
|
set_Output(BitPH5, ON); //DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
#if PLC_MQTT_ENABLED
|
|
|
|
#if PLC_MQTT_ENABLED
|
|
|
|
send_settings();
|
|
|
|
send_settings();
|
|
|
|
@ -220,7 +225,7 @@ int main()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(millis() - timer_modbus_poll > 20){
|
|
|
|
if(millis() - timer_modbus_poll > 20){
|
|
|
|
do_kraftsensor();
|
|
|
|
do_kraftsensor(); // 8ms !!!
|
|
|
|
timer_modbus_poll += 20;
|
|
|
|
timer_modbus_poll += 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -228,7 +233,7 @@ int main()
|
|
|
|
// send misc info
|
|
|
|
// send misc info
|
|
|
|
if(millis() - timer_send_info > 200){
|
|
|
|
if(millis() - timer_send_info > 200){
|
|
|
|
timer_send_info += 200;
|
|
|
|
timer_send_info += 200;
|
|
|
|
send_values();
|
|
|
|
send_values(); // 10ms
|
|
|
|
//send_info(); // 27ms every 200ms
|
|
|
|
//send_info(); // 27ms every 200ms
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|