mirror of https://github.com/arendst/Tasmota.git
Merge pull request #8616 from aik/development-v2
Add MAX6675 sensor (v2)
This commit is contained in:
commit
676a13f0c2
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue