Compare commits
2 Commits
c4181a27e2
...
76f3fd1d5a
| Author | SHA1 | Date | |
|---|---|---|---|
| 76f3fd1d5a | |||
| 721689c525 |
30
spule.c
30
spule.c
@@ -1,8 +1,12 @@
|
|||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "avrIOhelper/io-helper.h"
|
#include "avrIOhelper/io-helper.h"
|
||||||
|
|
||||||
|
#include "taenzer.h"
|
||||||
|
#include "abzug.h"
|
||||||
|
|
||||||
|
|
||||||
int32_t spule_trans_pos = 0;
|
int32_t spule_trans_pos = 0;
|
||||||
uint8_t spule_trans_homed = 0;
|
uint8_t spule_trans_homed = 0;
|
||||||
@@ -46,10 +50,20 @@ void do_spule(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!spule_trans_homed){
|
if(!spule_trans_homed){
|
||||||
|
ICR1 = 100;
|
||||||
|
OCR1A = 50;
|
||||||
set_Output(MOTOR_TRANS_DIR, 1); // direction: front
|
set_Output(MOTOR_TRANS_DIR, 1); // direction: front
|
||||||
TCCR1B |= _BV(CS11); //TURN ON
|
TCCR1B |= _BV(CS11); //TURN ON
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
/* speed regulation - keep taenzer at 10% */
|
||||||
|
int32_t tmp = (100 - (int32_t)taenzer_state.pos/1000)*10;
|
||||||
|
ICR5=75000/abzug_speed + tmp;
|
||||||
|
OCR5C = ICR5/2;
|
||||||
|
|
||||||
|
ICR1 = ICR5/0.7;
|
||||||
|
OCR1A = ICR1/2;
|
||||||
|
|
||||||
if (read_Input(BTN_WICKELN_EIN, RISING)) {
|
if (read_Input(BTN_WICKELN_EIN, RISING)) {
|
||||||
TCCR5B |= _BV(CS51); //TURN ON
|
TCCR5B |= _BV(CS51); //TURN ON
|
||||||
TCCR1B |= _BV(CS11); //TURN ON
|
TCCR1B |= _BV(CS11); //TURN ON
|
||||||
@@ -58,25 +72,9 @@ void do_spule(){
|
|||||||
TCCR5B &= ~(_BV(CS51));
|
TCCR5B &= ~(_BV(CS51));
|
||||||
TCCR1B &= ~(_BV(CS11));
|
TCCR1B &= ~(_BV(CS11));
|
||||||
}
|
}
|
||||||
if (read_Input(BTN_TAENZER_START, RISING)) {
|
|
||||||
ICR5-=15;
|
|
||||||
OCR5C = ICR5/2;
|
|
||||||
|
|
||||||
ICR1 = ICR5/0.7;
|
|
||||||
OCR1A = ICR1/2;
|
|
||||||
}
|
|
||||||
if (read_Input(BTN_SPULENWECHSEL, RISING)) {
|
|
||||||
ICR5+=15;
|
|
||||||
OCR5C = ICR5/2;
|
|
||||||
|
|
||||||
ICR1 = ICR5/0.7;
|
|
||||||
OCR1A = ICR1/2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (read_Input(BTN_INIT, RISING)) {
|
if (read_Input(BTN_INIT, RISING)) {
|
||||||
spule_trans_homed = 0;
|
spule_trans_homed = 0;
|
||||||
ICR1 = 100;
|
|
||||||
OCR1A = 50;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user