Make some z probe and servo code tweaks

This commit is contained in:
Scott Lahteine 2015-05-09 19:11:19 -07:00
parent 598c7aea5d
commit f73f4ce555
3 changed files with 22 additions and 24 deletions

View file

@ -4074,14 +4074,14 @@ inline void gcode_M226() {
#if NUM_SERVOS > 0 #if NUM_SERVOS > 0
/** /**
* M280: Set servo position absolute. P: servo index, S: angle or microseconds * M280: Get or set servo position. P<index> S<angle>
*/ */
inline void gcode_M280() { inline void gcode_M280() {
int servo_index = code_seen('P') ? code_value() : -1; int servo_index = code_seen('P') ? code_value_short() : -1;
int servo_position = 0; int servo_position = 0;
if (code_seen('S')) { if (code_seen('S')) {
servo_position = code_value(); servo_position = code_value_short();
if ((servo_index >= 0) && (servo_index < NUM_SERVOS)) { if (servo_index >= 0 && servo_index < NUM_SERVOS) {
Servo *srv = &servo[servo_index]; Servo *srv = &servo[servo_index];
#if SERVO_LEVELING #if SERVO_LEVELING
srv->attach(0); srv->attach(0);
@ -5650,10 +5650,6 @@ void clamp_to_software_endstops(float target[3]) {
#ifdef MESH_BED_LEVELING #ifdef MESH_BED_LEVELING
#if !defined(MIN)
#define MIN(_v1, _v2) (((_v1) < (_v2)) ? (_v1) : (_v2))
#endif // ! MIN
// This function is used to split lines on mesh borders so each segment is only part of one mesh area // This function is used to split lines on mesh borders so each segment is only part of one mesh area
void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_rate, const uint8_t &extruder, uint8_t x_splits=0xff, uint8_t y_splits=0xff) void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_rate, const uint8_t &extruder, uint8_t x_splits=0xff, uint8_t y_splits=0xff)
{ {
@ -5666,10 +5662,10 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
int piy = mbl.select_y_index(current_position[Y_AXIS]); int piy = mbl.select_y_index(current_position[Y_AXIS]);
int ix = mbl.select_x_index(x); int ix = mbl.select_x_index(x);
int iy = mbl.select_y_index(y); int iy = mbl.select_y_index(y);
pix = MIN(pix, MESH_NUM_X_POINTS-2); pix = min(pix, MESH_NUM_X_POINTS - 2);
piy = MIN(piy, MESH_NUM_Y_POINTS-2); piy = min(piy, MESH_NUM_Y_POINTS - 2);
ix = MIN(ix, MESH_NUM_X_POINTS-2); ix = min(ix, MESH_NUM_X_POINTS - 2);
iy = MIN(iy, MESH_NUM_Y_POINTS-2); iy = min(iy, MESH_NUM_Y_POINTS - 2);
if (pix == ix && piy == iy) { if (pix == ix && piy == iy) {
// Start and end on same mesh square // Start and end on same mesh square
plan_buffer_line(x, y, z, e, feed_rate, extruder); plan_buffer_line(x, y, z, e, feed_rate, extruder);

View file

@ -190,6 +190,7 @@
#endif #endif
#if defined(DISABLE_Z_PROBE_ENDSTOP) || !defined(Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting. #if defined(DISABLE_Z_PROBE_ENDSTOP) || !defined(Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting.
#undef Z_PROBE_PIN
#define Z_PROBE_PIN -1 #define Z_PROBE_PIN -1
#endif #endif

View file

@ -89,3 +89,4 @@
#define I2C_SCL 16 #define I2C_SCL 16
#define I2C_SDA 17 #define I2C_SDA 17