add prints
This commit is contained in:
15
main.c
15
main.c
@@ -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
|
||||||
|
|||||||
6
spule.c
6
spule.c
@@ -175,7 +175,8 @@ ISR(TIMER5_OVF_vect) {
|
|||||||
windings++;
|
windings++;
|
||||||
steps=0;
|
steps=0;
|
||||||
printf("windungen: %d\t", windings);
|
printf("windungen: %d\t", windings);
|
||||||
printf("trans pos: %ld\n", taenzer_state.pos);
|
printf("trans pos: %ld\n", spule_trans_pos);
|
||||||
|
printf("speed %d\n", ICR1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(windings == windings_wakeup){
|
if(windings == windings_wakeup){
|
||||||
@@ -190,6 +191,7 @@ ISR(TIMER5_OVF_vect) {
|
|||||||
OCR1A = ICR1/2;
|
OCR1A = ICR1/2;
|
||||||
set_Output(MOTOR_TRANS_DIR, TOGGLE);
|
set_Output(MOTOR_TRANS_DIR, TOGGLE);
|
||||||
printf("toggle at pos: %ld\n", spule_trans_pos);
|
printf("toggle at pos: %ld\n", spule_trans_pos);
|
||||||
|
printf("speed %d\n", ICR1);
|
||||||
}
|
}
|
||||||
if(windings_on_layer == 1 && steps == 0){
|
if(windings_on_layer == 1 && steps == 0){
|
||||||
trans_state = 2;
|
trans_state = 2;
|
||||||
@@ -200,12 +202,14 @@ ISR(TIMER5_OVF_vect) {
|
|||||||
trans_state = 3;
|
trans_state = 3;
|
||||||
TCCR1B |= _BV(CS11);
|
TCCR1B |= _BV(CS11);
|
||||||
printf("done\n");
|
printf("done\n");
|
||||||
|
printf("speed %d\n", ICR1);
|
||||||
}
|
}
|
||||||
if(windings_on_layer == 21 && steps == 0){
|
if(windings_on_layer == 21 && steps == 0){
|
||||||
trans_state = 4;
|
trans_state = 4;
|
||||||
ICR1 = 0.5*(ICR5/TRANS_ROT_FACTOR);
|
ICR1 = 0.5*(ICR5/TRANS_ROT_FACTOR);
|
||||||
OCR1A = ICR1/2;
|
OCR1A = ICR1/2;
|
||||||
printf("nachlauf abbauen\n");
|
printf("nachlauf abbauen\n");
|
||||||
|
printf("speed %d\n", ICR1);
|
||||||
}
|
}
|
||||||
//;PORTH |= (1<<5);
|
//;PORTH |= (1<<5);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user