Added check for USE_SPI enabled

Reset MAX31865_PTD_BIAS to 0 by default
This commit is contained in:
Alberto Lopez 2019-07-30 20:20:17 -03:00
parent 768ba48dbb
commit 6b4f0fd8ec
2 changed files with 8 additions and 6 deletions

View File

@ -426,14 +426,13 @@
#define USE_DHT // Add support for DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321) and SI7021 Temperature and Humidity sensor (1k6 code)
//#define USE_MAX31855 // Add support for MAX31855 K-Type thermocouple sensor using softSPI
//#define USE_MAX31865 // Add support for MAX31865 RTD sensors using softSPI
#ifdef USE_MAX31865
#define MAX31865_PTD_WIRES 2 // PTDs come in several flavors. Pick yours
#define MAX31865_PTD_RES 100 // Nominal PTD resistance at 0°C (100Ω for a PT100, 1000Ω for a PT1000, YMMV!)
#define MAX31865_REF_RES 430 // Reference resistor (Usually 430Ω for a PT100, 4300Ω for a PT1000)
#define MAX31865_PTD_BIAS -6.6 // To calibrate your not-so-good PTD
#define MAX31865_PTD_BIAS 0 // To calibrate your not-so-good PTD
#endif
// -- IR Remote features --------------------------

View File

@ -18,6 +18,11 @@
*/
#ifdef USE_MAX31865
#ifndef USE_SPI
#error "MAX31865 requires USE_SPI enabled"
#endif
#include "Adafruit_MAX31865.h"
#define XSNS_47 47
@ -74,15 +79,13 @@ void MAX31865_GetResult(void){
void MAX31865_Show(bool Json){
char temperature[33];
char resistance[33];
char srtd[33];
sprintf(srtd, "%d", MAX31865_Result.Rtd);
dtostrfd(MAX31865_Result.PtdResistance, Settings.flag2.temperature_resolution, resistance);
dtostrfd(MAX31865_Result.PtdTemp, Settings.flag2.temperature_resolution, temperature);
if(Json){
ResponseAppend_P(PSTR(",\"MAX31865\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_RESISTANCE "\":%s,\"RTD\":%s,\"" D_JSON_ERROR "\":%d}"), \
temperature, resistance, srtd, MAX31865_Result.ErrorCode);
ResponseAppend_P(PSTR(",\"MAX31865\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_RESISTANCE "\":%s,\"" D_JSON_ERROR "\":%d}"), \
temperature, resistance, MAX31865_Result.ErrorCode);
#ifdef USE_DOMOTICZ
if (0 == tele_period) {
DomoticzSensor(DZ_TEMP, temperature);