Merge pull request #7255 from thinkyhead/bf_cleanup_july_6

Use FastIO for spindle, probe test, and case light
This commit is contained in:
Scott Lahteine 2017-07-06 22:03:27 -05:00 committed by GitHub
commit ce834bb78e
10 changed files with 46 additions and 42 deletions

View File

@ -5280,7 +5280,7 @@ void home_all_axes() { gcode_G28(true); }
#if DISABLED(PROBE_MANUALLY) #if DISABLED(PROBE_MANUALLY)
home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
#endif #endif
do { do {
float z_at_pt[13] = { 0.0 }; float z_at_pt[13] = { 0.0 };
@ -5380,7 +5380,7 @@ void home_all_axes() { gcode_G28(true); }
#if ENABLED(PROBE_MANUALLY) #if ENABLED(PROBE_MANUALLY)
test_precision = 0.00; // forced end test_precision = 0.00; // forced end
#endif #endif
switch (probe_points) { switch (probe_points) {
case 1: case 1:
test_precision = 0.00; // forced end test_precision = 0.00; // forced end
@ -5854,7 +5854,7 @@ inline void gcode_G92() {
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off
delay_for_power_down(); delay_for_power_down();
} }
digitalWrite(SPINDLE_DIR_PIN, rotation_dir); WRITE(SPINDLE_DIR_PIN, rotation_dir);
#endif #endif
/** /**
@ -6259,7 +6259,7 @@ inline void gcode_M17() {
inline void gcode_M23() { inline void gcode_M23() {
// Simplify3D includes the size, so zero out all spaces (#7227) // Simplify3D includes the size, so zero out all spaces (#7227)
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0'; for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
card.openFile(parser.string_arg, true); card.openFile(parser.string_arg, true);
} }
/** /**
@ -6474,20 +6474,20 @@ inline void gcode_M42() {
else { else {
report_pin_state_extended(pin, I_flag, true, "Pulsing "); 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 AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO
if (pin == 46) { if (pin == TEENSY_E2) {
SET_OUTPUT(46); SET_OUTPUT(TEENSY_E2);
for (int16_t j = 0; j < repeat; j++) { for (int16_t j = 0; j < repeat; j++) {
WRITE(46, 0); safe_delay(wait); WRITE(TEENSY_E2, LOW); safe_delay(wait);
WRITE(46, 1); safe_delay(wait); WRITE(TEENSY_E2, HIGH); safe_delay(wait);
WRITE(46, 0); safe_delay(wait); WRITE(TEENSY_E2, LOW); safe_delay(wait);
} }
} }
else if (pin == 47) { else if (pin == TEENSY_E3) {
SET_OUTPUT(47); SET_OUTPUT(TEENSY_E3);
for (int16_t j = 0; j < repeat; j++) { for (int16_t j = 0; j < repeat; j++) {
WRITE(47, 0); safe_delay(wait); WRITE(TEENSY_E3, LOW); safe_delay(wait);
WRITE(47, 1); safe_delay(wait); WRITE(TEENSY_E3, HIGH); safe_delay(wait);
WRITE(47, 0); safe_delay(wait); WRITE(TEENSY_E3, LOW); safe_delay(wait);
} }
} }
else else
@ -6569,10 +6569,10 @@ inline void gcode_M42() {
for (uint8_t i = 0; i < 4; i++) { for (uint8_t i = 0; i < 4; i++) {
servo[probe_index].move(z_servo_angle[0]); //deploy servo[probe_index].move(z_servo_angle[0]); //deploy
safe_delay(500); safe_delay(500);
deploy_state = digitalRead(PROBE_TEST_PIN); deploy_state = READ(PROBE_TEST_PIN);
servo[probe_index].move(z_servo_angle[1]); //stow servo[probe_index].move(z_servo_angle[1]); //stow
safe_delay(500); 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"); 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 if (0 == j % (500 * 1)) // keep cmd_timeout happy
refresh_cmd_timeout(); 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); safe_delay(2);
if (probe_counter == 50) if (probe_counter == 50)
@ -6671,7 +6671,7 @@ inline void gcode_M42() {
if (parser.seen('E')) { if (parser.seen('E')) {
endstop_monitor_flag = parser.value_bool(); endstop_monitor_flag = parser.value_bool();
SERIAL_PROTOCOLPGM("endstop monitor "); SERIAL_PROTOCOLPGM("endstop monitor ");
SERIAL_PROTOCOL(endstop_monitor_flag ? "en" : "dis"); serialprintPGM(endstop_monitor_flag ? PSTR("en") : PSTR("dis"));
SERIAL_PROTOCOLLNPGM("abled"); SERIAL_PROTOCOLLNPGM("abled");
return; return;
} }
@ -9876,9 +9876,9 @@ inline void gcode_M907() {
if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) { if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) {
analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness ); 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 #endif // HAS_CASE_LIGHT
@ -12877,7 +12877,7 @@ void kill(const char* lcd_msg) {
#if defined(ACTION_ON_KILL) #if defined(ACTION_ON_KILL)
SERIAL_ECHOLNPGM("//action:" ACTION_ON_KILL); SERIAL_ECHOLNPGM("//action:" ACTION_ON_KILL);
#endif #endif
#if HAS_POWER_SWITCH #if HAS_POWER_SWITCH
SET_INPUT(PS_ON_PIN); SET_INPUT(PS_ON_PIN);
#endif #endif

View File

@ -497,7 +497,7 @@
// Horizontal distance bridged by diagonal push rods when effector is centered. // Horizontal distance bridged by diagonal push rods when effector is centered.
#define DELTA_RADIUS 101.0 //mm Get this value from auto calibrate #define DELTA_RADIUS 101.0 //mm Get this value from auto calibrate
// Trim adjustments for individual towers // Trim adjustments for individual towers
// tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0
// measured in degrees anticlockwise looking from above the printer // measured in degrees anticlockwise looking from above the printer

View File

@ -497,7 +497,7 @@
// Horizontal distance bridged by diagonal push rods when effector is centered. // Horizontal distance bridged by diagonal push rods when effector is centered.
#define DELTA_RADIUS 101.0 //mm Get this value from auto calibrate #define DELTA_RADIUS 101.0 //mm Get this value from auto calibrate
// Trim adjustments for individual towers // Trim adjustments for individual towers
// tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0
// measured in degrees anticlockwise looking from above the printer // measured in degrees anticlockwise looking from above the printer

View File

@ -487,7 +487,7 @@
// Horizontal distance bridged by diagonal push rods when effector is centered. // Horizontal distance bridged by diagonal push rods when effector is centered.
#define DELTA_RADIUS 124.0 //mm Get this value from auto calibrate #define DELTA_RADIUS 124.0 //mm Get this value from auto calibrate
// Trim adjustments for individual towers // Trim adjustments for individual towers
// tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0
// measured in degrees anticlockwise looking from above the printer // measured in degrees anticlockwise looking from above the printer

View File

@ -487,7 +487,7 @@
// Horizontal distance bridged by diagonal push rods when effector is centered. // Horizontal distance bridged by diagonal push rods when effector is centered.
#define DELTA_RADIUS 105.2 //mm Get this value from auto calibrate #define DELTA_RADIUS 105.2 //mm Get this value from auto calibrate
// Trim adjustments for individual towers // Trim adjustments for individual towers
// tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0
// measured in degrees anticlockwise looking from above the printer // measured in degrees anticlockwise looking from above the printer

View File

@ -473,7 +473,7 @@
// Horizontal distance bridged by diagonal push rods when effector is centered. // Horizontal distance bridged by diagonal push rods when effector is centered.
#define DELTA_RADIUS 152.357 //mm Get this value from auto calibrate #define DELTA_RADIUS 152.357 //mm Get this value from auto calibrate
// Trim adjustments for individual towers // Trim adjustments for individual towers
// tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0
// measured in degrees anticlockwise looking from above the printer // measured in degrees anticlockwise looking from above the printer

View File

@ -491,7 +491,7 @@
// Horizontal distance bridged by diagonal push rods when effector is centered. // Horizontal distance bridged by diagonal push rods when effector is centered.
#define DELTA_RADIUS 174.1 //mm Get this value from auto calibrate #define DELTA_RADIUS 174.1 //mm Get this value from auto calibrate
// Trim adjustments for individual towers // Trim adjustments for individual towers
// tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0
// measured in degrees anticlockwise looking from above the printer // measured in degrees anticlockwise looking from above the printer

View File

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

View File

@ -32,9 +32,9 @@
* *
* Teensyduino - http://www.pjrc.com/teensy/teensyduino.html * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html
* Installation instructions are at the above URL. * Installation instructions are at the above URL.
* *
* Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu
* *
* Note: With Teensyduino extension, the Arduino IDE will report 130048 bytes of program storage space available, * Note: With Teensyduino extension, the Arduino IDE will report 130048 bytes of program storage space available,
* but there is actually only 122880 bytes due to the larger DFU bootloader shipped by default on all Printrboard RevF. * but there is actually only 122880 bytes due to the larger DFU bootloader shipped by default on all Printrboard RevF.
* *
@ -99,8 +99,8 @@
#define DAC_STEPPER_CURRENT #define DAC_STEPPER_CURRENT
// Set default drive strength percents if not already defined - X, Y, Z, E axis // Set default drive strength percents if not already defined - X, Y, Z, E axis
#ifndef DAC_MOTOR_CURRENT_DEFAULT #ifndef DAC_MOTOR_CURRENT_DEFAULT
#define DAC_MOTOR_CURRENT_DEFAULT { 70, 70, 50, 70 } #define DAC_MOTOR_CURRENT_DEFAULT { 70, 70, 50, 70 }
#endif #endif
// Number of channels available for DAC // Number of channels available for DAC
@ -170,17 +170,17 @@
#if ENABLED(MINIPANEL) #if ENABLED(MINIPANEL)
#if ENABLED(USE_INTERNAL_SD) #if ENABLED(USE_INTERNAL_SD)
// PIN FASTIO PIN# ATUSB90 PIN# Teensy2.0++ PIN# // PIN FASTIO PIN# ATUSB90 PIN# Teensy2.0++ PIN#
#define SDSS 20 // 10 B0 #define SDSS 20 // 10 B0
#define SD_DETECT_PIN -1 // no auto-detect SD insertion on built-in Printrboard SD reader #define SD_DETECT_PIN -1 // no auto-detect SD insertion on built-in Printrboard SD reader
#else #else
// PIN FASTIO PIN# ATUSB90 PIN# Teensy2.0++ PIN# Printrboard RevF Conn. MKSLCD12864 PIN# // PIN FASTIO PIN# ATUSB90 PIN# Teensy2.0++ PIN# Printrboard RevF Conn. MKSLCD12864 PIN#
#define SDSS 11 // 36 C1 EXP2-13 EXP2-07 #define SDSS 11 // 36 C1 EXP2-13 EXP2-07
#define SD_DETECT_PIN 9 // 34 E1 EXP2-11 EXP2-04 #define SD_DETECT_PIN 9 // 34 E1 EXP2-11 EXP2-04
#endif #endif
// PIN FASTIO PIN# ATUSB90 PIN# Teensy2.0++ PIN# Printrboard RevF Conn. MKSLCD12864 PIN# // PIN FASTIO PIN# ATUSB90 PIN# Teensy2.0++ PIN# Printrboard RevF Conn. MKSLCD12864 PIN#
#define DOGLCD_A0 4 // 29 D4 EXP2-05 EXP1-04 #define DOGLCD_A0 4 // 29 D4 EXP2-05 EXP1-04
#define DOGLCD_CS 5 // 30 D5 EXP2-06 EXP1-05 #define DOGLCD_CS 5 // 30 D5 EXP2-06 EXP1-05
#define BTN_ENC 6 // 31 D6 EXP2-07 EXP1-09 #define BTN_ENC 6 // 31 D6 EXP2-07 EXP1-09
#define BEEPER_PIN 7 // 32 D7 EXP2-08 EXP1-10 #define BEEPER_PIN 7 // 32 D7 EXP2-08 EXP1-10
@ -190,8 +190,8 @@
//#define LCD_BACKLIGHT_PIN 43 // 56 F5 EXP1-12 Not Implemented //#define LCD_BACKLIGHT_PIN 43 // 56 F5 EXP1-12 Not Implemented
//#define SCK 21 // 11 B1 ICSP-04 EXP2-09 //#define SCK 21 // 11 B1 ICSP-04 EXP2-09
//#define MOSI 22 // 12 B2 ICSP-03 EXP2-05 //#define MOSI 22 // 12 B2 ICSP-03 EXP2-05
//#define MISO 23 // 13 B3 ICSP-06 EXP2-05 //#define MISO 23 // 13 B3 ICSP-06 EXP2-05
// encoder connections present // encoder connections present
#define BLEN_A 0 #define BLEN_A 0
#define BLEN_B 1 #define BLEN_B 1

View File

@ -2,10 +2,10 @@
# #
# mfup # mfup
# #
# - Fetch latest upstream and replace the PR Target branch with # - Fetch latest upstream and replace the PR Target branch with
# - Rebase the (current or specified) branch on the PR Target # - Rebase the (current or specified) branch on the PR Target
# - Force-push the branch to 'origin' # - Force-push the branch to 'origin'
# - # -
# #
[[ $# < 2 ]] || { echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1; } [[ $# < 2 ]] || { echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1; }