Cleaned up variable spindle output (PWM). Code and config comments.
- Variable spindle speed output as a configuration option. Thanks @EliteEng! When enabled, the Z-limit (D11) and spindle enable(D12) pins switch to allow access to the hardware PWM output on pin D11. Otherwise, everything should work as it does. - Removed option for inverting the spindle and coolant enable pins. This is a safety hazard, especially for the spindle. When Grbl initializes, all pins are momentarily low until it finishes booting. If an invert is enabled, this means the spindles can be energized briefly during this time. If users need signal inversion, it’s recommended to just wire in an inversion circuit instead. - Cleared out references to spindle variable output in terms of step signal. This isn’t complete and requires more deliberation before installing. - Cleared up and cleaned up some code and config comments.
This commit is contained in:
@ -27,29 +27,24 @@
|
||||
|
||||
static uint8_t current_coolant_mode;
|
||||
|
||||
|
||||
void coolant_init()
|
||||
{
|
||||
current_coolant_mode = COOLANT_DISABLE;
|
||||
#if ENABLE_M7
|
||||
COOLANT_FLOOD_DDR |= (1 << COOLANT_FLOOD_BIT);
|
||||
#ifdef ENABLE_M7
|
||||
COOLANT_MIST_DDR |= (1 << COOLANT_MIST_BIT);
|
||||
#endif
|
||||
COOLANT_FLOOD_DDR |= (1 << COOLANT_FLOOD_BIT);
|
||||
coolant_stop();
|
||||
}
|
||||
|
||||
|
||||
void coolant_stop()
|
||||
{
|
||||
#ifdef INVERT_COOLANT
|
||||
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
|
||||
#ifdef ENABLE_M7
|
||||
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
|
||||
#endif
|
||||
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
|
||||
#else
|
||||
#ifdef ENABLE_M7
|
||||
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
|
||||
#endif
|
||||
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
|
||||
#endif
|
||||
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -59,19 +54,13 @@ void coolant_run(uint8_t mode)
|
||||
{
|
||||
plan_synchronize(); // Ensure coolant turns on when specified in program.
|
||||
if (mode == COOLANT_FLOOD_ENABLE) {
|
||||
#ifdef INVERT_COOLANT
|
||||
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
|
||||
#else
|
||||
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
|
||||
#endif
|
||||
#ifdef ENABLE_M7
|
||||
} else if (mode == COOLANT_MIST_ENABLE) {
|
||||
#ifdef INVERT_COOLANT
|
||||
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
|
||||
#else
|
||||
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
|
||||
#endif
|
||||
#endif
|
||||
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
|
||||
|
||||
#ifdef ENABLE_M7
|
||||
} else if (mode == COOLANT_MIST_ENABLE) {
|
||||
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
coolant_stop();
|
||||
}
|
||||
|
Reference in New Issue
Block a user