Compare commits

..

No commits in common. '59fa66e164ffaa0431035435a397aadbc988fb2a' and 'c861a8b58a3991024b38bea3de30627a4d231d97' have entirely different histories.

@ -13,8 +13,6 @@ volatile uint16_t windings_wakeup = 0;
int32_t spule_trans_pos = 0;
uint8_t spule_trans_homed = 0;
#define TRANS_ROT_FACTOR 0.07
void timer1_init()
{
TCCR1A |= (1<<COM1A1);
@ -24,6 +22,7 @@ void timer1_init()
OCR1A = 50;
DDRB |= 1 << 5;
TIMSK1 |= 1<<TOIE1;
}
@ -48,7 +47,7 @@ void do_spule(){
TCCR1B &= ~(_BV(CS11));
set_Output(MOTOR_TRANS_DIR, 0); // direction: back
ICR1 = ICR5/TRANS_ROT_FACTOR;
ICR1 = ICR5/0.7;
OCR1A = ICR1/2;
}
@ -91,8 +90,7 @@ void do_spule(){
}
ISR(TIMER1_OVF_vect) {
//if(ioHelperReadBit(outStates, MOTOR_TRANS_DIR)){
if(PORTB & (1<<6)){
if(ioHelperReadBit(outStates, MOTOR_TRANS_DIR)){
spule_trans_pos -= 1;
}
else{
@ -114,24 +112,22 @@ ISR(TIMER5_OVF_vect) {
TIMSK1 |= 1<<TOIE1;
}
uint8_t windings_on_layer = windings % 25;
if(windings_on_layer == 0 && steps == 0){
ICR1 = ICR5/TRANS_ROT_FACTOR;
if(windings % 25 == 0 && steps == 0){
ICR1 = ICR5/0.7;
OCR1A = ICR1/2;
set_Output(MOTOR_TRANS_DIR, TOGGLE);
printf("toggle at pos: %ld\n", spule_trans_pos);
printf("toggle\n");
}
if(windings_on_layer == 1 && steps == 0){
printf("nachlauf aufbauen\n");
if(windings % 25 == 1 && steps == 0){
printf("nachlauf aufbauen ---");
TCCR1B &= ~(_BV(CS11));
}
if(windings_on_layer == 3 && steps == 0){
if(windings % 25 == 3 && steps == 0){
TCCR1B |= _BV(CS11);
printf("done\n");
}
if(windings_on_layer == 21 && steps == 0){
ICR1 = 0.5*(ICR5/TRANS_ROT_FACTOR);
if(windings % 25 == 21 && steps == 0){
ICR1 = 0.5*(ICR5/0.7);
OCR1A = ICR1/2;
printf("nachlauf abbauen\n");
}