Browse Source

Fix some compiler warnings

Scott Lahteine 6 years ago
parent
commit
f5aaa2d6c0
2 changed files with 25 additions and 23 deletions
  1. 23
    23
      Marlin/src/gcode/feature/trinamic/M911-M915.cpp
  2. 2
    0
      Marlin/src/module/temperature.cpp

+ 23
- 23
Marlin/src/gcode/feature/trinamic/M911-M915.cpp View File

@@ -31,10 +31,11 @@
31 31
 #include "../../queue.h"
32 32
 
33 33
 #define M91x_USE(A) (ENABLED(A##_IS_TMC2130) || (ENABLED(A##_IS_TMC2208) && PIN_EXISTS(A##_SERIAL_RX)))
34
+#define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N))
34 35
 #define M91x_USE_X  (ENABLED(IS_TRAMS) || M91x_USE(X))
35 36
 #define M91x_USE_Y  (ENABLED(IS_TRAMS) || M91x_USE(Y))
36 37
 #define M91x_USE_Z  (ENABLED(IS_TRAMS) || M91x_USE(Z))
37
-#define M91x_USE_E0 (ENABLED(IS_TRAMS) || M91x_USE(E0))
38
+#define M91x_USE_E0 (ENABLED(IS_TRAMS) || M91x_USE_E(0))
38 39
 
39 40
 /**
40 41
  * M911: Report TMC stepper driver overtemperature pre-warn flag
@@ -62,16 +63,16 @@ void GcodeSuite::M911() {
62 63
   #if M91x_USE_E0
63 64
     tmc_report_otpw(stepperE0, TMC_E0);
64 65
   #endif
65
-  #if M91x_USE(E1)
66
+  #if M91x_USE_E(1)
66 67
     tmc_report_otpw(stepperE1, TMC_E1);
67 68
   #endif
68
-  #if M91x_USE(E2)
69
+  #if M91x_USE_E(2)
69 70
     tmc_report_otpw(stepperE2, TMC_E2);
70 71
   #endif
71
-  #if M91x_USE(E3)
72
+  #if M91x_USE_E(3)
72 73
     tmc_report_otpw(stepperE3, TMC_E3);
73 74
   #endif
74
-  #if M91x_USE(E4)
75
+  #if M91x_USE_E(4)
75 76
     tmc_report_otpw(stepperE4, TMC_E4);
76 77
   #endif
77 78
 }
@@ -105,7 +106,6 @@ void GcodeSuite::M912() {
105 106
       #endif
106 107
     #endif
107 108
 
108
-    #define M91x_USE_Y (M91x_USE(Y) || ENABLED(IS_TRAMS))
109 109
     #if M91x_USE_Y || M91x_USE(Y2)
110 110
       const uint8_t yval = parser.byteval(axis_codes[Y_AXIS], 10);
111 111
       #if M91x_USE_Y
@@ -116,7 +116,6 @@ void GcodeSuite::M912() {
116 116
       #endif
117 117
     #endif
118 118
 
119
-    #define M91x_USE_Z (M91x_USE(Z) || ENABLED(IS_TRAMS))
120 119
     #if M91x_USE_Z || M91x_USE(Z2)
121 120
       const uint8_t zval = parser.byteval(axis_codes[Z_AXIS], 10);
122 121
       #if M91x_USE_Z
@@ -127,22 +126,23 @@ void GcodeSuite::M912() {
127 126
       #endif
128 127
     #endif
129 128
 
130
-    const uint8_t eval = parser.byteval(axis_codes[E_AXIS], 10);
131
-
132
-    #if M91x_USE_E0
133
-      if (hasNone || eval == 0 || (hasE && eval == 10)) tmc_clear_otpw(stepperE0, TMC_E0);
134
-    #endif
135
-    #if E_STEPPERS > 1 && M91x_USE(E1)
136
-      if (hasNone || eval == 1 || (hasE && eval == 10)) tmc_clear_otpw(stepperE1, TMC_E1);
137
-    #endif
138
-    #if E_STEPPERS > 2 && M91x_USE(E2)
139
-      if (hasNone || eval == 2 || (hasE && eval == 10)) tmc_clear_otpw(stepperE2, TMC_E2);
140
-    #endif
141
-    #if E_STEPPERS > 3 && M91x_USE(E3)
142
-      if (hasNone || eval == 3 || (hasE && eval == 10)) tmc_clear_otpw(stepperE3, TMC_E3);
143
-    #endif
144
-    #if E_STEPPERS > 4 && M91x_USE(E4)
145
-      if (hasNone || eval == 4 || (hasE && eval == 10)) tmc_clear_otpw(stepperE4, TMC_E4);
129
+    #if M91x_USE_E0 || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4)
130
+      const uint8_t eval = parser.byteval(axis_codes[E_AXIS], 10);
131
+      #if M91x_USE_E0
132
+        if (hasNone || eval == 0 || (hasE && eval == 10)) tmc_clear_otpw(stepperE0, TMC_E0);
133
+      #endif
134
+      #if M91x_USE_E(1)
135
+        if (hasNone || eval == 1 || (hasE && eval == 10)) tmc_clear_otpw(stepperE1, TMC_E1);
136
+      #endif
137
+      #if M91x_USE_E(2)
138
+        if (hasNone || eval == 2 || (hasE && eval == 10)) tmc_clear_otpw(stepperE2, TMC_E2);
139
+      #endif
140
+      #if M91x_USE_E(3)
141
+        if (hasNone || eval == 3 || (hasE && eval == 10)) tmc_clear_otpw(stepperE3, TMC_E3);
142
+      #endif
143
+      #if M91x_USE_E(4)
144
+        if (hasNone || eval == 4 || (hasE && eval == 10)) tmc_clear_otpw(stepperE4, TMC_E4);
145
+      #endif
146 146
     #endif
147 147
 }
148 148
 

+ 2
- 0
Marlin/src/module/temperature.cpp View File

@@ -1009,6 +1009,8 @@ float Temperature::analog2temp(const int raw, const uint8_t e) {
1009 1009
     const short(*tt)[][2] = (short(*)[][2])(heater_ttbl_map[e]);
1010 1010
     SCAN_THERMISTOR_TABLE((*tt), heater_ttbllen_map[e]);
1011 1011
   #endif
1012
+
1013
+  return 0;
1012 1014
 }
1013 1015
 
1014 1016
 #if HAS_HEATED_BED

Loading…
Cancel
Save