Updated limit/homing routine. Works, but needs more TLC.
- Added acceleration to the homing routine. - Homing now accounts for different step rates when moving multiple axes without exceeding acceleration limits. - Homing now updates all internal positioning variables to machine zero after completion. - "Poor-man's" debounce delay added. - Updated the delay_us() function to perform faster and more accurate microsecond delays. Previously, the single increments would add noticeable time drift for larger delays. - Fix a bug in the stepper.c prescalar calculations that was changed in the last commit. - Other minor fixes.
This commit is contained in:
19
nuts_bolts.c
19
nuts_bolts.c
@ -46,8 +46,23 @@ void delay_ms(uint16_t ms)
|
||||
}
|
||||
|
||||
// Delays variable defined microseconds. Compiler compatibility fix for _delay_us(),
|
||||
// which only accepts constants in future compiler releases.
|
||||
// which only accepts constants in future compiler releases. Written to perform more
|
||||
// efficiently with larger delays, as the counter adds parasitic time in each iteration.
|
||||
void delay_us(uint16_t us)
|
||||
{
|
||||
while ( us-- ) { _delay_us(1); }
|
||||
while (us) {
|
||||
if (us < 10) {
|
||||
_delay_us(1);
|
||||
us--;
|
||||
} else if (us < 100) {
|
||||
_delay_us(10);
|
||||
us -= 10;
|
||||
} else if (us < 1000) {
|
||||
_delay_us(100);
|
||||
us -= 100;
|
||||
} else {
|
||||
_delay_ms(1);
|
||||
us -= 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user