From ab583b1a4987b5257a5affc4fd949f34984a1b6c Mon Sep 17 00:00:00 2001
From: Karl G <karl@grindleyfamily.com>
Date: Sun, 27 Dec 2020 18:23:45 -0500
Subject: [PATCH] Add error code values for thermocouple faults

The MAX31850 maintains data from the fault detection circuit in the
scratchpad, which indicates these conditions.
---
 DallasTemperature.h | 12 ++++++++++++
 keywords.txt        |  9 +++++++++
 2 files changed, 21 insertions(+)

diff --git a/DallasTemperature.h b/DallasTemperature.h
index 824a581..e708f8e 100644
--- a/DallasTemperature.h
+++ b/DallasTemperature.h
@@ -37,6 +37,18 @@
 #define DEVICE_DISCONNECTED_F -427
 #define DEVICE_DISCONNECTED_RAW -32640
 
+#define DEVICE_FAULT_OPEN_C -254
+#define DEVICE_FAULT_OPEN_F -425.199982
+#define DEVICE_FAULT_OPEN_RAW -32512
+
+#define DEVICE_FAULT_SHORTGND_C -253
+#define DEVICE_FAULT_SHORTGND_F -423.399994
+#define DEVICE_FAULT_SHORTGND_RAW -32384
+
+#define DEVICE_FAULT_SHORTVDD_C -252
+#define DEVICE_FAULT_SHORTVDD_F -421.599976
+#define DEVICE_FAULT_SHORTVDD_RAW -32256
+
 // For readPowerSupply on oneWire bus
 // definition of nullptr for C++ < 11, using official workaround:
 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
diff --git a/keywords.txt b/keywords.txt
index 2d17db8..a471c3e 100644
--- a/keywords.txt
+++ b/keywords.txt
@@ -76,3 +76,12 @@ calculateTemperature	KEYWORD2
 DEVICE_DISCONNECTED_C	LITERAL1
 DEVICE_DISCONNECTED_F	LITERAL1
 DEVICE_DISCONNECTED_RAW	LITERAL1
+DEVICE_FAULT_OPEN_C	LITERAL1
+DEVICE_FAULT_OPEN_F	LITERAL1
+DEVICE_FAULT_OPEN_RAW	LITERAL1
+DEVICE_FAULT_SHORTGND_C	LITERAL1
+DEVICE_FAULT_SHORTGND_F	LITERAL1
+DEVICE_FAULT_SHORTGND_RAW	LITERAL1
+DEVICE_FAULT_SHORTVDD_C	LITERAL1
+DEVICE_FAULT_SHORTVDD_F	LITERAL1
+DEVICE_FAULT_SHORTVDD_RAW	LITERAL1