Pushed limits active high option. Updated defaults.h. Misc bug fixes. Cleaned up codebase.
- Pushed limit switch active high option (i.e. NC switches). - Updated defaults.h to be in-line with the new settings. - Refactored feed hold handling and step segment buffer to be more generalized in effort to make adding feedrate overrides easier in the future. Also made it a little more clean. - Fixed G18 plane select issue. Now ZX-plane, rather than XZ-plane, per right hand rule. - Cleaned some of the system settings by more accurately renaming some of the variables and removing old obsolete ones. - Declared serial.c rx_buffer_tail to be volatile. No effect, since avr-gcc automatically does this during compilation. Helps with porting when using other compilers. - Updated version number to v0.9b. - Updates to README.md
This commit is contained in:
16
limits.c
16
limits.c
@ -35,10 +35,17 @@
|
||||
|
||||
#define MICROSECONDS_PER_ACCELERATION_TICK (1000000/ACCELERATION_TICKS_PER_SECOND)
|
||||
|
||||
|
||||
void limits_init()
|
||||
{
|
||||
LIMIT_DDR &= ~(LIMIT_MASK); // Set as input pins
|
||||
LIMIT_PORT |= (LIMIT_MASK); // Enable internal pull-up resistors. Normal high operation.
|
||||
|
||||
#ifndef LIMIT_SWITCHES_ACTIVE_HIGH
|
||||
LIMIT_PORT |= (LIMIT_MASK); // Enable internal pull-up resistors. Normal high operation.
|
||||
#else // LIMIT_SWITCHES_ACTIVE_HIGH
|
||||
LIMIT_PORT &= ~(LIMIT_MASK); // Normal low operation. Requires external pull-down.
|
||||
#endif // !LIMIT_SWITCHES_ACTIVE_HIGH
|
||||
|
||||
if (bit_istrue(settings.flags,BITFLAG_HARD_LIMIT_ENABLE)) {
|
||||
LIMIT_PCMSK |= LIMIT_MASK; // Enable specific pins of the Pin Change Interrupt
|
||||
PCICR |= (1 << LIMIT_INT); // Enable Pin Change Interrupt
|
||||
@ -48,6 +55,7 @@ void limits_init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This is the Limit Pin Change Interrupt, which handles the hard limit feature. A bouncing
|
||||
// limit switch can cause a lot of problems, like false readings and multiple interrupt calls.
|
||||
// If a switch is triggered at all, something bad has happened and treat it as such, regardless
|
||||
@ -94,7 +102,11 @@ static void homing_cycle(uint8_t cycle_mask, int8_t pos_dir, bool invert_pin, fl
|
||||
This will also fix the slow max feedrate of the homing 'lite' stepper algorithm.
|
||||
|
||||
Need to check if setting the planner steps will require them to be volatile or not. */
|
||||
|
||||
|
||||
#ifdef LIMIT_SWITCHES_ACTIVE_HIGH
|
||||
// When in an active-high switch configuration, invert_pin needs to be adjusted.
|
||||
invert_pin = !invert_pin;
|
||||
#endif
|
||||
|
||||
// Determine governing axes with finest step resolution per distance for the Bresenham
|
||||
// algorithm. This solves the issue when homing multiple axes that have different
|
||||
|
Reference in New Issue
Block a user