diff --git a/spule.c b/spule.c index 560b747..3d99117 100644 --- a/spule.c +++ b/spule.c @@ -50,6 +50,14 @@ static void spule_onoff(uint8_t state){ } } +void set_spooling_speed(uint16_t speed){ + ICR5=speed; + OCR5C = ICR5/2; + + ICR1 = ICR5/TRANS_ROT_FACTOR; + OCR1A = ICR1/2; +} + void do_spule(){ //PORTH &= ~(1<<5); if(read_Input(IN_SPULE_HOME, LEVEL) && spule_trans_homed == 0){ @@ -69,8 +77,13 @@ void do_spule(){ set_Output(MOTOR_TRANS_DIR, 1); // direction: front TCCR1B |= _BV(CS11); //TURN ON } - else if(taenzer_state.pos <= 10){ - spule_onoff(0); + else if(!get_abzug_state()){ + if(read_Input(BTN_WICKELN_EIN, LEVEL)){ + set_spooling_speed(300); + spule_onoff(1); + } + else + spule_onoff(0); } else{ /* speed regulation - keep taenzer at 10% */