Browse Source

Make some z probe and servo code tweaks

Scott Lahteine 9 years ago
parent
commit
f73f4ce555
3 changed files with 22 additions and 24 deletions
  1. 8
    12
      Marlin/Marlin_main.cpp
  2. 1
    0
      Marlin/pins.h
  3. 13
    12
      Marlin/pins_OMCA.h

+ 8
- 12
Marlin/Marlin_main.cpp View File

4074
 #if NUM_SERVOS > 0
4074
 #if NUM_SERVOS > 0
4075
 
4075
 
4076
   /**
4076
   /**
4077
-   * M280: Set servo position absolute. P: servo index, S: angle or microseconds
4077
+   * M280: Get or set servo position. P<index> S<angle>
4078
    */
4078
    */
4079
   inline void gcode_M280() {
4079
   inline void gcode_M280() {
4080
-    int servo_index = code_seen('P') ? code_value() : -1;
4080
+    int servo_index = code_seen('P') ? code_value_short() : -1;
4081
     int servo_position = 0;
4081
     int servo_position = 0;
4082
     if (code_seen('S')) {
4082
     if (code_seen('S')) {
4083
-      servo_position = code_value();
4084
-      if ((servo_index >= 0) && (servo_index < NUM_SERVOS)) {
4083
+      servo_position = code_value_short();
4084
+      if (servo_index >= 0 && servo_index < NUM_SERVOS) {
4085
         Servo *srv = &servo[servo_index];
4085
         Servo *srv = &servo[servo_index];
4086
         #if SERVO_LEVELING
4086
         #if SERVO_LEVELING
4087
           srv->attach(0);
4087
           srv->attach(0);
5650
 
5650
 
5651
 #ifdef MESH_BED_LEVELING
5651
 #ifdef MESH_BED_LEVELING
5652
 
5652
 
5653
-  #if !defined(MIN)
5654
-    #define MIN(_v1, _v2) (((_v1) < (_v2)) ? (_v1) : (_v2))
5655
-  #endif  // ! MIN
5656
-
5657
 // This function is used to split lines on mesh borders so each segment is only part of one mesh area
5653
 // This function is used to split lines on mesh borders so each segment is only part of one mesh area
5658
 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)
5654
 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)
5659
 {
5655
 {
5666
   int piy = mbl.select_y_index(current_position[Y_AXIS]);
5662
   int piy = mbl.select_y_index(current_position[Y_AXIS]);
5667
   int ix = mbl.select_x_index(x);
5663
   int ix = mbl.select_x_index(x);
5668
   int iy = mbl.select_y_index(y);
5664
   int iy = mbl.select_y_index(y);
5669
-  pix = MIN(pix, MESH_NUM_X_POINTS-2);
5670
-  piy = MIN(piy, MESH_NUM_Y_POINTS-2);
5671
-  ix = MIN(ix, MESH_NUM_X_POINTS-2);
5672
-  iy = MIN(iy, MESH_NUM_Y_POINTS-2);
5665
+  pix = min(pix, MESH_NUM_X_POINTS - 2);
5666
+  piy = min(piy, MESH_NUM_Y_POINTS - 2);
5667
+  ix = min(ix, MESH_NUM_X_POINTS - 2);
5668
+  iy = min(iy, MESH_NUM_Y_POINTS - 2);
5673
   if (pix == ix && piy == iy) {
5669
   if (pix == ix && piy == iy) {
5674
     // Start and end on same mesh square
5670
     // Start and end on same mesh square
5675
     plan_buffer_line(x, y, z, e, feed_rate, extruder);
5671
     plan_buffer_line(x, y, z, e, feed_rate, extruder);

+ 1
- 0
Marlin/pins.h View File

190
 #endif
190
 #endif
191
 
191
 
192
 #if defined(DISABLE_Z_PROBE_ENDSTOP) || !defined(Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting.
192
 #if defined(DISABLE_Z_PROBE_ENDSTOP) || !defined(Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting.
193
+  #undef Z_PROBE_PIN
193
   #define Z_PROBE_PIN        -1
194
   #define Z_PROBE_PIN        -1
194
 #endif
195
 #endif
195
 
196
 

+ 13
- 12
Marlin/pins_OMCA.h View File

48
 #define Z_ENABLE_PIN       10
48
 #define Z_ENABLE_PIN       10
49
 #define Z_STOP_PIN         2
49
 #define Z_STOP_PIN         2
50
 
50
 
51
-#define E0_STEP_PIN         24
52
-#define E0_DIR_PIN          21
53
-#define E0_ENABLE_PIN       10
51
+#define E0_STEP_PIN        24
52
+#define E0_DIR_PIN         21
53
+#define E0_ENABLE_PIN      10
54
 
54
 
55
 // future proofing
55
 // future proofing
56
 #define __FS  20
56
 #define __FS  20
58
 #define __GS  18
58
 #define __GS  18
59
 #define __GD  13
59
 #define __GD  13
60
 
60
 
61
-#define UNUSED_PWM           14 // PWM on LEFT connector
61
+#define UNUSED_PWM         14 // PWM on LEFT connector
62
 
62
 
63
-#define E1_STEP_PIN         -1 // 21
64
-#define E1_DIR_PIN          -1 // 20
65
-#define E1_ENABLE_PIN       -1 // 19
63
+#define E1_STEP_PIN        -1 // 21
64
+#define E1_DIR_PIN         -1 // 20
65
+#define E1_ENABLE_PIN      -1 // 19
66
 
66
 
67
-#define E2_STEP_PIN         -1 // 21
68
-#define E2_DIR_PIN          -1 // 20
69
-#define E2_ENABLE_PIN       -1 // 18
67
+#define E2_STEP_PIN        -1 // 21
68
+#define E2_DIR_PIN         -1 // 20
69
+#define E2_ENABLE_PIN      -1 // 18
70
 
70
 
71
 #define SDPOWER            -1
71
 #define SDPOWER            -1
72
 #define SDSS               11
72
 #define SDSS               11
87
 #define HEATER_BED_PIN      4
87
 #define HEATER_BED_PIN      4
88
 #define TEMP_BED_PIN        2 // 1,2 or I2C
88
 #define TEMP_BED_PIN        2 // 1,2 or I2C
89
 
89
 
90
-#define I2C_SCL       16
91
-#define I2C_SDA       17
90
+#define I2C_SCL            16
91
+#define I2C_SDA            17
92
+

Loading…
Cancel
Save