Browse Source

Update temperature.cpp

Enables both SD card and MAX6675 to talk with each other
Fixes also issue #750
Grogyan 10 years ago
parent
commit
82606354dd
1 changed files with 16 additions and 9 deletions
  1. 16
    9
      Marlin/temperature.cpp

+ 16
- 9
Marlin/temperature.cpp View File

@@ -34,6 +34,9 @@
34 34
 #include "temperature.h"
35 35
 #include "watchdog.h"
36 36
 
37
+#include "Sd2PinMap.h"
38
+
39
+
37 40
 //===========================================================================
38 41
 //=============================public variables============================
39 42
 //===========================================================================
@@ -748,18 +751,22 @@ void tp_init()
748 751
 
749 752
   #ifdef HEATER_0_USES_MAX6675
750 753
     #ifndef SDSUPPORT
751
-      SET_OUTPUT(MAX_SCK_PIN);
752
-      WRITE(MAX_SCK_PIN,0);
754
+      SET_OUTPUT(SCK_PIN);
755
+      WRITE(SCK_PIN,0);
753 756
     
754
-      SET_OUTPUT(MAX_MOSI_PIN);
755
-      WRITE(MAX_MOSI_PIN,1);
757
+      SET_OUTPUT(MOSI_PIN);
758
+      WRITE(MOSI_PIN,1);
756 759
     
757
-      SET_INPUT(MAX_MISO_PIN);
758
-      WRITE(MAX_MISO_PIN,1);
760
+      SET_INPUT(MISO_PIN);
761
+      WRITE(MISO_PIN,1);
759 762
     #endif
763
+    /* Using pinMode and digitalWrite, as that was the only way I could get it to compile */
760 764
     
761
-    SET_OUTPUT(MAX6675_SS);
762
-    WRITE(MAX6675_SS,1);
765
+    //Have to toggle SD card CS pin to low first, to enable firmware to talk with SD card
766
+	pinMode(SS_PIN, OUTPUT);
767
+	digitalWrite(SS_PIN,0);  
768
+	pinMode(MAX6675_SS, OUTPUT);
769
+	digitalWrite(MAX6675_SS,1);
763 770
   #endif
764 771
 
765 772
   // Set analog inputs
@@ -1045,7 +1052,7 @@ void bed_max_temp_error(void) {
1045 1052
 
1046 1053
 #ifdef HEATER_0_USES_MAX6675
1047 1054
 #define MAX6675_HEAT_INTERVAL 250
1048
-long max6675_previous_millis = -HEAT_INTERVAL;
1055
+long max6675_previous_millis = MAX6675_HEAT_INTERVAL;
1049 1056
 int max6675_temp = 2000;
1050 1057
 
1051 1058
 int read_max6675()

Loading…
Cancel
Save