PWM Spindle Control and Invert Spindle & Coolant Pins

PWM Spindle Control and Invert Spindle & Coolant Pins
This commit is contained in:
Rob Brown
2014-01-02 12:42:22 +08:00
parent f10bad43b2
commit c0381799eb
6 changed files with 198 additions and 48 deletions

View File

@ -39,10 +39,17 @@ void coolant_init()
void coolant_stop()
{
#ifdef INVERT_COOLANT
#ifdef ENABLE_M7
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
#endif
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
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
}
@ -51,11 +58,19 @@ void coolant_run(uint8_t mode)
if (mode != current_coolant_mode)
{
plan_synchronize(); // Ensure coolant turns on when specified in program.
if (mode == COOLANT_FLOOD_ENABLE) {
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
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
} else {
coolant_stop();