Skip to content

Commit

Permalink
🐛 Fix dual MAX31865 initialization issues (MarlinFirmware#23496)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeleps authored and mh-dm committed May 15, 2022
1 parent a32ca96 commit 3d949ee
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 153 deletions.
29 changes: 13 additions & 16 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,21 @@
#endif

/**
* Configuration options for MAX Thermocouples (-2, -3, -5).
* FORCE_HW_SPI: Ignore SCK/MOSI/MISO pins and just use the CS pin & default SPI bus.
* MAX31865_WIRES: Set the number of wires for the probe connected to a MAX31865 board, 2-4. Default: 2
* MAX31865_50HZ: Enable 50Hz filter instead of the default 60Hz.
* MAX31865_USE_READ_ERROR_DETECTION: Detects random read errors from value spikes (a 20°C difference in less than 1sec)
* MAX31865_USE_AUTO_MODE: Faster and more frequent reads than 1-shot, but bias voltage always on, slightly affecting RTD temperature.
* MAX31865_MIN_SAMPLING_TIME_MSEC: in 1-shot mode, the minimum time between subsequent reads. This reduces the effect of bias voltage by leaving the sensor unpowered for longer intervals.
* MAX31865_WIRE_OHMS: In 2-wire configurations, manually set the wire resistance for more accurate readings
* Thermocouple Options — for MAX6675 (-2), MAX31855 (-3), and MAX31865 (-5).
*/
//#define TEMP_SENSOR_FORCE_HW_SPI
//#define MAX31865_SENSOR_WIRES_0 2
//#define TEMP_SENSOR_FORCE_HW_SPI // Ignore SCK/MOSI/MISO pins; use CS and the default SPI bus.
//#define MAX31865_SENSOR_WIRES_0 2 // (2-4) Number of wires for the probe connected to a MAX31865 board.
//#define MAX31865_SENSOR_WIRES_1 2
//#define MAX31865_50HZ_FILTER
//#define MAX31865_USE_READ_ERROR_DETECTION
//#define MAX31865_USE_AUTO_MODE
//#define MAX31865_MIN_SAMPLING_TIME_MSEC 100
//#define MAX31865_WIRE_OHMS_0 0.0f
//#define MAX31865_WIRE_OHMS_1 0.0f

//#define MAX31865_50HZ_FILTER // Use a 50Hz filter instead of the default 60Hz.
//#define MAX31865_USE_READ_ERROR_DETECTION // Treat value spikes (20°C delta in under 1s) as read errors.

//#define MAX31865_USE_AUTO_MODE // Read faster and more often than 1-shot; bias voltage always on; slight effect on RTD temperature.
//#define MAX31865_MIN_SAMPLING_TIME_MSEC 100 // (ms) 1-shot: minimum read interval. Reduces bias voltage effects by leaving sensor unpowered for longer intervals.
//#define MAX31865_IGNORE_INITIAL_FAULTY_READS 10 // Ignore some read faults (keeping the temperature reading) to work around a possible issue (#23439).

//#define MAX31865_WIRE_OHMS_0 0.95f // For 2-wire, set the wire resistances for more accurate readings.
//#define MAX31865_WIRE_OHMS_1 0.0f

/**
* Hephestos 2 24V heated bed upgrade kit.
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/HAL/shared/Delay.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ void calibrate_delay_loop();
// Delay in microseconds
#define DELAY_US(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL))

#define DELAY_CYCLES_VAR DELAY_CYCLES

#elif defined(ESP32) || defined(__PLAT_LINUX__) || defined(__PLAT_NATIVE_SIM__)

// DELAY_CYCLES specified inside platform
Expand Down
Loading

0 comments on commit 3d949ee

Please sign in to comment.