move TICK_TIME to config.h, add TICK_TIME_MS
This commit is contained in:
parent
2b1fbe38db
commit
cb4e157d62
|
|
@ -341,6 +341,12 @@ struct {
|
|||
*/
|
||||
#define STEP_INTERRUPT_INTERRUPTIBLE 1
|
||||
|
||||
/*
|
||||
how often we overflow and update our clock; with F_CPU=16MHz, max is < 4.096ms (TICK_TIME = 65535)
|
||||
*/
|
||||
#define TICK_TIME 2 MS
|
||||
#define TICK_TIME_MS (TICK_TIME / (F_CPU / 1000))
|
||||
|
||||
/*
|
||||
temperature history count. This is how many temperature readings to keep in order to calculate derivative in PID loop
|
||||
higher values make PID derivative term more stable at the expense of reaction time
|
||||
|
|
|
|||
5
timer.c
5
timer.c
|
|
@ -11,9 +11,6 @@ uint8_t clock_counter_250ms = 0;
|
|||
uint8_t clock_counter_1s = 0;
|
||||
volatile uint8_t clock_flag = 0;
|
||||
|
||||
// how often we overflow and update our clock; with F_CPU=16MHz, max is < 4.096ms (TICK_TIME = 65535)
|
||||
#define TICK_TIME 2 MS
|
||||
|
||||
// timer overflow, happens every TICK_TIME
|
||||
ISR(TIMER1_CAPT_vect) {
|
||||
/*
|
||||
|
|
@ -29,7 +26,7 @@ ISR(TIMER1_CAPT_vect) {
|
|||
/*
|
||||
clock stuff
|
||||
*/
|
||||
clock_counter_10ms += (TICK_TIME / (F_CPU / 1000));
|
||||
clock_counter_10ms += TICK_TIME_MS;
|
||||
if (clock_counter_10ms >= 10) {
|
||||
clock_counter_10ms -= 10;
|
||||
clock_flag |= CLOCK_FLAG_10MS;
|
||||
|
|
|
|||
Loading…
Reference in New Issue