Merge pull request #7255 from thinkyhead/bf_cleanup_july_6

Use FastIO for spindle, probe test, and case light
master
Scott Lahteine 7 years ago committed by GitHub
commit ce834bb78e

@ -5854,7 +5854,7 @@ inline void gcode_G92() {
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off
delay_for_power_down();
}
digitalWrite(SPINDLE_DIR_PIN, rotation_dir);
WRITE(SPINDLE_DIR_PIN, rotation_dir);
#endif
/**
@ -6474,20 +6474,20 @@ inline void gcode_M42() {
else {
report_pin_state_extended(pin, I_flag, true, "Pulsing ");
#if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO
if (pin == 46) {
SET_OUTPUT(46);
if (pin == TEENSY_E2) {
SET_OUTPUT(TEENSY_E2);
for (int16_t j = 0; j < repeat; j++) {
WRITE(46, 0); safe_delay(wait);
WRITE(46, 1); safe_delay(wait);
WRITE(46, 0); safe_delay(wait);
WRITE(TEENSY_E2, LOW); safe_delay(wait);
WRITE(TEENSY_E2, HIGH); safe_delay(wait);
WRITE(TEENSY_E2, LOW); safe_delay(wait);
}
}
else if (pin == 47) {
SET_OUTPUT(47);
else if (pin == TEENSY_E3) {
SET_OUTPUT(TEENSY_E3);
for (int16_t j = 0; j < repeat; j++) {
WRITE(47, 0); safe_delay(wait);
WRITE(47, 1); safe_delay(wait);
WRITE(47, 0); safe_delay(wait);
WRITE(TEENSY_E3, LOW); safe_delay(wait);
WRITE(TEENSY_E3, HIGH); safe_delay(wait);
WRITE(TEENSY_E3, LOW); safe_delay(wait);
}
}
else
@ -6569,10 +6569,10 @@ inline void gcode_M42() {
for (uint8_t i = 0; i < 4; i++) {
servo[probe_index].move(z_servo_angle[0]); //deploy
safe_delay(500);
deploy_state = digitalRead(PROBE_TEST_PIN);
deploy_state = READ(PROBE_TEST_PIN);
servo[probe_index].move(z_servo_angle[1]); //stow
safe_delay(500);
stow_state = digitalRead(PROBE_TEST_PIN);
stow_state = READ(PROBE_TEST_PIN);
}
if (probe_inverting != deploy_state) SERIAL_PROTOCOLLNPGM("WARNING - INVERTING setting probably backwards");
@ -6607,9 +6607,9 @@ inline void gcode_M42() {
if (0 == j % (500 * 1)) // keep cmd_timeout happy
refresh_cmd_timeout();
if (deploy_state != digitalRead(PROBE_TEST_PIN)) { // probe triggered
if (deploy_state != READ(PROBE_TEST_PIN)) { // probe triggered
for (probe_counter = 1; probe_counter < 50 && deploy_state != digitalRead(PROBE_TEST_PIN); ++probe_counter)
for (probe_counter = 1; probe_counter < 50 && deploy_state != READ(PROBE_TEST_PIN); ++probe_counter)
safe_delay(2);
if (probe_counter == 50)
@ -6671,7 +6671,7 @@ inline void gcode_M42() {
if (parser.seen('E')) {
endstop_monitor_flag = parser.value_bool();
SERIAL_PROTOCOLPGM("endstop monitor ");
SERIAL_PROTOCOL(endstop_monitor_flag ? "en" : "dis");
serialprintPGM(endstop_monitor_flag ? PSTR("en") : PSTR("dis"));
SERIAL_PROTOCOLLNPGM("abled");
return;
}
@ -9876,9 +9876,9 @@ inline void gcode_M907() {
if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) {
analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness );
}
else digitalWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? LOW : HIGH );
else WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? LOW : HIGH);
}
else digitalWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? HIGH : LOW);
else WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? HIGH : LOW);
}
#endif // HAS_CASE_LIGHT

@ -382,6 +382,10 @@
#define DIO47_WPORT PORTE
#define DIO47_PWM NULL
#define DIO47_DDR DDRE
#define TEENSY_E2 46
#define TEENSY_E3 47
//-- end not supported by Teensyduino
#undef PA0

Loading…
Cancel
Save