Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MAX6675 sensor (v2) #8616

Merged
merged 1 commit into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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