increse control var to 32bit, decrease Hysteresis
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#define TAENZER_KRAFT_SETPOINT 12000
|
||||
#define TAENZER_KRAFT_HYST 1000
|
||||
#define TAENZER_KRAFT_HYST 500
|
||||
|
||||
|
||||
taenzer_state_t taenzer_state;
|
||||
@@ -84,7 +84,7 @@ void do_taenzer(){
|
||||
int32_t err = (kraftsensor_value - taenzer_state.force_setpoint);
|
||||
|
||||
double pid_out = pid(®ler, err);
|
||||
int16_t out = (int16_t)pid_out;
|
||||
int32_t out = (int32_t)pid_out;
|
||||
|
||||
ICR4 = 400000/abs(out);
|
||||
OCR4A = ICR4/2;
|
||||
@@ -98,12 +98,15 @@ void do_taenzer(){
|
||||
set_Output(MOTOR_TAENZER_DIR, 1); // direction: up
|
||||
TCCR4B |= _BV(CS41); //TURN ON
|
||||
}
|
||||
else
|
||||
else{
|
||||
TCCR4B &= ~_BV(CS41); //TURN OFF
|
||||
}
|
||||
}
|
||||
else
|
||||
TCCR4B &= ~_BV(CS41); //TURN OFF
|
||||
}
|
||||
//else
|
||||
// TCCR4B &= ~_BV(CS41); //TURN OFF
|
||||
}
|
||||
|
||||
void timer4_init()
|
||||
|
||||
Reference in New Issue
Block a user