From e0e68c5cbc9f92d48f3c1f6e46f7151f2ea9f179 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 14 Apr 2015 03:13:25 -0700 Subject: [PATCH 1/2] Rename servos[] array in Marlin to servo[] --- Marlin/Marlin_main.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index c65d88395a..475362f2c9 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -379,7 +379,7 @@ bool target_direction; #endif #if NUM_SERVOS > 0 - Servo servos[NUM_SERVOS]; + Servo servo[NUM_SERVOS]; #endif #ifdef CHDK @@ -534,28 +534,28 @@ void suicide() { void servo_init() { #if NUM_SERVOS >= 1 && HAS_SERVO_0 - servos[0].attach(SERVO0_PIN); + servo[0].attach(SERVO0_PIN); #endif #if NUM_SERVOS >= 2 && HAS_SERVO_1 - servos[1].attach(SERVO1_PIN); + servo[1].attach(SERVO1_PIN); #endif #if NUM_SERVOS >= 3 && HAS_SERVO_2 - servos[2].attach(SERVO2_PIN); + servo[2].attach(SERVO2_PIN); #endif #if NUM_SERVOS >= 4 && HAS_SERVO_3 - servos[3].attach(SERVO3_PIN); + servo[3].attach(SERVO3_PIN); #endif // Set position of Servo Endstops that are defined #ifdef SERVO_ENDSTOPS for (int i = 0; i < 3; i++) if (servo_endstops[i] >= 0) - servos[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]); + servo[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]); #endif #if SERVO_LEVELING delay(PROBE_SERVO_DEACTIVATION_DELAY); - servos[servo_endstops[Z_AXIS]].detach(); + servo[servo_endstops[Z_AXIS]].detach(); #endif } @@ -889,7 +889,7 @@ void get_command() { } bool code_has_value() { - char c = *(strchr_pointer + 1); + char c = strchr_pointer[1]; return (c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.'; } @@ -1255,12 +1255,12 @@ inline void set_destination_to_current() { memcpy(destination, current_position, // Engage Z Servo endstop if enabled if (servo_endstops[Z_AXIS] >= 0) { #if SERVO_LEVELING - servos[servo_endstops[Z_AXIS]].attach(0); + servo[servo_endstops[Z_AXIS]].attach(0); #endif - servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]); + servo[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]); #if SERVO_LEVELING delay(PROBE_SERVO_DEACTIVATION_DELAY); - servos[servo_endstops[Z_AXIS]].detach(); + servo[servo_endstops[Z_AXIS]].detach(); #endif } @@ -1319,14 +1319,14 @@ inline void set_destination_to_current() { memcpy(destination, current_position, #endif #if SERVO_LEVELING - servos[servo_endstops[Z_AXIS]].attach(0); + servo[servo_endstops[Z_AXIS]].attach(0); #endif - servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]); + servo[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]); #if SERVO_LEVELING delay(PROBE_SERVO_DEACTIVATION_DELAY); - servos[servo_endstops[Z_AXIS]].detach(); + servo[servo_endstops[Z_AXIS]].detach(); #endif } @@ -1520,7 +1520,7 @@ static void homeaxis(AxisEnum axis) { #endif { if (servo_endstops[axis] > -1) - servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]); + servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]); } #endif // SERVO_ENDSTOPS && !Z_PROBE_SLED @@ -1598,7 +1598,7 @@ static void homeaxis(AxisEnum axis) { // Retract Servo endstop if enabled #ifdef SERVO_ENDSTOPS if (servo_endstops[axis] > -1) - servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]); + servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]); #endif #if SERVO_LEVELING && !defined(Z_PROBE_SLED) @@ -3990,12 +3990,12 @@ inline void gcode_M226() { servo_position = code_value(); if ((servo_index >= 0) && (servo_index < NUM_SERVOS)) { #if SERVO_LEVELING - servos[servo_index].attach(0); + servo[servo_index].attach(0); #endif - servos[servo_index].write(servo_position); + servo[servo_index].write(servo_position); #if SERVO_LEVELING delay(PROBE_SERVO_DEACTIVATION_DELAY); - servos[servo_index].detach(); + servo[servo_index].detach(); #endif } else { @@ -4010,7 +4010,7 @@ inline void gcode_M226() { SERIAL_PROTOCOL(" Servo "); SERIAL_PROTOCOL(servo_index); SERIAL_PROTOCOL(": "); - SERIAL_PROTOCOL(servos[servo_index].read()); + SERIAL_PROTOCOL(servo[servo_index].read()); SERIAL_EOL; } } From 3f02da646c88ec0a8a332f59cede0d1901e1e251 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 14 Apr 2015 03:41:37 -0700 Subject: [PATCH 2/2] Make sure axis_active is cleared for #1908 --- Marlin/planner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index a452428d78..060be3007e 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -393,7 +393,7 @@ void plan_init() { #endif void check_axes_activity() { - unsigned char axis_active[NUM_AXIS], + unsigned char axis_active[NUM_AXIS] = { 0 }, tail_fan_speed = fanSpeed; #ifdef BARICUDA unsigned char tail_valve_pressure = ValvePressure,