uncomment homing and send position
This commit is contained in:
		
							
								
								
									
										25
									
								
								taenzer.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								taenzer.c
									
									
									
									
									
								
							@@ -8,19 +8,20 @@ taenzer_state_t taenzer_state;
 | 
			
		||||
 | 
			
		||||
void do_taenzer(){
 | 
			
		||||
 | 
			
		||||
    ///* Homing */
 | 
			
		||||
    //if(!taenzer_state.homed){
 | 
			
		||||
    //    set_Output(MOTOR_TAENZER_DIR, 1); // direction: up
 | 
			
		||||
    //    TCCR4B |= _BV(CS41); //TURN ON
 | 
			
		||||
    //}
 | 
			
		||||
    //if(read_Input(IN_TAENZER_HOME, LEVEL)){
 | 
			
		||||
    //    TCCR4B &= ~_BV(CS41); //TURN OFF
 | 
			
		||||
    //    taenzer_state.homed = 1;
 | 
			
		||||
    //}
 | 
			
		||||
    /* Homing */
 | 
			
		||||
    if(!taenzer_state.homed){
 | 
			
		||||
        set_Output(MOTOR_TAENZER_DIR, 1); // direction: up
 | 
			
		||||
        TCCR4B |= _BV(CS41); //TURN ON
 | 
			
		||||
    }
 | 
			
		||||
    if(read_Input(IN_TAENZER_HOME, LEVEL)){
 | 
			
		||||
        TCCR4B &= ~_BV(CS41); //TURN OFF
 | 
			
		||||
        taenzer_state.homed = 1;
 | 
			
		||||
        taenzer_state.pos = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Force regualtion */
 | 
			
		||||
    if(kraftsensor_valid /* && taenzer_state.homed */){
 | 
			
		||||
        if(kraftsensor_value < 0){
 | 
			
		||||
    if(kraftsensor_valid && taenzer_state.homed){
 | 
			
		||||
        if(kraftsensor_value < 9000){
 | 
			
		||||
            set_Output(MOTOR_TAENZER_DIR, 0); // direction: down
 | 
			
		||||
            TCCR4B |= _BV(CS41); //TURN ON
 | 
			
		||||
        }
 | 
			
		||||
@@ -38,7 +39,7 @@ void timer4_init()
 | 
			
		||||
    TCCR4A |= (1<<COM4A1);
 | 
			
		||||
    TCCR4B |= _BV(WGM43);
 | 
			
		||||
 | 
			
		||||
//    TIMSK4 |= 1<<TOIE4;
 | 
			
		||||
    TIMSK4 |= 1<<TOIE4;
 | 
			
		||||
//    TIMSK4 |= 1<<OCIE4A;
 | 
			
		||||
 | 
			
		||||
    ICR4 = 100;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user