|
|
|
|
@ -8,7 +8,7 @@
|
|
|
|
|
|
|
|
|
|
taenzer_state_t taenzer_state;
|
|
|
|
|
|
|
|
|
|
#define TAENZER KRAFT_SETPOINT 12000
|
|
|
|
|
#define TAENZER_KRAFT_SETPOINT 12000
|
|
|
|
|
#define TAENZER_KRAFT_HYST 2000
|
|
|
|
|
|
|
|
|
|
void do_taenzer(){
|
|
|
|
|
@ -26,7 +26,7 @@ void do_taenzer(){
|
|
|
|
|
|
|
|
|
|
/* Force regualtion */
|
|
|
|
|
if(kraftsensor_valid && taenzer_state.homed){
|
|
|
|
|
int16_t err = abs(kraftsensor_value - TAENZER KRAFT_SETPOINT);
|
|
|
|
|
int16_t err = abs(kraftsensor_value - TAENZER_KRAFT_SETPOINT);
|
|
|
|
|
|
|
|
|
|
if(err > 8000)
|
|
|
|
|
err=8000;
|
|
|
|
|
@ -34,11 +34,11 @@ void do_taenzer(){
|
|
|
|
|
ICR4 = 400000/err;
|
|
|
|
|
OCR4A = ICR4/2;
|
|
|
|
|
|
|
|
|
|
if(kraftsensor_value < TAENZER KRAFT_SETPOINT - (TAENZER_KRAFT_HYST/2)){
|
|
|
|
|
if(kraftsensor_value < TAENZER_KRAFT_SETPOINT - (TAENZER_KRAFT_HYST/2)){
|
|
|
|
|
set_Output(MOTOR_TAENZER_DIR, 0); // direction: down
|
|
|
|
|
TCCR4B |= _BV(CS41); //TURN ON
|
|
|
|
|
}
|
|
|
|
|
else if(kraftsensor_value > TAENZER KRAFT_SETPOINT + (TAENZER_KRAFT_HYST/2)){
|
|
|
|
|
else if(kraftsensor_value > TAENZER_KRAFT_SETPOINT + (TAENZER_KRAFT_HYST/2)){
|
|
|
|
|
set_Output(MOTOR_TAENZER_DIR, 1); // direction: up
|
|
|
|
|
TCCR4B |= _BV(CS41); //TURN ON
|
|
|
|
|
}
|
|
|
|
|
|