Merge pull request #992 from Grogyan/patch-1
temperature.cpp fixes for SD card and MAX6675
This commit is contained in:
commit
8340ca6e05
2 changed files with 19 additions and 12 deletions
|
@ -823,9 +823,9 @@
|
||||||
|
|
||||||
#ifndef SDSUPPORT
|
#ifndef SDSUPPORT
|
||||||
// these pins are defined in the SD library if building with SD support
|
// these pins are defined in the SD library if building with SD support
|
||||||
#define MAX_SCK_PIN 52
|
#define SCK_PIN 52
|
||||||
#define MAX_MISO_PIN 50
|
#define MISO_PIN 50
|
||||||
#define MAX_MOSI_PIN 51
|
#define MOSI_PIN 51
|
||||||
#define MAX6675_SS 53
|
#define MAX6675_SS 53
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 49
|
#define MAX6675_SS 49
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
#include "temperature.h"
|
#include "temperature.h"
|
||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
|
|
||||||
|
#include "Sd2PinMap.h"
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//=============================public variables============================
|
//=============================public variables============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -748,18 +751,22 @@ void tp_init()
|
||||||
|
|
||||||
#ifdef HEATER_0_USES_MAX6675
|
#ifdef HEATER_0_USES_MAX6675
|
||||||
#ifndef SDSUPPORT
|
#ifndef SDSUPPORT
|
||||||
SET_OUTPUT(MAX_SCK_PIN);
|
SET_OUTPUT(SCK_PIN);
|
||||||
WRITE(MAX_SCK_PIN,0);
|
WRITE(SCK_PIN,0);
|
||||||
|
|
||||||
SET_OUTPUT(MAX_MOSI_PIN);
|
SET_OUTPUT(MOSI_PIN);
|
||||||
WRITE(MAX_MOSI_PIN,1);
|
WRITE(MOSI_PIN,1);
|
||||||
|
|
||||||
SET_INPUT(MAX_MISO_PIN);
|
SET_INPUT(MISO_PIN);
|
||||||
WRITE(MAX_MISO_PIN,1);
|
WRITE(MISO_PIN,1);
|
||||||
#endif
|
#endif
|
||||||
|
/* Using pinMode and digitalWrite, as that was the only way I could get it to compile */
|
||||||
|
|
||||||
SET_OUTPUT(MAX6675_SS);
|
//Have to toggle SD card CS pin to low first, to enable firmware to talk with SD card
|
||||||
WRITE(MAX6675_SS,1);
|
pinMode(SS_PIN, OUTPUT);
|
||||||
|
digitalWrite(SS_PIN,0);
|
||||||
|
pinMode(MAX6675_SS, OUTPUT);
|
||||||
|
digitalWrite(MAX6675_SS,1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set analog inputs
|
// Set analog inputs
|
||||||
|
@ -1045,7 +1052,7 @@ void bed_max_temp_error(void) {
|
||||||
|
|
||||||
#ifdef HEATER_0_USES_MAX6675
|
#ifdef HEATER_0_USES_MAX6675
|
||||||
#define MAX6675_HEAT_INTERVAL 250
|
#define MAX6675_HEAT_INTERVAL 250
|
||||||
long max6675_previous_millis = -HEAT_INTERVAL;
|
long max6675_previous_millis = MAX6675_HEAT_INTERVAL;
|
||||||
int max6675_temp = 2000;
|
int max6675_temp = 2000;
|
||||||
|
|
||||||
int read_max6675()
|
int read_max6675()
|
||||||
|
|
Reference in a new issue