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
 #include "temperature.h"
34
 #include "temperature.h"
35
 #include "watchdog.h"
35
 #include "watchdog.h"
36
 
36
 
37
+#include "Sd2PinMap.h"
38
+
39
+
37
 //===========================================================================
40
 //===========================================================================
38
 //=============================public variables============================
41
 //=============================public variables============================
39
 //===========================================================================
42
 //===========================================================================
748
 
751
 
749
   #ifdef HEATER_0_USES_MAX6675
752
   #ifdef HEATER_0_USES_MAX6675
750
     #ifndef SDSUPPORT
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
     #endif
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
   #endif
770
   #endif
764
 
771
 
765
   // Set analog inputs
772
   // Set analog inputs
1045
 
1052
 
1046
 #ifdef HEATER_0_USES_MAX6675
1053
 #ifdef HEATER_0_USES_MAX6675
1047
 #define MAX6675_HEAT_INTERVAL 250
1054
 #define MAX6675_HEAT_INTERVAL 250
1048
-long max6675_previous_millis = -HEAT_INTERVAL;
1055
+long max6675_previous_millis = MAX6675_HEAT_INTERVAL;
1049
 int max6675_temp = 2000;
1056
 int max6675_temp = 2000;
1050
 
1057
 
1051
 int read_max6675()
1058
 int read_max6675()

Loading…
Cancel
Save