Commit 1abf4bfc authored by mattdr's avatar mattdr
Browse files

some changes from awhile ago

parent cfdcede9
......@@ -38,7 +38,7 @@ int button_offset_increment = 5;
// how long in microsec (us) to delay between phases while calibrating
// the wheel
int CALIBRATION_DELAY = 18500; // previous: 28500
int CALIBRATION_DELAY = 28500; // previous: 28500
// Timer setup (for speed calc)
IntervalTimer speed_timer;
......@@ -224,21 +224,26 @@ int get_phase_number(int elec_position)
// Interupt Service routine that will find zero
void isr_index(void){
static int count = 0;
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
if (interrupt_time - last_interrupt_time > 500)
{
count += 1;
}
if (count >= 2)
{
Zoffset = encoder.calcPosn();
calibrated = true;
}
// static int count = 0;
// static unsigned long last_interrupt_time = 0;
// unsigned long interrupt_time = millis();
// if ((interrupt_time - last_interrupt_time ) > 500)
// {
// count += 1;
// }
// if (count >= 2)
// {
// Zoffset = encoder.calcPosn();
// calibrated = true;
// }
// last_interrupt_time = interrupt_time;
Zoffset = encoder.calcPosn();
calibrated = true;
return;
}
// Holds last position to calculate difference between each state positions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment