Explorar el Código

Make digitalPotWrite depend on HAS_DIGIPOTSS

Scott Lahteine hace 8 años
padre
commit
5d0570cea0
Se han modificado 3 ficheros con 16 adiciones y 13 borrados
  1. 6
    4
      Marlin/Marlin_main.cpp
  2. 7
    8
      Marlin/stepper.cpp
  3. 3
    1
      Marlin/stepper.h

+ 6
- 4
Marlin/Marlin_main.cpp Ver fichero

@@ -5660,10 +5660,12 @@ inline void gcode_M907() {
5660 5660
    * M908: Control digital trimpot directly (M908 P<pin> S<current>)
5661 5661
    */
5662 5662
   inline void gcode_M908() {
5663
-    digitalPotWrite(
5664
-      code_seen('P') ? code_value() : 0,
5665
-      code_seen('S') ? code_value() : 0
5666
-    );
5663
+    #if HAS_DIGIPOTSS
5664
+      digitalPotWrite(
5665
+        code_seen('P') ? code_value() : 0,
5666
+        code_seen('S') ? code_value() : 0
5667
+      );
5668
+    #endif
5667 5669
     #ifdef DAC_STEPPER_CURRENT
5668 5670
       dac_current_raw(
5669 5671
         code_seen('P') ? code_value_long() : -1,

+ 7
- 8
Marlin/stepper.cpp Ver fichero

@@ -1174,19 +1174,18 @@ void quickStop() {
1174 1174
 
1175 1175
 #endif //BABYSTEPPING
1176 1176
 
1177
-// From Arduino DigitalPotControl example
1178
-void digitalPotWrite(int address, int value) {
1179
-  #if HAS_DIGIPOTSS
1177
+#if HAS_DIGIPOTSS
1178
+
1179
+  // From Arduino DigitalPotControl example
1180
+  void digitalPotWrite(int address, int value) {
1180 1181
     digitalWrite(DIGIPOTSS_PIN, LOW); // take the SS pin low to select the chip
1181 1182
     SPI.transfer(address); //  send in the address and value via SPI:
1182 1183
     SPI.transfer(value);
1183 1184
     digitalWrite(DIGIPOTSS_PIN, HIGH); // take the SS pin high to de-select the chip:
1184 1185
     //delay(10);
1185
-  #else
1186
-    UNUSED(address);
1187
-    UNUSED(value);
1188
-  #endif
1189
-}
1186
+  }
1187
+
1188
+#endif //HAS_DIGIPOTSS
1190 1189
 
1191 1190
 // Initialize Digipot Motor Current
1192 1191
 void digipot_init() {

+ 3
- 1
Marlin/stepper.h Ver fichero

@@ -62,7 +62,9 @@ extern block_t* current_block;  // A pointer to the block currently being traced
62 62
 
63 63
 void quickStop();
64 64
 
65
-void digitalPotWrite(int address, int value);
65
+#if HAS_DIGIPOTSS
66
+  void digitalPotWrite(int address, int value);
67
+#endif
66 68
 void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2);
67 69
 void microstep_mode(uint8_t driver, uint8_t stepping);
68 70
 void digipot_init();

Loading…
Cancelar
Guardar