Skip to content

Commit

Permalink
Merge pull request #8616 from aik/development-v2
Browse files Browse the repository at this point in the history
Add MAX6675 sensor (v2)
  • Loading branch information
arendst authored Jun 4, 2020
2 parents a799ba3 + 5558da5 commit 676a13f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tasmota/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t fade_at_startup : 1; // bit 9 (v8.2.0.3) - SetOption91 - Enable light fading at start/power on
uint32_t pwm_ct_mode : 1; // bit 10 (v8.2.0.4) - SetOption92 - Set PWM Mode from regular PWM to ColorTemp control (Xiaomi Philips ...)
uint32_t compress_rules_cpu : 1; // bit 11 (v8.2.0.6) - SetOption93 - Keep uncompressed rules in memory to avoid CPU load of uncompressing at each tick
uint32_t spare12 : 1;
uint32_t max6675 : 1; // bit 12 (v8.3.1.2) - SetOption94 - Implement simpler MAX6675 protocol instead of MAX31855
uint32_t spare13 : 1;
uint32_t spare14 : 1;
uint32_t spare15 : 1;
Expand Down
14 changes: 14 additions & 0 deletions tasmota/xsns_39_max31855.ino
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ void MAX31855_Init(void){
* Acquires the raw data via SPI, checks for MAX31855 errors and fills result structure
*/
void MAX31855_GetResult(void){
// Controlled via SetOption94
if (Settings.flag4.max6675) {
int32_t RawData = MAX31855_ShiftIn(16);
int32_t temp = (RawData >> 3) & ((1 << 12) - 1);

/* Occasionally the sensor returns 0xfff, consider it an error */
if (temp == ((1 << 12) - 1))
return;

MAX31855_Result.ErrorCode = 0;
MAX31855_Result.ReferenceTemperature = NAN;
MAX31855_Result.ProbeTemperature = ConvertTemp(0.25 * temp);
return;
}
int32_t RawData = MAX31855_ShiftIn(32);
uint8_t probeerror = RawData & 0x7;

Expand Down

0 comments on commit 676a13f

Please sign in to comment.