Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x

This commit is contained in:
Foxies 2020-11-12 15:38:22 +01:00
commit 4e2e521a82
67 changed files with 1250 additions and 928 deletions

3
.gitignore vendored
View file

@ -183,3 +183,6 @@ cmake-build-*
#Python #Python
__pycache__ __pycache__
#IOLogger logs
*_log.csv

View file

@ -344,9 +344,10 @@
#define AUTO_POWER_E_FANS #define AUTO_POWER_E_FANS
#define AUTO_POWER_CONTROLLERFAN #define AUTO_POWER_CONTROLLERFAN
#define AUTO_POWER_CHAMBER_FAN #define AUTO_POWER_CHAMBER_FAN
//#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU over this temperature //#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU if any extruder is over this temperature
//#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU over this temperature //#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU if the chamber is over this temperature
#define POWER_TIMEOUT 30 #define POWER_TIMEOUT 30 // (s) Turn off power if the machine is idle for this duration
//#define POWER_OFF_DELAY 60 // (s) Delay of poweroff after M81 command. Useful to let fans run for extra time.
#endif #endif
#endif #endif
@ -435,11 +436,11 @@
#define DUMMY_THERMISTOR_998_VALUE 25 #define DUMMY_THERMISTOR_998_VALUE 25
#define DUMMY_THERMISTOR_999_VALUE 100 #define DUMMY_THERMISTOR_999_VALUE 100
// Resistor values when using a MAX31865 (sensor -5) // Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
// Sensor value is typically 100 (PT100) or 1000 (PT1000) //#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
// Calibration value is typically 430 ohm for AdaFruit PT100 modules and 4300 ohm for AdaFruit PT1000 modules. //#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for AdaFruit PT100; 4300 for AdaFruit PT1000
//#define MAX31865_SENSOR_OHMS 100 //#define MAX31865_SENSOR_OHMS_1 100
//#define MAX31865_CALIBRATION_OHMS 430 //#define MAX31865_CALIBRATION_OHMS_1 430
// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings // Use temp sensor 1 as a redundant sensor with sensor 0. If the readings
// from the two sensors differ too much the print will be aborted. // from the two sensors differ too much the print will be aborted.
@ -747,7 +748,7 @@
* Override with M92 * Override with M92
* X, Y, Z, E0 [, E1[, E2...]] * X, Y, Z, E0 [, E1[, E2...]]
*/ */
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 4000, 500 } #define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 500 }
/** /**
* Default Max Feed Rate (mm/s) * Default Max Feed Rate (mm/s)
@ -1185,9 +1186,27 @@
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500. #define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present. #define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. #define FIL_RUNOUT_PULL // Use internal pullup / pulldown for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
// Override individually if the runout sensors vary
//#define FIL_RUNOUT1_STATE LOW
//#define FIL_RUNOUT1_PULL
//#define FIL_RUNOUT2_STATE LOW
//#define FIL_RUNOUT2_PULL
//#define FIL_RUNOUT3_STATE LOW
//#define FIL_RUNOUT3_PULL
//#define FIL_RUNOUT4_STATE LOW
//#define FIL_RUNOUT4_PULL
//#define FIL_RUNOUT5_STATE LOW
//#define FIL_RUNOUT5_PULL
//#define FIL_RUNOUT6_STATE LOW
//#define FIL_RUNOUT6_PULL
//#define FIL_RUNOUT7_STATE LOW
//#define FIL_RUNOUT7_PULL
//#define FIL_RUNOUT8_STATE LOW
//#define FIL_RUNOUT8_PULL
// Set one or more commands to execute on filament runout. // Set one or more commands to execute on filament runout.
// (After 'M412 H' Marlin will ask the host to handle the process.) // (After 'M412 H' Marlin will ask the host to handle the process.)

View file

@ -660,6 +660,7 @@
//#define QUICK_HOME // If G28 contains XY do a diagonal move first //#define QUICK_HOME // If G28 contains XY do a diagonal move first
//#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X //#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X
//#define HOME_Z_FIRST // Home Z first. Requires a Z-MIN endstop (not a probe).
//#define CODEPENDENT_XY_HOMING // If X/Y can't home without homing Y/X first //#define CODEPENDENT_XY_HOMING // If X/Y can't home without homing Y/X first
// @section bltouch // @section bltouch
@ -811,6 +812,7 @@
//#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item to run G35 Assisted Tramming (MarlinUI) //#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item to run G35 Assisted Tramming (MarlinUI)
//#define ASSISTED_TRAMMING_WIZARD // Make the menu item open a Tramming Wizard sub-menu //#define ASSISTED_TRAMMING_WIZARD // Make the menu item open a Tramming Wizard sub-menu
//#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment
/** /**
* Screw thread: * Screw thread:
@ -1171,6 +1173,7 @@
// Enable this option and set to HIGH if your SD cards are incorrectly detected. // Enable this option and set to HIGH if your SD cards are incorrectly detected.
//#define SD_DETECT_STATE HIGH //#define SD_DETECT_STATE HIGH
//#define SD_IGNORE_AT_STARTUP // Don't mount the SD card when starting up
//#define SDCARD_READONLY // Read-only SD card (to save over 2K of flash) //#define SDCARD_READONLY // Read-only SD card (to save over 2K of flash)
#define SD_PROCEDURE_DEPTH 1 // Increase if you need more nested M32 calls #define SD_PROCEDURE_DEPTH 1 // Increase if you need more nested M32 calls
@ -1255,6 +1258,10 @@
// Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM.
#endif #endif
// Allow international symbols in long filenames. To display correctly, the
// LCD's font must contain the characters. Check your selected LCD language.
#define UTF_FILENAME_SUPPORT
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT //#define LONG_FILENAME_HOST_SUPPORT

View file

@ -163,6 +163,9 @@
#define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT(IO) _SET_INPUT(IO)
// Set pin as input with pullup (wrapper) // Set pin as input with pullup (wrapper)
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
// Set pin as input with pulldown (substitution)
#define SET_INPUT_PULLDOWN SET_INPUT
// Set pin as output (wrapper) - reads the pin and sets the output to that value // Set pin as output (wrapper) - reads the pin and sets the output to that value
#define SET_OUTPUT(IO) _SET_OUTPUT(IO) #define SET_OUTPUT(IO) _SET_OUTPUT(IO)
// Set pin as PWM // Set pin as PWM

View file

@ -52,6 +52,9 @@
// Set pin as input with pullup wrapper // Set pin as input with pullup wrapper
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
// Set pin as input with pulldown (substitution)
#define SET_INPUT_PULLDOWN SET_INPUT
// Set pin as output wrapper // Set pin as output wrapper
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0) #define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)

View file

@ -19,22 +19,23 @@
*/ */
#ifdef __PLAT_LINUX__ #ifdef __PLAT_LINUX__
extern void setup(); //#define GPIO_LOGGING // Full GPIO and Positional Logging
extern void loop();
#include <thread>
#include <iostream>
#include <fstream>
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include <stdio.h>
#include <stdarg.h>
#include "../shared/Delay.h" #include "../shared/Delay.h"
#include "hardware/IOLoggerCSV.h" #include "hardware/IOLoggerCSV.h"
#include "hardware/Heater.h" #include "hardware/Heater.h"
#include "hardware/LinearAxis.h" #include "hardware/LinearAxis.h"
#include <stdio.h>
#include <stdarg.h>
#include <thread>
#include <iostream>
#include <fstream>
extern void setup();
extern void loop();
// simple stdout / stdin implementation for fake serial port // simple stdout / stdin implementation for fake serial port
void write_serial_thread() { void write_serial_thread() {
for (;;) { for (;;) {
@ -64,8 +65,6 @@ void simulation_loop() {
LinearAxis z_axis(Z_ENABLE_PIN, Z_DIR_PIN, Z_STEP_PIN, Z_MIN_PIN, Z_MAX_PIN); LinearAxis z_axis(Z_ENABLE_PIN, Z_DIR_PIN, Z_STEP_PIN, Z_MIN_PIN, Z_MAX_PIN);
LinearAxis extruder0(E0_ENABLE_PIN, E0_DIR_PIN, E0_STEP_PIN, P_NC, P_NC); LinearAxis extruder0(E0_ENABLE_PIN, E0_DIR_PIN, E0_STEP_PIN, P_NC, P_NC);
//#define GPIO_LOGGING // Full GPIO and Positional Logging
#ifdef GPIO_LOGGING #ifdef GPIO_LOGGING
IOLoggerCSV logger("all_gpio_log.csv"); IOLoggerCSV logger("all_gpio_log.csv");
Gpio::attachLogger(&logger); Gpio::attachLogger(&logger);
@ -88,7 +87,7 @@ void simulation_loop() {
#ifdef GPIO_LOGGING #ifdef GPIO_LOGGING
if (x_axis.position != x || y_axis.position != y || z_axis.position != z) { if (x_axis.position != x || y_axis.position != y || z_axis.position != z) {
uint64_t update = MAX3(x_axis.last_update, y_axis.last_update, z_axis.last_update); uint64_t update = _MAX(x_axis.last_update, y_axis.last_update, z_axis.last_update);
position_log << update << ", " << x_axis.position << ", " << y_axis.position << ", " << z_axis.position << std::endl; position_log << update << ", " << x_axis.position << ", " << y_axis.position << ", " << z_axis.position << std::endl;
position_log.flush(); position_log.flush();
x = x_axis.position; x = x_axis.position;

View file

@ -20,6 +20,8 @@
* *
*/ */
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#include "MarlinSPI.h" #include "MarlinSPI.h"
static void spi_init(spi_t *obj, uint32_t speed, spi_mode_e mode, uint8_t msb, uint32_t dataSize) { static void spi_init(spi_t *obj, uint32_t speed, spi_mode_e mode, uint8_t msb, uint32_t dataSize) {
@ -159,3 +161,5 @@ uint8_t MarlinSPI::dmaSend(const void * transmitBuf, uint16_t length, bool minc)
HAL_DMA_DeInit(&_dmaTx); HAL_DMA_DeInit(&_dmaTx);
return 1; return 1;
} }
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

View file

@ -509,7 +509,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
kill(); kill();
} }
// M18 / M94 : Handle steppers inactive time timeout // M18 / M84 : Handle steppers inactive time timeout
if (gcode.stepper_inactive_time) { if (gcode.stepper_inactive_time) {
static bool already_shutdown_steppers; // = false static bool already_shutdown_steppers; // = false
@ -991,6 +991,14 @@ void setup() {
SETUP_RUN(HAL_init()); SETUP_RUN(HAL_init());
// Init and disable SPI thermocouples
#if HEATER_0_USES_MAX6675
OUT_WRITE(MAX6675_SS_PIN, HIGH); // Disable
#endif
#if HEATER_1_USES_MAX6675
OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable
#endif
#if HAS_L64XX #if HAS_L64XX
SETUP_RUN(L64xxManager.init()); // Set up SPI, init drivers SETUP_RUN(L64xxManager.init()); // Set up SPI, init drivers
#endif #endif

View file

@ -94,9 +94,11 @@ extern bool wait_for_heatup;
#if ENABLED(AUTO_POWER_CONTROL) #if ENABLED(AUTO_POWER_CONTROL)
#define PSU_ON() powerManager.power_on() #define PSU_ON() powerManager.power_on()
#define PSU_OFF() powerManager.power_off() #define PSU_OFF() powerManager.power_off()
#define PSU_OFF_SOON() powerManager.power_off_soon()
#else #else
#define PSU_ON() PSU_PIN_ON() #define PSU_ON() PSU_PIN_ON()
#define PSU_OFF() PSU_PIN_OFF() #define PSU_OFF() PSU_PIN_OFF()
#define PSU_OFF_SOON PSU_OFF
#endif #endif
#endif #endif

View file

@ -34,6 +34,8 @@ uint8_t ControllerFan::speed;
#if ENABLED(CONTROLLER_FAN_EDITABLE) #if ENABLED(CONTROLLER_FAN_EDITABLE)
controllerFan_settings_t ControllerFan::settings; // {0} controllerFan_settings_t ControllerFan::settings; // {0}
#else
const controllerFan_settings_t &ControllerFan::settings = controllerFan_defaults;
#endif #endif
void ControllerFan::setup() { void ControllerFan::setup() {

View file

@ -58,7 +58,7 @@ class ControllerFan {
#if ENABLED(CONTROLLER_FAN_EDITABLE) #if ENABLED(CONTROLLER_FAN_EDITABLE)
static controllerFan_settings_t settings; static controllerFan_settings_t settings;
#else #else
static const controllerFan_settings_t constexpr &settings = controllerFan_defaults; static const controllerFan_settings_t &settings;
#endif #endif
static inline bool state() { return speed > 0; } static inline bool state() { return speed > 0; }
static inline void init() { reset(); } static inline void init() { reset(); }

View file

@ -163,7 +163,7 @@ uint8_t MMU2::get_current_tool() {
} }
#if EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR) #if EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE) #define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
#endif #endif
void MMU2::mmu_loop() { void MMU2::mmu_loop() {

View file

@ -126,4 +126,12 @@ void Power::power_off() {
} }
} }
void Power::power_off_soon() {
#if POWER_OFF_DELAY
lastPowerOn = millis() - SEC_TO_MS(POWER_TIMEOUT) + SEC_TO_MS(POWER_OFF_DELAY);
#else
power_off();
#endif
}
#endif // AUTO_POWER_CONTROL #endif // AUTO_POWER_CONTROL

View file

@ -32,6 +32,7 @@ class Power {
static void check(); static void check();
static void power_on(); static void power_on();
static void power_off(); static void power_off();
static void power_off_soon();
private: private:
static millis_t lastPowerOn; static millis_t lastPowerOn;
static bool is_power_needed(); static bool is_power_needed();

View file

@ -433,13 +433,15 @@ void PrintJobRecovery::resume() {
#endif #endif
// Restore print cooling fan speeds // Restore print cooling fan speeds
#if HAS_FAN
FANS_LOOP(i) { FANS_LOOP(i) {
uint8_t f = info.fan_speed[i]; const int f = info.fan_speed[i];
if (f) { if (f) {
sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f); sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f);
gcode.process_subcommands_now(cmd); gcode.process_subcommands_now(cmd);
} }
} }
#endif
// Restore retract and hop state // Restore retract and hop state
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)

View file

@ -149,17 +149,33 @@ class FilamentSensorBase {
public: public:
static inline void setup() { static inline void setup() {
#if ENABLED(FIL_RUNOUT_PULLUP) #define _INIT_RUNOUT_PIN(P,S,U) do{ if (DISABLED(U)) SET_INPUT(P); else if (S) SET_INPUT_PULLDOWN(P); else SET_INPUT_PULLUP(P); }while(0)
#define INIT_RUNOUT_PIN(P) SET_INPUT_PULLUP(P) #define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULL)
#elif ENABLED(FIL_RUNOUT_PULLDOWN) #if NUM_RUNOUT_SENSORS >= 1
#define INIT_RUNOUT_PIN(P) SET_INPUT_PULLDOWN(P) INIT_RUNOUT_PIN(1);
#else
#define INIT_RUNOUT_PIN(P) SET_INPUT(P)
#endif #endif
#if NUM_RUNOUT_SENSORS >= 2
#define _INIT_RUNOUT(N) INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN); INIT_RUNOUT_PIN(2);
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _INIT_RUNOUT) #endif
#undef _INIT_RUNOUT #if NUM_RUNOUT_SENSORS >= 3
INIT_RUNOUT_PIN(3);
#endif
#if NUM_RUNOUT_SENSORS >= 4
INIT_RUNOUT_PIN(4);
#endif
#if NUM_RUNOUT_SENSORS >= 5
INIT_RUNOUT_PIN(5);
#endif
#if NUM_RUNOUT_SENSORS >= 6
INIT_RUNOUT_PIN(6);
#endif
#if NUM_RUNOUT_SENSORS >= 7
INIT_RUNOUT_PIN(7);
#endif
#if NUM_RUNOUT_SENSORS >= 8
INIT_RUNOUT_PIN(8);
#endif
#undef _INIT_RUNOUT_PIN
#undef INIT_RUNOUT_PIN #undef INIT_RUNOUT_PIN
} }
@ -172,11 +188,32 @@ class FilamentSensorBase {
// Return a bitmask of runout flag states (1 bits always indicates runout) // Return a bitmask of runout flag states (1 bits always indicates runout)
static inline uint8_t poll_runout_states() { static inline uint8_t poll_runout_states() {
return poll_runout_pins() return poll_runout_pins() ^ uint8_t(0
#if FIL_RUNOUT_STATE == LOW #if NUM_RUNOUT_SENSORS >= 1
^ uint8_t(_BV(NUM_RUNOUT_SENSORS) - 1) | (FIL_RUNOUT1_STATE ? 0 : _BV(1 - 1))
#endif #endif
; #if NUM_RUNOUT_SENSORS >= 2
| (FIL_RUNOUT2_STATE ? 0 : _BV(2 - 1))
#endif
#if NUM_RUNOUT_SENSORS >= 3
| (FIL_RUNOUT3_STATE ? 0 : _BV(3 - 1))
#endif
#if NUM_RUNOUT_SENSORS >= 4
| (FIL_RUNOUT4_STATE ? 0 : _BV(4 - 1))
#endif
#if NUM_RUNOUT_SENSORS >= 5
| (FIL_RUNOUT5_STATE ? 0 : _BV(5 - 1))
#endif
#if NUM_RUNOUT_SENSORS >= 6
| (FIL_RUNOUT6_STATE ? 0 : _BV(6 - 1))
#endif
#if NUM_RUNOUT_SENSORS >= 7
| (FIL_RUNOUT7_STATE ? 0 : _BV(7 - 1))
#endif
#if NUM_RUNOUT_SENSORS >= 8
| (FIL_RUNOUT8_STATE ? 0 : _BV(8 - 1))
#endif
);
} }
}; };

View file

@ -120,8 +120,7 @@ void GcodeSuite::G35() {
// In BLTOUCH HS mode, the probe travels in a deployed state. // In BLTOUCH HS mode, the probe travels in a deployed state.
// Users of G35 might have a badly misaligned bed, so raise Z by the // Users of G35 might have a badly misaligned bed, so raise Z by the
// length of the deployed pin (BLTOUCH stroke < 7mm) // length of the deployed pin (BLTOUCH stroke < 7mm)
current_position.z = (Z_CLEARANCE_BETWEEN_PROBES) + (7 * ENABLED(BLTOUCH_HS_MODE)); do_blocking_move_to_z((Z_CLEARANCE_BETWEEN_PROBES) + TERN0(BLTOUCH_HS_MODE, 7));
const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[i], PROBE_PT_RAISE, 0, true); const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[i], PROBE_PT_RAISE, 0, true);
if (isnan(z_probed_height)) { if (isnan(z_probed_height)) {

View file

@ -313,7 +313,7 @@ void GcodeSuite::G28() {
home_all = homeX == homeY && homeX == homeZ, // All or None home_all = homeX == homeY && homeX == homeZ, // All or None
doX = home_all || homeX, doY = home_all || homeY, doZ = home_all || homeZ; doX = home_all || homeX, doY = home_all || homeY, doZ = home_all || homeZ;
#if Z_HOME_DIR > 0 // If homing away from BED do Z first #if ENABLED(HOME_Z_FIRST)
if (doZ) homeaxis(Z_AXIS); if (doZ) homeaxis(Z_AXIS);
@ -373,18 +373,13 @@ void GcodeSuite::G28() {
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing)); TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
// Home Z last if homing towards the bed // Home Z last if homing towards the bed
#if Z_HOME_DIR < 0 #if DISABLED(HOME_Z_FIRST)
if (doZ) { if (doZ) {
TERN_(BLTOUCH, bltouch.init()); TERN_(BLTOUCH, bltouch.init());
TERN(Z_SAFE_HOMING, home_z_safely(), homeaxis(Z_AXIS)); TERN(Z_SAFE_HOMING, home_z_safely(), homeaxis(Z_AXIS));
probe.move_z_after_homing(); probe.move_z_after_homing();
}
} // doZ #endif
#endif // Z_HOME_DIR < 0
sync_plan_position(); sync_plan_position();

View file

@ -105,7 +105,7 @@ void GcodeSuite::M81() {
#if HAS_SUICIDE #if HAS_SUICIDE
suicide(); suicide();
#elif ENABLED(PSU_CONTROL) #elif ENABLED(PSU_CONTROL)
PSU_OFF(); PSU_OFF_SOON();
#endif #endif
LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF ".")); LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF "."));

View file

@ -88,7 +88,7 @@ void GcodeSuite::M600() {
// In this case, for duplicating modes set DXC_ext to the extruder that ran out. // In this case, for duplicating modes set DXC_ext to the extruder that ran out.
#if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1 #if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
if (idex_is_duplicating()) if (idex_is_duplicating())
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_STATE) ? 1 : 0; DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT2_STATE) ? 1 : 0;
#else #else
DXC_ext = active_extruder; DXC_ext = active_extruder;
#endif #endif

View file

@ -431,7 +431,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 28: M28(); break; // M28: Start SD write case 28: M28(); break; // M28: Start SD write
case 29: M29(); break; // M29: Stop SD write case 29: M29(); break; // M29: Stop SD write
case 30: M30(); break; // M30 <filename> Delete File case 30: M30(); break; // M30 <filename> Delete File
#if HAS_MEDIA_SUBCALLS
case 32: M32(); break; // M32: Select file and start SD print case 32: M32(); break; // M32: Select file and start SD print
#endif
#if ENABLED(LONG_FILENAME_HOST_SUPPORT) #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
case 33: M33(); break; // M33: Get the long full path to a file or folder case 33: M33(); break; // M33: Get the long full path to a file or folder

View file

@ -541,7 +541,7 @@ private:
static void M31(); static void M31();
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
static void M32(); TERN_(HAS_MEDIA_SUBCALLS, static void M32());
TERN_(LONG_FILENAME_HOST_SUPPORT, static void M33()); TERN_(LONG_FILENAME_HOST_SUPPORT, static void M33());
#if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE) #if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE)
static void M34(); static void M34();

View file

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT) #if HAS_MEDIA_SUBCALLS
#include "../gcode.h" #include "../gcode.h"
#include "../../sd/cardreader.h" #include "../../sd/cardreader.h"
@ -56,4 +56,4 @@ void GcodeSuite::M32() {
} }
} }
#endif // SDSUPPORT #endif // HAS_MEDIA_SUBCALLS

View file

@ -675,6 +675,73 @@
#define HAS_BED_PROBE 1 #define HAS_BED_PROBE 1
#endif #endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if NUM_RUNOUT_SENSORS >= 1
#ifndef FIL_RUNOUT1_STATE
#define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT1_PULL
#define FIL_RUNOUT1_PULL FIL_RUNOUT_PULL
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 2
#ifndef FIL_RUNOUT2_STATE
#define FIL_RUNOUT2_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT2_PULL
#define FIL_RUNOUT2_PULL FIL_RUNOUT_PULL
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 3
#ifndef FIL_RUNOUT3_STATE
#define FIL_RUNOUT3_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT3_PULL
#define FIL_RUNOUT3_PULL FIL_RUNOUT_PULL
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 4
#ifndef FIL_RUNOUT4_STATE
#define FIL_RUNOUT4_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT4_PULL
#define FIL_RUNOUT4_PULL FIL_RUNOUT_PULL
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 5
#ifndef FIL_RUNOUT5_STATE
#define FIL_RUNOUT5_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT5_PULL
#define FIL_RUNOUT5_PULL FIL_RUNOUT_PULL
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 6
#ifndef FIL_RUNOUT6_STATE
#define FIL_RUNOUT6_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT6_PULL
#define FIL_RUNOUT6_PULL FIL_RUNOUT_PULL
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 7
#ifndef FIL_RUNOUT7_STATE
#define FIL_RUNOUT7_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT7_PULL
#define FIL_RUNOUT7_PULL FIL_RUNOUT_PULL
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 8
#ifndef FIL_RUNOUT8_STATE
#define FIL_RUNOUT8_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT8_PULL
#define FIL_RUNOUT8_PULL FIL_RUNOUT_PULL
#endif
#endif
#endif // FILAMENT_RUNOUT_SENSOR
#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) #if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
#undef PROBE_MANUALLY #undef PROBE_MANUALLY
#endif #endif
@ -711,6 +778,10 @@
#undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
#endif #endif
#if Z_HOME_DIR > 0
#define HOME_Z_FIRST // If homing away from BED do Z first
#endif
/** /**
* Set granular options based on the specific type of leveling * Set granular options based on the specific type of leveling
*/ */

View file

@ -146,6 +146,10 @@
#define HAS_PRINT_PROGRESS 1 #define HAS_PRINT_PROGRESS 1
#endif #endif
#if ENABLED(SDSUPPORT) && SD_PROCEDURE_DEPTH
#define HAS_MEDIA_SUBCALLS 1
#endif
#if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME) #if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME)
#define HAS_PRINT_PROGRESS_PERMYRIAD 1 #define HAS_PRINT_PROGRESS_PERMYRIAD 1
#endif #endif

View file

@ -416,8 +416,13 @@
#endif #endif
#endif #endif
#if !defined(PSU_POWERUP_DELAY) && ENABLED(PSU_CONTROL) #if ENABLED(PSU_CONTROL)
#ifndef PSU_POWERUP_DELAY
#define PSU_POWERUP_DELAY 250 #define PSU_POWERUP_DELAY 250
#endif
#ifndef POWER_OFF_DELAY
#define POWER_OFF_DELAY 0
#endif
#endif #endif
/** /**
@ -431,7 +436,7 @@
#endif #endif
#if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2 #if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
#define HEATER_0_USES_MAX6675 #define HEATER_0_USES_MAX6675 1
#if TEMP_SENSOR_0 == -3 #if TEMP_SENSOR_0 == -3
#define HEATER_0_MAX6675_TMIN -270 #define HEATER_0_MAX6675_TMIN -270
#define HEATER_0_MAX6675_TMAX 1800 #define HEATER_0_MAX6675_TMAX 1800
@ -440,19 +445,19 @@
#define HEATER_0_MAX6675_TMAX 1024 #define HEATER_0_MAX6675_TMAX 1024
#endif #endif
#if TEMP_SENSOR_0 == -5 #if TEMP_SENSOR_0 == -5
#define MAX6675_IS_MAX31865 #define MAX6675_0_IS_MAX31865 1
#elif TEMP_SENSOR_0 == -3 #elif TEMP_SENSOR_0 == -3
#define MAX6675_IS_MAX31855 #define MAX6675_0_IS_MAX31855 1
#endif #endif
#elif TEMP_SENSOR_0 == -4 #elif TEMP_SENSOR_0 == -4
#define HEATER_0_USES_AD8495 #define HEATER_0_USES_AD8495 1
#elif TEMP_SENSOR_0 == -1 #elif TEMP_SENSOR_0 == -1
#define HEATER_0_USES_AD595 #define HEATER_0_USES_AD595 1
#elif TEMP_SENSOR_0 > 0 #elif TEMP_SENSOR_0 > 0
#define THERMISTOR_HEATER_0 TEMP_SENSOR_0 #define THERMISTOR_HEATER_0 TEMP_SENSOR_0
#define HEATER_0_USES_THERMISTOR #define HEATER_0_USES_THERMISTOR 1
#if TEMP_SENSOR_0 == 1000 #if TEMP_SENSOR_0 == 1000
#define HEATER_0_USER_THERMISTOR #define HEATER_0_USER_THERMISTOR 1
#endif #endif
#else #else
#undef HEATER_0_MINTEMP #undef HEATER_0_MINTEMP
@ -460,7 +465,7 @@
#endif #endif
#if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2 #if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
#define HEATER_1_USES_MAX6675 #define HEATER_1_USES_MAX6675 1
#if TEMP_SENSOR_1 == -3 #if TEMP_SENSOR_1 == -3
#define HEATER_1_MAX6675_TMIN -270 #define HEATER_1_MAX6675_TMIN -270
#define HEATER_1_MAX6675_TMAX 1800 #define HEATER_1_MAX6675_TMAX 1800
@ -468,6 +473,11 @@
#define HEATER_1_MAX6675_TMIN 0 #define HEATER_1_MAX6675_TMIN 0
#define HEATER_1_MAX6675_TMAX 1024 #define HEATER_1_MAX6675_TMAX 1024
#endif #endif
#if TEMP_SENSOR_1 == -5
#define MAX6675_1_IS_MAX31865 1
#elif TEMP_SENSOR_1 == -3
#define MAX6675_1_IS_MAX31855 1
#endif
#if TEMP_SENSOR_1 != TEMP_SENSOR_0 #if TEMP_SENSOR_1 != TEMP_SENSOR_0
#if TEMP_SENSOR_1 == -5 #if TEMP_SENSOR_1 == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match." #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
@ -478,14 +488,14 @@
#endif #endif
#endif #endif
#elif TEMP_SENSOR_1 == -4 #elif TEMP_SENSOR_1 == -4
#define HEATER_1_USES_AD8495 #define HEATER_1_USES_AD8495 1
#elif TEMP_SENSOR_1 == -1 #elif TEMP_SENSOR_1 == -1
#define HEATER_1_USES_AD595 #define HEATER_1_USES_AD595 1
#elif TEMP_SENSOR_1 > 0 #elif TEMP_SENSOR_1 > 0
#define THERMISTOR_HEATER_1 TEMP_SENSOR_1 #define THERMISTOR_HEATER_1 TEMP_SENSOR_1
#define HEATER_1_USES_THERMISTOR #define HEATER_1_USES_THERMISTOR 1
#if TEMP_SENSOR_1 == 1000 #if TEMP_SENSOR_1 == 1000
#define HEATER_1_USER_THERMISTOR #define HEATER_1_USER_THERMISTOR 1
#endif #endif
#else #else
#undef HEATER_1_MINTEMP #undef HEATER_1_MINTEMP
@ -493,18 +503,18 @@
#endif #endif
#if TEMP_SENSOR_2 == -4 #if TEMP_SENSOR_2 == -4
#define HEATER_2_USES_AD8495 #define HEATER_2_USES_AD8495 1
#elif TEMP_SENSOR_2 == -3 #elif TEMP_SENSOR_2 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2." #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2."
#elif TEMP_SENSOR_2 == -2 #elif TEMP_SENSOR_2 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2." #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2."
#elif TEMP_SENSOR_2 == -1 #elif TEMP_SENSOR_2 == -1
#define HEATER_2_USES_AD595 #define HEATER_2_USES_AD595 1
#elif TEMP_SENSOR_2 > 0 #elif TEMP_SENSOR_2 > 0
#define THERMISTOR_HEATER_2 TEMP_SENSOR_2 #define THERMISTOR_HEATER_2 TEMP_SENSOR_2
#define HEATER_2_USES_THERMISTOR #define HEATER_2_USES_THERMISTOR 1
#if TEMP_SENSOR_2 == 1000 #if TEMP_SENSOR_2 == 1000
#define HEATER_2_USER_THERMISTOR #define HEATER_2_USER_THERMISTOR 1
#endif #endif
#else #else
#undef HEATER_2_MINTEMP #undef HEATER_2_MINTEMP
@ -512,18 +522,18 @@
#endif #endif
#if TEMP_SENSOR_3 == -4 #if TEMP_SENSOR_3 == -4
#define HEATER_3_USES_AD8495 #define HEATER_3_USES_AD8495 1
#elif TEMP_SENSOR_3 == -3 #elif TEMP_SENSOR_3 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3." #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
#elif TEMP_SENSOR_3 == -2 #elif TEMP_SENSOR_3 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3." #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3."
#elif TEMP_SENSOR_3 == -1 #elif TEMP_SENSOR_3 == -1
#define HEATER_3_USES_AD595 #define HEATER_3_USES_AD595 1
#elif TEMP_SENSOR_3 > 0 #elif TEMP_SENSOR_3 > 0
#define THERMISTOR_HEATER_3 TEMP_SENSOR_3 #define THERMISTOR_HEATER_3 TEMP_SENSOR_3
#define HEATER_3_USES_THERMISTOR #define HEATER_3_USES_THERMISTOR 1
#if TEMP_SENSOR_3 == 1000 #if TEMP_SENSOR_3 == 1000
#define HEATER_3_USER_THERMISTOR #define HEATER_3_USER_THERMISTOR 1
#endif #endif
#else #else
#undef HEATER_3_MINTEMP #undef HEATER_3_MINTEMP
@ -531,18 +541,18 @@
#endif #endif
#if TEMP_SENSOR_4 == -4 #if TEMP_SENSOR_4 == -4
#define HEATER_4_USES_AD8495 #define HEATER_4_USES_AD8495 1
#elif TEMP_SENSOR_4 == -3 #elif TEMP_SENSOR_4 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4." #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
#elif TEMP_SENSOR_4 == -2 #elif TEMP_SENSOR_4 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4." #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4."
#elif TEMP_SENSOR_4 == -1 #elif TEMP_SENSOR_4 == -1
#define HEATER_4_USES_AD595 #define HEATER_4_USES_AD595 1
#elif TEMP_SENSOR_4 > 0 #elif TEMP_SENSOR_4 > 0
#define THERMISTOR_HEATER_4 TEMP_SENSOR_4 #define THERMISTOR_HEATER_4 TEMP_SENSOR_4
#define HEATER_4_USES_THERMISTOR #define HEATER_4_USES_THERMISTOR 1
#if TEMP_SENSOR_4 == 1000 #if TEMP_SENSOR_4 == 1000
#define HEATER_4_USER_THERMISTOR #define HEATER_4_USER_THERMISTOR 1
#endif #endif
#else #else
#undef HEATER_4_MINTEMP #undef HEATER_4_MINTEMP
@ -550,18 +560,18 @@
#endif #endif
#if TEMP_SENSOR_5 == -4 #if TEMP_SENSOR_5 == -4
#define HEATER_5_USES_AD8495 #define HEATER_5_USES_AD8495 1
#elif TEMP_SENSOR_5 == -3 #elif TEMP_SENSOR_5 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5." #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
#elif TEMP_SENSOR_5 == -2 #elif TEMP_SENSOR_5 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5." #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5."
#elif TEMP_SENSOR_5 == -1 #elif TEMP_SENSOR_5 == -1
#define HEATER_5_USES_AD595 #define HEATER_5_USES_AD595 1
#elif TEMP_SENSOR_5 > 0 #elif TEMP_SENSOR_5 > 0
#define THERMISTOR_HEATER_5 TEMP_SENSOR_5 #define THERMISTOR_HEATER_5 TEMP_SENSOR_5
#define HEATER_5_USES_THERMISTOR #define HEATER_5_USES_THERMISTOR 1
#if TEMP_SENSOR_5 == 1000 #if TEMP_SENSOR_5 == 1000
#define HEATER_5_USER_THERMISTOR #define HEATER_5_USER_THERMISTOR 1
#endif #endif
#else #else
#undef HEATER_5_MINTEMP #undef HEATER_5_MINTEMP
@ -569,18 +579,18 @@
#endif #endif
#if TEMP_SENSOR_6 == -4 #if TEMP_SENSOR_6 == -4
#define HEATER_6_USES_AD8495 #define HEATER_6_USES_AD8495 1
#elif TEMP_SENSOR_6 == -3 #elif TEMP_SENSOR_6 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6." #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
#elif TEMP_SENSOR_6 == -2 #elif TEMP_SENSOR_6 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6." #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6."
#elif TEMP_SENSOR_6 == -1 #elif TEMP_SENSOR_6 == -1
#define HEATER_6_USES_AD595 #define HEATER_6_USES_AD595 1
#elif TEMP_SENSOR_6 > 0 #elif TEMP_SENSOR_6 > 0
#define THERMISTOR_HEATER_6 TEMP_SENSOR_6 #define THERMISTOR_HEATER_6 TEMP_SENSOR_6
#define HEATER_6_USES_THERMISTOR #define HEATER_6_USES_THERMISTOR 1
#if TEMP_SENSOR_6 == 1000 #if TEMP_SENSOR_6 == 1000
#define HEATER_6_USER_THERMISTOR #define HEATER_6_USER_THERMISTOR 1
#endif #endif
#else #else
#undef HEATER_6_MINTEMP #undef HEATER_6_MINTEMP
@ -588,18 +598,18 @@
#endif #endif
#if TEMP_SENSOR_7 == -4 #if TEMP_SENSOR_7 == -4
#define HEATER_7_USES_AD8495 #define HEATER_7_USES_AD8495 1
#elif TEMP_SENSOR_7 == -3 #elif TEMP_SENSOR_7 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7." #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
#elif TEMP_SENSOR_7 == -2 #elif TEMP_SENSOR_7 == -2
#error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7." #error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7."
#elif TEMP_SENSOR_7 == -1 #elif TEMP_SENSOR_7 == -1
#define HEATER_7_USES_AD595 #define HEATER_7_USES_AD595 1
#elif TEMP_SENSOR_7 > 0 #elif TEMP_SENSOR_7 > 0
#define THERMISTOR_HEATER_7 TEMP_SENSOR_7 #define THERMISTOR_HEATER_7 TEMP_SENSOR_7
#define HEATER_7_USES_THERMISTOR #define HEATER_7_USES_THERMISTOR 1
#if TEMP_SENSOR_7 == 1000 #if TEMP_SENSOR_7 == 1000
#define HEATER_7_USER_THERMISTOR #define HEATER_7_USER_THERMISTOR 1
#endif #endif
#else #else
#undef HEATER_7_MINTEMP #undef HEATER_7_MINTEMP
@ -607,18 +617,18 @@
#endif #endif
#if TEMP_SENSOR_BED == -4 #if TEMP_SENSOR_BED == -4
#define HEATER_BED_USES_AD8495 #define HEATER_BED_USES_AD8495 1
#elif TEMP_SENSOR_BED == -3 #elif TEMP_SENSOR_BED == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED." #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
#elif TEMP_SENSOR_BED == -2 #elif TEMP_SENSOR_BED == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED." #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED."
#elif TEMP_SENSOR_BED == -1 #elif TEMP_SENSOR_BED == -1
#define HEATER_BED_USES_AD595 #define HEATER_BED_USES_AD595 1
#elif TEMP_SENSOR_BED > 0 #elif TEMP_SENSOR_BED > 0
#define THERMISTORBED TEMP_SENSOR_BED #define THERMISTORBED TEMP_SENSOR_BED
#define HEATER_BED_USES_THERMISTOR #define HEATER_BED_USES_THERMISTOR 1
#if TEMP_SENSOR_BED == 1000 #if TEMP_SENSOR_BED == 1000
#define HEATER_BED_USER_THERMISTOR #define HEATER_BED_USER_THERMISTOR 1
#endif #endif
#else #else
#undef BED_MINTEMP #undef BED_MINTEMP
@ -626,18 +636,18 @@
#endif #endif
#if TEMP_SENSOR_CHAMBER == -4 #if TEMP_SENSOR_CHAMBER == -4
#define HEATER_CHAMBER_USES_AD8495 #define HEATER_CHAMBER_USES_AD8495 1
#elif TEMP_SENSOR_CHAMBER == -3 #elif TEMP_SENSOR_CHAMBER == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER." #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
#elif TEMP_SENSOR_CHAMBER == -2 #elif TEMP_SENSOR_CHAMBER == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER." #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER."
#elif TEMP_SENSOR_CHAMBER == -1 #elif TEMP_SENSOR_CHAMBER == -1
#define HEATER_CHAMBER_USES_AD595 #define HEATER_CHAMBER_USES_AD595 1
#elif TEMP_SENSOR_CHAMBER > 0 #elif TEMP_SENSOR_CHAMBER > 0
#define THERMISTORCHAMBER TEMP_SENSOR_CHAMBER #define THERMISTORCHAMBER TEMP_SENSOR_CHAMBER
#define HEATER_CHAMBER_USES_THERMISTOR #define HEATER_CHAMBER_USES_THERMISTOR 1
#if TEMP_SENSOR_CHAMBER == 1000 #if TEMP_SENSOR_CHAMBER == 1000
#define HEATER_CHAMBER_USER_THERMISTOR #define HEATER_CHAMBER_USER_THERMISTOR 1
#endif #endif
#else #else
#undef CHAMBER_MINTEMP #undef CHAMBER_MINTEMP
@ -645,25 +655,21 @@
#endif #endif
#if TEMP_SENSOR_PROBE == -4 #if TEMP_SENSOR_PROBE == -4
#define HEATER_PROBE_USES_AD8495 #define HEATER_PROBE_USES_AD8495 1
#elif TEMP_SENSOR_PROBE == -3 #elif TEMP_SENSOR_PROBE == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE." #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
#elif TEMP_SENSOR_PROBE == -2 #elif TEMP_SENSOR_PROBE == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE." #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
#elif TEMP_SENSOR_PROBE == -1 #elif TEMP_SENSOR_PROBE == -1
#define HEATER_PROBE_USES_AD595 #define HEATER_PROBE_USES_AD595 1
#elif TEMP_SENSOR_PROBE > 0 #elif TEMP_SENSOR_PROBE > 0
#define THERMISTORPROBE TEMP_SENSOR_PROBE #define THERMISTORPROBE TEMP_SENSOR_PROBE
#define PROBE_USES_THERMISTOR #define HEATER_PROBE_USES_THERMISTOR 1
#if TEMP_SENSOR_PROBE == 1000 #if TEMP_SENSOR_PROBE == 1000
#define PROBE_USER_THERMISTOR #define HEATER_PROBE_USER_THERMISTOR 1
#endif #endif
#endif #endif
#define HOTEND_USES_THERMISTOR ANY( \
HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, HEATER_3_USES_THERMISTOR, \
HEATER_4_USES_THERMISTOR, HEATER_5_USES_THERMISTOR, HEATER_6_USES_THERMISTOR, HEATER_7_USES_THERMISTOR )
/** /**
* X_DUAL_ENDSTOPS endstop reassignment * X_DUAL_ENDSTOPS endstop reassignment
*/ */

File diff suppressed because it is too large Load diff

View file

@ -42,7 +42,7 @@
* version was tagged. * version was tagged.
*/ */
#ifndef STRING_DISTRIBUTION_DATE #ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-11-08" #define STRING_DISTRIBUTION_DATE "2020-11-12"
#endif #endif
/** /**

View file

@ -55,7 +55,7 @@
#include "../../inc/MarlinConfigPre.h" #include "../../inc/MarlinConfigPre.h"
#if HAS_MARLINUI_U8GLIB #if HAS_MARLINUI_U8GLIB && DISABLED(TFT_CLASSIC_UI)
#include "HAL_LCD_com_defines.h" #include "HAL_LCD_com_defines.h"

View file

@ -76,8 +76,8 @@ namespace Anycubic {
#endif #endif
// Filament runout is handled by Marlin settings in Configuration.h // Filament runout is handled by Marlin settings in Configuration.h
// set FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present. // opt_set FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present.
// enable FIL_RUNOUT_PULLUP // opt_enable FIL_RUNOUT_PULL
TFTSer.begin(115200); TFTSer.begin(115200);

View file

@ -87,7 +87,7 @@ void AnycubicTFTClass::OnSetup() {
SET_INPUT_PULLUP(SD_DETECT_PIN); SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif #endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
SET_INPUT_PULLUP(FIL_RUNOUT_PIN); SET_INPUT_PULLUP(FIL_RUNOUT1_PIN);
#endif #endif
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
@ -935,7 +935,7 @@ void AnycubicTFTClass::DoFilamentRunoutCheck() {
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
// NOTE: ExtUI::getFilamentRunoutState() only returns the runout state if the job is printing // NOTE: ExtUI::getFilamentRunoutState() only returns the runout state if the job is printing
// we want to actually check the status of the pin here, regardless of printstate // we want to actually check the status of the pin here, regardless of printstate
if (READ(FIL_RUNOUT_PIN)) { if (READ(FIL_RUNOUT1_PIN)) {
if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) { if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) {
// play tone to indicate filament is out // play tone to indicate filament is out
ExtUI::injectCommands_P(PSTR("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567")); ExtUI::injectCommands_P(PSTR("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567"));
@ -983,7 +983,7 @@ void AnycubicTFTClass::PausePrint() {
void AnycubicTFTClass::ResumePrint() { void AnycubicTFTClass::ResumePrint() {
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
if (READ(FIL_RUNOUT_PIN)) { if (READ(FIL_RUNOUT1_PIN)) {
#if ENABLED(ANYCUBIC_LCD_DEBUG) #if ENABLED(ANYCUBIC_LCD_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... "); SERIAL_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... ");
#endif #endif

View file

@ -92,12 +92,12 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) {
PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN) PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN)
#endif #endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT) #if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT)
PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, FIL_RUNOUT_STATE) PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, FIL_RUNOUT1_STATE)
#else #else
PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT) PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT)
#endif #endif
#if BOTH(HAS_MULTI_EXTRUDER, FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2) #if BOTH(HAS_MULTI_EXTRUDER, FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2)
PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT_STATE) PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT2_STATE)
#else #else
PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2) PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2)
#endif #endif

View file

@ -181,7 +181,7 @@ static void disp_language(uint8_t language, uint8_t state) {
strcat_P(public_buf_l, PSTR(".bin")); strcat_P(public_buf_l, PSTR(".bin"));
lv_obj_set_event_cb_mks(obj, event_handler, id, nullptr, 0); lv_obj_set_event_cb_mks(obj, event_handler, id, "", 0);
lv_imgbtn_set_src_both(obj, public_buf_l); lv_imgbtn_set_src_both(obj, public_buf_l);
if (state == UNSELECTED) lv_obj_refresh_ext_draw_pad(obj); if (state == UNSELECTED) lv_obj_refresh_ext_draw_pad(obj);

View file

@ -279,7 +279,7 @@ void disp_gcode_icon(uint8_t file_num) {
cutFileName((char *)list_file.long_name[i], 16, 8, (char *)public_buf_m); cutFileName((char *)list_file.long_name[i], 16, 8, (char *)public_buf_m);
if (list_file.IsFolder[i]) { if (list_file.IsFolder[i]) {
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), nullptr, 0); lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_dir.bin"); lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_dir.bin");
if (i < 3) if (i < 3)
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight); lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight);
@ -298,7 +298,7 @@ void disp_gcode_icon(uint8_t file_num) {
strcat(test_public_buf_l, list_file.file_name[i]); strcat(test_public_buf_l, list_file.file_name[i]);
char *temp = strstr(test_public_buf_l, ".GCO"); char *temp = strstr(test_public_buf_l, ".GCO");
if (temp) strcpy(temp, ".bin"); if (temp) strcpy(temp, ".bin");
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), nullptr, 0); lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
lv_imgbtn_set_src_both(buttonGcode[i], test_public_buf_l); lv_imgbtn_set_src_both(buttonGcode[i], test_public_buf_l);
if (i < 3) { if (i < 3) {
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET); lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET);
@ -308,7 +308,7 @@ void disp_gcode_icon(uint8_t file_num) {
lv_btn_use_label_style(buttonText[i]); lv_btn_use_label_style(buttonText[i]);
lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF); lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
//lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),nullptr, 0); //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),"", 0);
lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET + 100); lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET + 100);
lv_obj_set_size(buttonText[i], 100, 40); lv_obj_set_size(buttonText[i], 100, 40);
} }
@ -320,7 +320,7 @@ void disp_gcode_icon(uint8_t file_num) {
lv_btn_use_label_style(buttonText[i]); lv_btn_use_label_style(buttonText[i]);
lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF); lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
//lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),nullptr, 0); //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),"", 0);
lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1) + FILE_PRE_PIC_X_OFFSET, BTN_Y_PIXEL + INTERVAL_H + titleHeight + FILE_PRE_PIC_Y_OFFSET + 100); lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1) + FILE_PRE_PIC_X_OFFSET, BTN_Y_PIXEL + INTERVAL_H + titleHeight + FILE_PRE_PIC_Y_OFFSET + 100);
lv_obj_set_size(buttonText[i], 100, 40); lv_obj_set_size(buttonText[i], 100, 40);
} }
@ -328,7 +328,7 @@ void disp_gcode_icon(uint8_t file_num) {
lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0);
} }
else { else {
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), nullptr, 0); lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_file.bin"); lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_file.bin");
if (i < 3) if (i < 3)
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight); lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight);

View file

@ -1680,7 +1680,7 @@ lv_obj_t* lv_label_create(lv_obj_t *par, lv_coord_t x, lv_coord_t y, const char
lv_obj_t* lv_btn_create(lv_obj_t *par, lv_event_cb_t cb, const int id/*=0*/, lv_style_t *style/*=&style_para_value*/) { lv_obj_t* lv_btn_create(lv_obj_t *par, lv_event_cb_t cb, const int id/*=0*/, lv_style_t *style/*=&style_para_value*/) {
lv_obj_t *btn = lv_btn_create(par, nullptr); lv_obj_t *btn = lv_btn_create(par, nullptr);
if (id) if (id)
lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0); lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
else else
lv_obj_set_event_cb(btn, cb); lv_obj_set_event_cb(btn, cb);
lv_btn_set_style_both(btn, style); lv_btn_set_style_both(btn, style);
@ -1748,7 +1748,7 @@ lv_obj_t* lv_imgbtn_create(lv_obj_t *par, const char *img, lv_event_cb_t cb, con
lv_obj_t *btn = lv_imgbtn_create(par, nullptr); lv_obj_t *btn = lv_imgbtn_create(par, nullptr);
if (img) lv_imgbtn_set_src_both(btn, img); if (img) lv_imgbtn_set_src_both(btn, img);
if (id) if (id)
lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0); lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
else else
lv_obj_set_event_cb(btn, cb); lv_obj_set_event_cb(btn, cb);
lv_imgbtn_use_label_style(btn); lv_imgbtn_use_label_style(btn);
@ -1785,7 +1785,7 @@ lv_obj_t* lv_screen_menu_item(lv_obj_t *par, const char *text, lv_coord_t x, lv_
lv_obj_t *btn = lv_btn_create(par, nullptr); /*Add a button the current screen*/ lv_obj_t *btn = lv_btn_create(par, nullptr); /*Add a button the current screen*/
lv_obj_set_pos(btn, x, y); /*Set its position*/ lv_obj_set_pos(btn, x, y); /*Set its position*/
lv_obj_set_size(btn, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(btn, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
if (id > -1) lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0); if (id > -1) lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
lv_btn_use_label_style(btn); lv_btn_use_label_style(btn);
lv_btn_set_layout(btn, LV_LAYOUT_OFF); lv_btn_set_layout(btn, LV_LAYOUT_OFF);
lv_obj_t *label = lv_label_create_empty(btn); /*Add a label to the button*/ lv_obj_t *label = lv_label_create_empty(btn); /*Add a label to the button*/

View file

@ -73,7 +73,7 @@ void lv_draw_wifi(void) {
buttonReconnect = lv_imgbtn_create(scr, nullptr); buttonReconnect = lv_imgbtn_create(scr, nullptr);
lv_obj_set_event_cb_mks(buttonReconnect, event_handler, ID_W_RECONNECT, nullptr, 0); lv_obj_set_event_cb_mks(buttonReconnect, event_handler, ID_W_RECONNECT, "", 0);
lv_imgbtn_set_src_both(buttonReconnect, "F:/bmp_wifi.bin"); lv_imgbtn_set_src_both(buttonReconnect, "F:/bmp_wifi.bin");
lv_imgbtn_use_label_style(buttonReconnect); lv_imgbtn_use_label_style(buttonReconnect);

View file

@ -21,7 +21,7 @@
*/ */
#include "../../../../inc/MarlinConfigPre.h" #include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI #if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
#include "draw_ui.h" #include "draw_ui.h"
#include "wifi_module.h" #include "wifi_module.h"
@ -822,4 +822,4 @@ int32_t wifi_upload(int type) {
return esp_upload.uploadResult == success ? 0 : -1; return esp_upload.uploadResult == success ? 0 : -1;
} }
#endif // HAS_TFT_LVGL_UI #endif // HAS_TFT_LVGL_UI && USE_WIFI_FUNCTION

View file

@ -9,6 +9,8 @@
#include "../inc/MarlinConfig.h" #include "../inc/MarlinConfig.h"
#define MAX_UTF8_CHAR_SIZE 4
#if HAS_WIRED_LCD #if HAS_WIRED_LCD
#include "marlinui.h" #include "marlinui.h"
#include "../MarlinCore.h" #include "../MarlinCore.h"
@ -79,6 +81,8 @@ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t
uint32_t val = 0; uint32_t val = 0;
uint8_t *p = pstart; uint8_t *p = pstart;
#define NEXT_6_BITS() do{ val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); }while(0)
uint8_t valcur = cb_read_byte(p); uint8_t valcur = cb_read_byte(p);
if (0 == (0x80 & valcur)) { if (0 == (0x80 & valcur)) {
val = valcur; val = valcur;
@ -86,74 +90,51 @@ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t
} }
else if (0xC0 == (0xE0 & valcur)) { else if (0xC0 == (0xE0 & valcur)) {
val = valcur & 0x1F; val = valcur & 0x1F;
val <<= 6; NEXT_6_BITS();
p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
p++; p++;
} }
#if MAX_UTF8_CHAR_SIZE >= 3
else if (0xE0 == (0xF0 & valcur)) { else if (0xE0 == (0xF0 & valcur)) {
val = valcur & 0x0F; val = valcur & 0x0F;
val <<= 6; p++; NEXT_6_BITS();
valcur = cb_read_byte(p); NEXT_6_BITS();
val |= (valcur & 0x3F);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
p++; p++;
} }
#endif
#if MAX_UTF8_CHAR_SIZE >= 4
else if (0xF0 == (0xF8 & valcur)) { else if (0xF0 == (0xF8 & valcur)) {
val = valcur & 0x07; val = valcur & 0x07;
val <<= 6; p++; NEXT_6_BITS();
valcur = cb_read_byte(p); NEXT_6_BITS();
val |= (valcur & 0x3F); NEXT_6_BITS();
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
p++; p++;
} }
#endif
#if MAX_UTF8_CHAR_SIZE >= 5
else if (0xF8 == (0xFC & valcur)) { else if (0xF8 == (0xFC & valcur)) {
val = valcur & 0x03; val = valcur & 0x03;
val <<= 6; p++; NEXT_6_BITS();
valcur = cb_read_byte(p); NEXT_6_BITS();
val |= (valcur & 0x3F); NEXT_6_BITS();
val <<= 6; p++; NEXT_6_BITS();
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
p++; p++;
} }
#endif
#if MAX_UTF8_CHAR_SIZE >= 6
else if (0xFC == (0xFE & valcur)) { else if (0xFC == (0xFE & valcur)) {
val = valcur & 0x01; val = valcur & 0x01;
val <<= 6; p++; NEXT_6_BITS();
valcur = cb_read_byte(p); NEXT_6_BITS();
val |= (valcur & 0x3F); NEXT_6_BITS();
val <<= 6; p++; NEXT_6_BITS();
valcur = cb_read_byte(p); NEXT_6_BITS();
val |= (valcur & 0x3F);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
p++; p++;
} }
#endif
else if (0x80 == (0xC0 & valcur)) else if (0x80 == (0xC0 & valcur))
for (; 0x80 == (0xC0 & valcur); ) { p++; valcur = cb_read_byte(p); } for (; 0x80 == (0xC0 & valcur); ) { p++; valcur = cb_read_byte(p); }
else else
for (; ((0xFE & valcur) > 0xFC); ) { p++; valcur = cb_read_byte(p); } for (; 0xFC < (0xFE & valcur); ) { p++; valcur = cb_read_byte(p); }
if (pval) *pval = val; if (pval) *pval = val;

View file

@ -26,7 +26,7 @@
#include "../inc/MarlinConfigPre.h" #include "../inc/MarlinConfigPre.h"
#if HAS_WIRED_LCD #if HAS_WIRED_LCD && !HAS_GRAPHICAL_TFT
#include "lcdprint.h" #include "lcdprint.h"

View file

@ -262,6 +262,8 @@ millis_t MarlinUI::next_button_update_ms; // = 0
#endif #endif
#if !HAS_GRAPHICAL_TFT
void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, bool wordwrap/*=false*/) { void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, bool wordwrap/*=false*/) {
SETCURSOR(col, row); SETCURSOR(col, row);
if (!string) return; if (!string) return;
@ -324,6 +326,8 @@ millis_t MarlinUI::next_button_update_ms; // = 0
if (suff) wrap_string_P(col, row, suff); if (suff) wrap_string_P(col, row, suff);
} }
#endif // !HAS_GRAPHICAL_TFT
#endif // HAS_LCD_MENU #endif // HAS_LCD_MENU
void MarlinUI::init() { void MarlinUI::init() {

View file

@ -80,12 +80,10 @@
#include "lcdprint.h" #include "lcdprint.h"
#if !HAS_GRAPHICAL_TFT
void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, const bool wordwrap=false); void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, const bool wordwrap=false);
inline void wrap_string_P(uint8_t &col, uint8_t &row, PGM_P const pstr, const bool wordwrap=false) { _wrap_string(col, row, pstr, read_byte_rom, wordwrap); } inline void wrap_string_P(uint8_t &col, uint8_t &row, PGM_P const pstr, const bool wordwrap=false) { _wrap_string(col, row, pstr, read_byte_rom, wordwrap); }
inline void wrap_string(uint8_t &col, uint8_t &row, const char * const string, const bool wordwrap=false) { _wrap_string(col, row, string, read_byte_ram, wordwrap); } inline void wrap_string(uint8_t &col, uint8_t &row, const char * const string, const bool wordwrap=false) { _wrap_string(col, row, string, read_byte_ram, wordwrap); }
#if ENABLED(SDSUPPORT)
#include "../sd/cardreader.h"
#endif #endif
typedef void (*screenFunc_t)(); typedef void (*screenFunc_t)();

View file

@ -43,9 +43,21 @@ float z_measured[G35_PROBE_COUNT] = { 0 };
static uint8_t tram_index = 0; static uint8_t tram_index = 0;
bool probe_single_point() { bool probe_single_point() {
// In BLTOUCH HS mode, the probe travels in a deployed state.
// Users of Tramming Wizard might have a badly misaligned bed, so raise Z by the
// length of the deployed pin (BLTOUCH stroke < 7mm)
do_blocking_move_to_z((Z_CLEARANCE_BETWEEN_PROBES) + TERN0(BLTOUCH_HS_MODE, 7));
const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[tram_index], PROBE_PT_RAISE, 0, true); const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[tram_index], PROBE_PT_RAISE, 0, true);
DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm"); DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm");
z_measured[tram_index] = z_probed_height; z_measured[tram_index] = z_probed_height;
#ifdef ASSISTED_TRAMMING_WAIT_POSITION
// Move XY to safe position
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Moving away");
const xyz_pos_t wait_pos = ASSISTED_TRAMMING_WAIT_POSITION;
do_blocking_move_to(wait_pos, XY_PROBE_FEEDRATE_MM_S);
#endif
return !isnan(z_probed_height); return !isnan(z_probed_height);
} }

View file

@ -649,7 +649,7 @@ void menu_item(const uint8_t row, bool sel ) {
menu_line(row, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND); menu_line(row, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND);
#if ENABLED(TOUCH_SCREEN) #if ENABLED(TOUCH_SCREEN)
const TouchControlType tct = TERN(SINGLE_TOUCH_NAVIGATION, true, sel) ? CLICK : MENU_ITEM; const TouchControlType tct = TERN(SINGLE_TOUCH_NAVIGATION, true, sel) ? CLICK : MENU_ITEM;
touch.add_control(tct, 0, 2 + 34 * row, 320, 32, encoderTopLine + row); touch.add_control(tct, 0, 2 + 34 * row, TFT_WIDTH, 32, encoderTopLine + row);
#endif #endif
} }

View file

@ -47,7 +47,7 @@
#define BUTTONC_X_LO BUTTONB_X_HI + BUTTON_SPACING #define BUTTONC_X_LO BUTTONB_X_HI + BUTTON_SPACING
#define BUTTONC_X_HI BUTTONC_X_LO + BUTTON_WIDTH - 1 #define BUTTONC_X_HI BUTTONC_X_LO + BUTTON_WIDTH - 1
#define BUTTON_Y_HI (TFT_HEIGHT) - (BUTTON_SPACING / 2) #define BUTTON_Y_HI (TFT_HEIGHT) - BUTTON_SPACING
#define BUTTON_Y_LO BUTTON_Y_HI - BUTTON_HEIGHT #define BUTTON_Y_LO BUTTON_Y_HI - BUTTON_HEIGHT
class TouchButtons { class TouchButtons {

View file

@ -459,18 +459,19 @@ void _O2 Endstops::report_states() {
#endif #endif
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR
#if NUM_RUNOUT_SENSORS == 1 #if NUM_RUNOUT_SENSORS == 1
print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE, PSTR(STR_FILAMENT_RUNOUT_SENSOR)); print_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
#else #else
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break; #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break;
LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) { LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
pin_t pin; pin_t pin;
uint8_t state;
switch (i) { switch (i) {
default: continue; default: continue;
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _CASE_RUNOUT) REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _CASE_RUNOUT)
} }
SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR); SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
if (i > 1) SERIAL_CHAR(' ', '0' + i); if (i > 1) SERIAL_CHAR(' ', '0' + i);
print_es_state(extDigitalRead(pin) != FIL_RUNOUT_STATE); print_es_state(extDigitalRead(pin) != state);
} }
#undef _CASE_RUNOUT #undef _CASE_RUNOUT
#endif #endif

View file

@ -667,8 +667,8 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
if (bltouch.triggered()) bltouch._reset(); if (bltouch.triggered()) bltouch._reset();
#endif #endif
// TODO: Adapt for SCARA, where the offset rotates // On delta keep Z below clip height or do_blocking_move_to will abort
xyz_pos_t npos = { rx, ry }; xyz_pos_t npos = { rx, ry, _MIN(TERN(DELTA, delta_clip_start_height, current_position.z), current_position.z) };
if (probe_relative) { // The given position is in terms of the probe if (probe_relative) { // The given position is in terms of the probe
if (!can_reach(npos)) { if (!can_reach(npos)) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Position Not Reachable"); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Position Not Reachable");
@ -678,15 +678,6 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
} }
else if (!position_is_reachable(npos)) return NAN; // The given position is in terms of the nozzle else if (!position_is_reachable(npos)) return NAN; // The given position is in terms of the nozzle
npos.z =
#if ENABLED(DELTA)
// Move below clip height or xy move will be aborted by do_blocking_move_to
_MIN(current_position.z, delta_clip_start_height)
#else
current_position.z
#endif
;
const float old_feedrate_mm_s = feedrate_mm_s; const float old_feedrate_mm_s = feedrate_mm_s;
feedrate_mm_s = XY_PROBE_FEEDRATE_MM_S; feedrate_mm_s = XY_PROBE_FEEDRATE_MM_S;

View file

@ -44,30 +44,44 @@
#include "../lcd/extui/ui_api.h" #include "../lcd/extui/ui_api.h"
#endif #endif
#if ENABLED(MAX6675_IS_MAX31865) #if MAX6675_0_IS_MAX31865 || MAX6675_1_IS_MAX31865
#include <Adafruit_MAX31865.h> #include <Adafruit_MAX31865.h>
#ifndef MAX31865_CS_PIN #if MAX6675_0_IS_MAX31865 && !defined(MAX31865_CS_PIN) && PIN_EXISTS(MAX6675_SS)
#define MAX31865_CS_PIN MAX6675_SS_PIN // HW:49 SW:65 for example #define MAX31865_CS_PIN MAX6675_SS_PIN
#endif
#if MAX6675_1_IS_MAX31865 && !defined(MAX31865_CS2_PIN) && PIN_EXISTS(MAX6675_SS2)
#define MAX31865_CS2_PIN MAX6675_SS2_PIN
#endif #endif
#ifndef MAX31865_MOSI_PIN #ifndef MAX31865_MOSI_PIN
#define MAX31865_MOSI_PIN MOSI_PIN // 63 #define MAX31865_MOSI_PIN MOSI_PIN
#endif #endif
#ifndef MAX31865_MISO_PIN #ifndef MAX31865_MISO_PIN
#define MAX31865_MISO_PIN MAX6675_DO_PIN // 42 #define MAX31865_MISO_PIN MAX6675_DO_PIN
#endif #endif
#ifndef MAX31865_SCK_PIN #ifndef MAX31865_SCK_PIN
#define MAX31865_SCK_PIN MAX6675_SCK_PIN // 40 #define MAX31865_SCK_PIN MAX6675_SCK_PIN
#endif #endif
Adafruit_MAX31865 max31865 = Adafruit_MAX31865(MAX31865_CS_PIN #if MAX6675_0_IS_MAX31865 && PIN_EXISTS(MAX31865_CS)
#define HAS_MAX31865 1
Adafruit_MAX31865 max31865_0 = Adafruit_MAX31865(MAX31865_CS_PIN
#if MAX31865_CS_PIN != MAX6675_SS_PIN #if MAX31865_CS_PIN != MAX6675_SS_PIN
, MAX31865_MOSI_PIN // For software SPI also set MOSI/MISO/SCK , MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN // For software SPI also set MOSI/MISO/SCK
, MAX31865_MISO_PIN
, MAX31865_SCK_PIN
#endif #endif
); );
#endif
#if MAX6675_1_IS_MAX31865 && PIN_EXISTS(MAX31865_CS2)
#define HAS_MAX31865 1
Adafruit_MAX31865 max31865_1 = Adafruit_MAX31865(MAX31865_CS2_PIN
#if MAX31865_CS2_PIN != MAX6675_SS2_PIN
, MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN // For software SPI also set MOSI/MISO/SCK
#endif
);
#endif
#endif #endif
#define MAX6675_SEPARATE_SPI (EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PINS_EXIST(MAX6675_SCK, MAX6675_DO)) #if EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PINS_EXIST(MAX6675_SCK, MAX6675_DO)
#define MAX6675_SEPARATE_SPI 1
#endif
#if MAX6675_SEPARATE_SPI #if MAX6675_SEPARATE_SPI
#include "../libs/private_spi.h" #include "../libs/private_spi.h"
@ -114,7 +128,13 @@
#if HAS_SERVOS #if HAS_SERVOS
#include "./servo.h" #include "./servo.h"
#endif #endif
#if HOTEND_USES_THERMISTOR
#if ANY(HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, HEATER_3_USES_THERMISTOR, \
HEATER_4_USES_THERMISTOR, HEATER_5_USES_THERMISTOR, HEATER_6_USES_THERMISTOR, HEATER_7_USES_THERMISTOR )
#define HAS_HOTEND_THERMISTOR 1
#endif
#if HAS_HOTEND_THERMISTOR
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static const temp_entry_t* heater_ttbl_map[2] = { HEATER_0_TEMPTABLE, HEATER_1_TEMPTABLE }; static const temp_entry_t* heater_ttbl_map[2] = { HEATER_0_TEMPTABLE, HEATER_1_TEMPTABLE };
static constexpr uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN }; static constexpr uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
@ -1046,11 +1066,11 @@ void Temperature::manage_heater() {
updateTemperaturesFromRawValues(); // also resets the watchdog updateTemperaturesFromRawValues(); // also resets the watchdog
#if DISABLED(IGNORE_THERMOCOUPLE_ERRORS) #if DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
#if ENABLED(HEATER_0_USES_MAX6675) #if HEATER_0_USES_MAX6675
if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0); if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0);
if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0); if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
#endif #endif
#if ENABLED(HEATER_1_USES_MAX6675) #if HEATER_1_USES_MAX6675
if (temp_hotend[1].celsius > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1); if (temp_hotend[1].celsius > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1);
if (temp_hotend[1].celsius < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1); if (temp_hotend[1].celsius < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
#endif #endif
@ -1336,34 +1356,34 @@ void Temperature::manage_heater() {
void Temperature::reset_user_thermistors() { void Temperature::reset_user_thermistors() {
user_thermistor_t user_thermistor[USER_THERMISTORS] = { user_thermistor_t user_thermistor[USER_THERMISTORS] = {
#if ENABLED(HEATER_0_USER_THERMISTOR) #if HEATER_0_USER_THERMISTOR
{ true, 0, 0, HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS, 0, 0, HOTEND0_BETA, 0 }, { true, 0, 0, HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS, 0, 0, HOTEND0_BETA, 0 },
#endif #endif
#if ENABLED(HEATER_1_USER_THERMISTOR) #if HEATER_1_USER_THERMISTOR
{ true, 0, 0, HOTEND1_PULLUP_RESISTOR_OHMS, HOTEND1_RESISTANCE_25C_OHMS, 0, 0, HOTEND1_BETA, 0 }, { true, 0, 0, HOTEND1_PULLUP_RESISTOR_OHMS, HOTEND1_RESISTANCE_25C_OHMS, 0, 0, HOTEND1_BETA, 0 },
#endif #endif
#if ENABLED(HEATER_2_USER_THERMISTOR) #if HEATER_2_USER_THERMISTOR
{ true, 0, 0, HOTEND2_PULLUP_RESISTOR_OHMS, HOTEND2_RESISTANCE_25C_OHMS, 0, 0, HOTEND2_BETA, 0 }, { true, 0, 0, HOTEND2_PULLUP_RESISTOR_OHMS, HOTEND2_RESISTANCE_25C_OHMS, 0, 0, HOTEND2_BETA, 0 },
#endif #endif
#if ENABLED(HEATER_3_USER_THERMISTOR) #if HEATER_3_USER_THERMISTOR
{ true, 0, 0, HOTEND3_PULLUP_RESISTOR_OHMS, HOTEND3_RESISTANCE_25C_OHMS, 0, 0, HOTEND3_BETA, 0 }, { true, 0, 0, HOTEND3_PULLUP_RESISTOR_OHMS, HOTEND3_RESISTANCE_25C_OHMS, 0, 0, HOTEND3_BETA, 0 },
#endif #endif
#if ENABLED(HEATER_4_USER_THERMISTOR) #if HEATER_4_USER_THERMISTOR
{ true, 0, 0, HOTEND4_PULLUP_RESISTOR_OHMS, HOTEND4_RESISTANCE_25C_OHMS, 0, 0, HOTEND4_BETA, 0 }, { true, 0, 0, HOTEND4_PULLUP_RESISTOR_OHMS, HOTEND4_RESISTANCE_25C_OHMS, 0, 0, HOTEND4_BETA, 0 },
#endif #endif
#if ENABLED(HEATER_5_USER_THERMISTOR) #if HEATER_5_USER_THERMISTOR
{ true, 0, 0, HOTEND5_PULLUP_RESISTOR_OHMS, HOTEND5_RESISTANCE_25C_OHMS, 0, 0, HOTEND5_BETA, 0 }, { true, 0, 0, HOTEND5_PULLUP_RESISTOR_OHMS, HOTEND5_RESISTANCE_25C_OHMS, 0, 0, HOTEND5_BETA, 0 },
#endif #endif
#if ENABLED(HEATER_6_USER_THERMISTOR) #if HEATER_6_USER_THERMISTOR
{ true, 0, 0, HOTEND6_PULLUP_RESISTOR_OHMS, HOTEND6_RESISTANCE_25C_OHMS, 0, 0, HOTEND6_BETA, 0 }, { true, 0, 0, HOTEND6_PULLUP_RESISTOR_OHMS, HOTEND6_RESISTANCE_25C_OHMS, 0, 0, HOTEND6_BETA, 0 },
#endif #endif
#if ENABLED(HEATER_7_USER_THERMISTOR) #if HEATER_7_USER_THERMISTOR
{ true, 0, 0, HOTEND7_PULLUP_RESISTOR_OHMS, HOTEND7_RESISTANCE_25C_OHMS, 0, 0, HOTEND7_BETA, 0 }, { true, 0, 0, HOTEND7_PULLUP_RESISTOR_OHMS, HOTEND7_RESISTANCE_25C_OHMS, 0, 0, HOTEND7_BETA, 0 },
#endif #endif
#if ENABLED(HEATER_BED_USER_THERMISTOR) #if HEATER_BED_USER_THERMISTOR
{ true, 0, 0, BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS, 0, 0, BED_BETA, 0 }, { true, 0, 0, BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS, 0, 0, BED_BETA, 0 },
#endif #endif
#if ENABLED(HEATER_CHAMBER_USER_THERMISTOR) #if HEATER_CHAMBER_USER_THERMISTOR
{ true, 0, 0, CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS, 0, 0, CHAMBER_BETA, 0 } { true, 0, 0, CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS, 0, 0, CHAMBER_BETA, 0 }
#endif #endif
}; };
@ -1462,91 +1482,85 @@ void Temperature::manage_heater() {
switch (e) { switch (e) {
case 0: case 0:
#if ENABLED(HEATER_0_USER_THERMISTOR) #if HEATER_0_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_0, raw); return user_thermistor_to_deg_c(CTI_HOTEND_0, raw);
#elif ENABLED(HEATER_0_USES_MAX6675) #elif HEATER_0_USES_MAX6675
return ( return TERN(MAX6675_0_IS_MAX31865, max31865_0.temperature(MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0), raw * 0.25);
#if ENABLED(MAX6675_IS_MAX31865) #elif HEATER_0_USES_AD595
max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS)
#else
raw * 0.25
#endif
);
#elif ENABLED(HEATER_0_USES_AD595)
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_0_USES_AD8495) #elif HEATER_0_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
break; break;
#endif #endif
case 1: case 1:
#if ENABLED(HEATER_1_USER_THERMISTOR) #if HEATER_1_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_1, raw); return user_thermistor_to_deg_c(CTI_HOTEND_1, raw);
#elif ENABLED(HEATER_1_USES_MAX6675) #elif HEATER_1_USES_MAX6675
return raw * 0.25; return TERN(MAX6675_1_IS_MAX31865, max31865_1.temperature(MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1), raw * 0.25);
#elif ENABLED(HEATER_1_USES_AD595) #elif HEATER_1_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_1_USES_AD8495) #elif HEATER_1_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
break; break;
#endif #endif
case 2: case 2:
#if ENABLED(HEATER_2_USER_THERMISTOR) #if HEATER_2_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_2, raw); return user_thermistor_to_deg_c(CTI_HOTEND_2, raw);
#elif ENABLED(HEATER_2_USES_AD595) #elif HEATER_2_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_2_USES_AD8495) #elif HEATER_2_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
break; break;
#endif #endif
case 3: case 3:
#if ENABLED(HEATER_3_USER_THERMISTOR) #if HEATER_3_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_3, raw); return user_thermistor_to_deg_c(CTI_HOTEND_3, raw);
#elif ENABLED(HEATER_3_USES_AD595) #elif HEATER_3_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_3_USES_AD8495) #elif HEATER_3_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
break; break;
#endif #endif
case 4: case 4:
#if ENABLED(HEATER_4_USER_THERMISTOR) #if HEATER_4_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_4, raw); return user_thermistor_to_deg_c(CTI_HOTEND_4, raw);
#elif ENABLED(HEATER_4_USES_AD595) #elif HEATER_4_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_4_USES_AD8495) #elif HEATER_4_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
break; break;
#endif #endif
case 5: case 5:
#if ENABLED(HEATER_5_USER_THERMISTOR) #if HEATER_5_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_5, raw); return user_thermistor_to_deg_c(CTI_HOTEND_5, raw);
#elif ENABLED(HEATER_5_USES_AD595) #elif HEATER_5_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_5_USES_AD8495) #elif HEATER_5_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
break; break;
#endif #endif
case 6: case 6:
#if ENABLED(HEATER_6_USER_THERMISTOR) #if HEATER_6_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_6, raw); return user_thermistor_to_deg_c(CTI_HOTEND_6, raw);
#elif ENABLED(HEATER_6_USES_AD595) #elif HEATER_6_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_6_USES_AD8495) #elif HEATER_6_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
break; break;
#endif #endif
case 7: case 7:
#if ENABLED(HEATER_7_USER_THERMISTOR) #if HEATER_7_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_7, raw); return user_thermistor_to_deg_c(CTI_HOTEND_7, raw);
#elif ENABLED(HEATER_7_USES_AD595) #elif HEATER_7_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_7_USES_AD8495) #elif HEATER_7_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
break; break;
@ -1554,7 +1568,7 @@ void Temperature::manage_heater() {
default: break; default: break;
} }
#if HOTEND_USES_THERMISTOR #if HAS_HOTEND_THERMISTOR
// Thermistor with conversion table? // Thermistor with conversion table?
const temp_entry_t(*tt)[] = (temp_entry_t(*)[])(heater_ttbl_map[e]); const temp_entry_t(*tt)[] = (temp_entry_t(*)[])(heater_ttbl_map[e]);
SCAN_THERMISTOR_TABLE((*tt), heater_ttbllen_map[e]); SCAN_THERMISTOR_TABLE((*tt), heater_ttbllen_map[e]);
@ -1568,13 +1582,13 @@ void Temperature::manage_heater() {
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
// For bed temperature measurement. // For bed temperature measurement.
float Temperature::analog_to_celsius_bed(const int raw) { float Temperature::analog_to_celsius_bed(const int raw) {
#if ENABLED(HEATER_BED_USER_THERMISTOR) #if HEATER_BED_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_BED, raw); return user_thermistor_to_deg_c(CTI_BED, raw);
#elif ENABLED(HEATER_BED_USES_THERMISTOR) #elif HEATER_BED_USES_THERMISTOR
SCAN_THERMISTOR_TABLE(BED_TEMPTABLE, BED_TEMPTABLE_LEN); SCAN_THERMISTOR_TABLE(BED_TEMPTABLE, BED_TEMPTABLE_LEN);
#elif ENABLED(HEATER_BED_USES_AD595) #elif HEATER_BED_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_BED_USES_AD8495) #elif HEATER_BED_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
UNUSED(raw); UNUSED(raw);
@ -1587,13 +1601,13 @@ void Temperature::manage_heater() {
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
// For chamber temperature measurement. // For chamber temperature measurement.
float Temperature::analog_to_celsius_chamber(const int raw) { float Temperature::analog_to_celsius_chamber(const int raw) {
#if ENABLED(HEATER_CHAMBER_USER_THERMISTOR) #if HEATER_CHAMBER_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_CHAMBER, raw); return user_thermistor_to_deg_c(CTI_CHAMBER, raw);
#elif ENABLED(HEATER_CHAMBER_USES_THERMISTOR) #elif HEATER_CHAMBER_USES_THERMISTOR
SCAN_THERMISTOR_TABLE(CHAMBER_TEMPTABLE, CHAMBER_TEMPTABLE_LEN); SCAN_THERMISTOR_TABLE(CHAMBER_TEMPTABLE, CHAMBER_TEMPTABLE_LEN);
#elif ENABLED(HEATER_CHAMBER_USES_AD595) #elif HEATER_CHAMBER_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(HEATER_CHAMBER_USES_AD8495) #elif HEATER_CHAMBER_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
UNUSED(raw); UNUSED(raw);
@ -1606,13 +1620,13 @@ void Temperature::manage_heater() {
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
// For probe temperature measurement. // For probe temperature measurement.
float Temperature::analog_to_celsius_probe(const int raw) { float Temperature::analog_to_celsius_probe(const int raw) {
#if ENABLED(PROBE_USER_THERMISTOR) #if HEATER_PROBE_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_PROBE, raw); return user_thermistor_to_deg_c(CTI_PROBE, raw);
#elif ENABLED(PROBE_USES_THERMISTOR) #elif HEATER_PROBE_USES_THERMISTOR
SCAN_THERMISTOR_TABLE(PROBE_TEMPTABLE, PROBE_TEMPTABLE_LEN); SCAN_THERMISTOR_TABLE(PROBE_TEMPTABLE, PROBE_TEMPTABLE_LEN);
#elif ENABLED(PROBE_USES_AD595) #elif HEATER_PROBE_USES_AD595
return TEMP_AD595(raw); return TEMP_AD595(raw);
#elif ENABLED(PROBE_USES_AD8495) #elif HEATER_PROBE_USES_AD8495
return TEMP_AD8495(raw); return TEMP_AD8495(raw);
#else #else
UNUSED(raw); UNUSED(raw);
@ -1628,16 +1642,11 @@ void Temperature::manage_heater() {
* as it would block the stepper routine. * as it would block the stepper routine.
*/ */
void Temperature::updateTemperaturesFromRawValues() { void Temperature::updateTemperaturesFromRawValues() {
#if ENABLED(HEATER_0_USES_MAX6675) TERN_(HEATER_0_USES_MAX6675, temp_hotend[0].raw = READ_MAX6675(0));
temp_hotend[0].raw = READ_MAX6675(0); TERN_(HEATER_1_USES_MAX6675, temp_hotend[1].raw = READ_MAX6675(1));
#endif
#if ENABLED(HEATER_1_USES_MAX6675)
temp_hotend[1].raw = READ_MAX6675(1);
#endif
#if HAS_HOTEND #if HAS_HOTEND
HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e); HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
#endif #endif
TERN_(HAS_HEATED_BED, temp_bed.celsius = analog_to_celsius_bed(temp_bed.raw)); TERN_(HAS_HEATED_BED, temp_bed.celsius = analog_to_celsius_bed(temp_bed.raw));
TERN_(HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw)); TERN_(HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw));
TERN_(HAS_TEMP_PROBE, temp_probe.celsius = analog_to_celsius_probe(temp_probe.raw)); TERN_(HAS_TEMP_PROBE, temp_probe.celsius = analog_to_celsius_probe(temp_probe.raw));
@ -1690,7 +1699,8 @@ void Temperature::updateTemperaturesFromRawValues() {
*/ */
void Temperature::init() { void Temperature::init() {
TERN_(MAX6675_IS_MAX31865, max31865.begin(MAX31865_2WIRE)); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE TERN_(MAX6675_0_IS_MAX31865, max31865_0.begin(MAX31865_2WIRE)); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
TERN_(MAX6675_1_IS_MAX31865, max31865_1.begin(MAX31865_2WIRE));
#if EARLY_WATCHDOG #if EARLY_WATCHDOG
// Flag that the thermalManager should be running // Flag that the thermalManager should be running
@ -1700,7 +1710,7 @@ void Temperature::init() {
#if MB(RUMBA) #if MB(RUMBA)
// Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector // Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
#define _AD(N) ANY(HEATER_##N##_USES_AD595, HEATER_##N##_USES_AD8495) #define _AD(N) (HEATER_##N##_USES_AD595 || HEATER_##N##_USES_AD8495)
#if _AD(0) || _AD(1) || _AD(2) || _AD(BED) || _AD(CHAMBER) #if _AD(0) || _AD(1) || _AD(2) || _AD(BED) || _AD(CHAMBER)
MCUCR = _BV(JTD); MCUCR = _BV(JTD);
MCUCR = _BV(JTD); MCUCR = _BV(JTD);
@ -1789,22 +1799,7 @@ void Temperature::init() {
INIT_FAN_PIN(CONTROLLER_FAN_PIN); INIT_FAN_PIN(CONTROLLER_FAN_PIN);
#endif #endif
#if MAX6675_SEPARATE_SPI TERN_(MAX6675_SEPARATE_SPI, max6675_spi.init());
OUT_WRITE(SCK_PIN, LOW);
OUT_WRITE(MOSI_PIN, HIGH);
SET_INPUT_PULLUP(MISO_PIN);
max6675_spi.init();
OUT_WRITE(SS_PIN, HIGH);
OUT_WRITE(MAX6675_SS_PIN, HIGH);
#endif
#if ENABLED(HEATER_1_USES_MAX6675)
OUT_WRITE(MAX6675_SS2_PIN, HIGH);
#endif
HAL_adc_init(); HAL_adc_init();
@ -2199,27 +2194,19 @@ void Temperature::disable_all_heaters() {
#define THERMOCOUPLE_MAX_ERRORS 15 #define THERMOCOUPLE_MAX_ERRORS 15
#endif #endif
int Temperature::read_max6675( int Temperature::read_max6675(TERN_(HAS_MULTI_6675, const uint8_t hindex/*=0*/)) {
#if COUNT_6675 > 1
const uint8_t hindex
#endif
) {
#if COUNT_6675 == 1
constexpr uint8_t hindex = 0;
#else
// Needed to return the correct temp when this is called too soon
static uint16_t max6675_temp_previous[COUNT_6675] = { 0 };
#endif
static uint8_t max6675_errors[COUNT_6675] = { 0 };
#define MAX6675_HEAT_INTERVAL 250UL #define MAX6675_HEAT_INTERVAL 250UL
#if ENABLED(MAX6675_IS_MAX31855) #if MAX6675_0_IS_MAX31855 || MAX6675_1_IS_MAX31855
static uint32_t max6675_temp = 2000; static uint32_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 7 #define MAX6675_ERROR_MASK 7
#define MAX6675_DISCARD_BITS 18 #define MAX6675_DISCARD_BITS 18
#define MAX6675_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64 #define MAX6675_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64
#elif HAS_MAX31865
static uint16_t max6675_temp = 2000; // From datasheet 16 bits D15-D0
#define MAX6675_ERROR_MASK 1 // D0 Bit not used
#define MAX6675_DISCARD_BITS 1 // Data is in D15-D1
#define MAX6675_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64
#else #else
static uint16_t max6675_temp = 2000; static uint16_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 4 #define MAX6675_ERROR_MASK 4
@ -2227,22 +2214,44 @@ void Temperature::disable_all_heaters() {
#define MAX6675_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16 #define MAX6675_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16
#endif #endif
#if HAS_MULTI_6675
// Needed to return the correct temp when this is called between readings
static uint16_t max6675_temp_previous[COUNT_6675] = { 0 };
#define MAX6675_TEMP(I) max6675_temp_previous[I]
#define MAX6675_SEL(A,B) (hindex ? (B) : (A))
#define MAX6675_WRITE(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0)
#define MAX6675_SET_OUTPUT() do{ switch (hindex) { case 1: SET_OUTPUT(MAX6675_SS2_PIN); break; default: SET_OUTPUT(MAX6675_SS_PIN); } }while(0)
#else
constexpr uint8_t hindex = 0;
#define MAX6675_TEMP(I) max6675_temp
#if MAX6675_1_IS_MAX31865
#define MAX6675_SEL(A,B) B
#else
#define MAX6675_SEL(A,B) A
#endif
#if HEATER_0_USES_MAX6675
#define MAX6675_WRITE(V) WRITE(MAX6675_SS_PIN, V)
#define MAX6675_SET_OUTPUT() SET_OUTPUT(MAX6675_SS_PIN)
#else
#define MAX6675_WRITE(V) WRITE(MAX6675_SS2_PIN, V)
#define MAX6675_SET_OUTPUT() SET_OUTPUT(MAX6675_SS2_PIN)
#endif
#endif
static uint8_t max6675_errors[COUNT_6675] = { 0 };
// Return last-read value between readings // Return last-read value between readings
static millis_t next_max6675_ms[COUNT_6675] = { 0 }; static millis_t next_max6675_ms[COUNT_6675] = { 0 };
millis_t ms = millis(); millis_t ms = millis();
if (PENDING(ms, next_max6675_ms[hindex])) if (PENDING(ms, next_max6675_ms[hindex])) return int(MAX6675_TEMP(hindex));
return int(
#if COUNT_6675 == 1
max6675_temp
#else
max6675_temp_previous[hindex] // Need to return the correct previous value
#endif
);
next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL; next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL;
#if ENABLED(MAX6675_IS_MAX31865) #if HAS_MAX31865
max6675_temp = int(max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS)); Adafruit_MAX31865 &maxref = MAX6675_SEL(max31865_0, max31865_1);
max6675_temp = int(maxref.temperature(
MAX6675_SEL(MAX31865_SENSOR_OHMS_0, MAX31865_SENSOR_OHMS_1),
MAX6675_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)
));
#endif #endif
// //
@ -2253,39 +2262,22 @@ void Temperature::disable_all_heaters() {
spiInit(MAX6675_SPEED_BITS); spiInit(MAX6675_SPEED_BITS);
#endif #endif
#if COUNT_6675 > 1 MAX6675_WRITE(LOW); // enable TT_MAX6675
#define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0)
#define SET_OUTPUT_MAX6675() do{ switch (hindex) { case 1: SET_OUTPUT(MAX6675_SS2_PIN); break; default: SET_OUTPUT(MAX6675_SS_PIN); } }while(0)
#elif ENABLED(HEATER_1_USES_MAX6675)
#define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V)
#define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS2_PIN)
#else
#define WRITE_MAX6675(V) WRITE(MAX6675_SS_PIN, V)
#define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS_PIN)
#endif
SET_OUTPUT_MAX6675();
WRITE_MAX6675(LOW); // enable TT_MAX6675
DELAY_NS(100); // Ensure 100ns delay DELAY_NS(100); // Ensure 100ns delay
// Read a big-endian temperature value // Read a big-endian temperature value
max6675_temp = 0; max6675_temp = 0;
for (uint8_t i = sizeof(max6675_temp); i--;) { for (uint8_t i = sizeof(max6675_temp); i--;) {
max6675_temp |= ( max6675_temp |= TERN(MAX6675_SEPARATE_SPI, max6675_spi.receive(), spiRec());
#if MAX6675_SEPARATE_SPI
max6675_spi.receive()
#else
spiRec()
#endif
);
if (i > 0) max6675_temp <<= 8; // shift left if not the last byte if (i > 0) max6675_temp <<= 8; // shift left if not the last byte
} }
WRITE_MAX6675(HIGH); // disable TT_MAX6675 MAX6675_WRITE(HIGH); // disable TT_MAX6675
if (DISABLED(IGNORE_THERMOCOUPLE_ERRORS) && (max6675_temp & MAX6675_ERROR_MASK)) { const uint8_t fault_31865 = TERN1(HAS_MAX31865, maxref.readFault());
max6675_errors[hindex] += 1;
if (DISABLED(IGNORE_THERMOCOUPLE_ERRORS) && (max6675_temp & MAX6675_ERROR_MASK) && fault_31865) {
max6675_errors[hindex]++;
if (max6675_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) { if (max6675_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
SERIAL_ERROR_START(); SERIAL_ERROR_START();
SERIAL_ECHOPGM("Temp measurement error! "); SERIAL_ECHOPGM("Temp measurement error! ");
@ -2297,18 +2289,29 @@ void Temperature::disable_all_heaters() {
SERIAL_ECHOLNPGM("Short to GND"); SERIAL_ECHOLNPGM("Short to GND");
else if (max6675_temp & 4) else if (max6675_temp & 4)
SERIAL_ECHOLNPGM("Short to VCC"); SERIAL_ECHOLNPGM("Short to VCC");
#elif HAS_MAX31865
if (fault_31865) {
maxref.clearFault();
SERIAL_ECHOPAIR("MAX31865 Fault :(", fault_31865, ") >>");
if (fault_31865 & MAX31865_FAULT_HIGHTHRESH)
SERIAL_ECHOLNPGM("RTD High Threshold");
else if (fault_31865 & MAX31865_FAULT_LOWTHRESH)
SERIAL_ECHOLNPGM("RTD Low Threshold");
else if (fault_31865 & MAX31865_FAULT_REFINLOW)
SERIAL_ECHOLNPGM("REFIN- > 0.85 x Bias");
else if (fault_31865 & MAX31865_FAULT_REFINHIGH)
SERIAL_ECHOLNPGM("REFIN- < 0.85 x Bias - FORCE- open");
else if (fault_31865 & MAX31865_FAULT_RTDINLOW)
SERIAL_ECHOLNPGM("REFIN- < 0.85 x Bias - FORCE- open");
else if (fault_31865 & MAX31865_FAULT_OVUV)
SERIAL_ECHOLNPGM("Under/Over voltage");
}
#else #else
SERIAL_ECHOLNPGM("MAX6675"); SERIAL_ECHOLNPGM("MAX6675");
#endif #endif
// Thermocouple open // Thermocouple open
max6675_temp = 4 * ( max6675_temp = 4 * MAX6675_SEL(HEATER_0_MAX6675_TMAX, HEATER_1_MAX6675_TMAX);
#if COUNT_6675 > 1
hindex ? HEATER_1_MAX6675_TMAX : HEATER_0_MAX6675_TMAX
#else
TERN(HEATER_1_USES_MAX6675, HEATER_1_MAX6675_TMAX, HEATER_0_MAX6675_TMAX)
#endif
);
} }
else else
max6675_temp >>= MAX6675_DISCARD_BITS; max6675_temp >>= MAX6675_DISCARD_BITS;
@ -2318,13 +2321,11 @@ void Temperature::disable_all_heaters() {
max6675_errors[hindex] = 0; max6675_errors[hindex] = 0;
} }
#if ENABLED(MAX6675_IS_MAX31855) #if MAX6675_0_IS_MAX31855 || MAX6675_1_IS_MAX31855
if (max6675_temp & 0x00002000) max6675_temp |= 0xFFFFC000; // Support negative temperature if (max6675_temp & 0x00002000) max6675_temp |= 0xFFFFC000; // Support negative temperature
#endif #endif
#if COUNT_6675 > 1 MAX6675_TEMP(hindex) = max6675_temp;
max6675_temp_previous[hindex] = max6675_temp;
#endif
return int(max6675_temp); return int(max6675_temp);
} }
@ -2336,14 +2337,14 @@ void Temperature::disable_all_heaters() {
*/ */
void Temperature::update_raw_temperatures() { void Temperature::update_raw_temperatures() {
#if HAS_TEMP_ADC_0 && DISABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_ADC_0 && !HEATER_0_USES_MAX6675
temp_hotend[0].update(); temp_hotend[0].update();
#endif #endif
#if HAS_TEMP_ADC_1 #if HAS_TEMP_ADC_1
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
redundant_temperature_raw = temp_hotend[1].acc; redundant_temperature_raw = temp_hotend[1].acc;
#elif DISABLED(HEATER_1_USES_MAX6675) #elif !HEATER_1_USES_MAX6675
temp_hotend[1].update(); temp_hotend[1].update();
#endif #endif
#endif #endif

View file

@ -253,31 +253,31 @@ typedef struct { int16_t raw_min, raw_max, mintemp, maxtemp; } temp_range_t;
#if HAS_USER_THERMISTORS #if HAS_USER_THERMISTORS
enum CustomThermistorIndex : uint8_t { enum CustomThermistorIndex : uint8_t {
#if ENABLED(HEATER_0_USER_THERMISTOR) #if HEATER_0_USER_THERMISTOR
CTI_HOTEND_0, CTI_HOTEND_0,
#endif #endif
#if ENABLED(HEATER_1_USER_THERMISTOR) #if HEATER_1_USER_THERMISTOR
CTI_HOTEND_1, CTI_HOTEND_1,
#endif #endif
#if ENABLED(HEATER_2_USER_THERMISTOR) #if HEATER_2_USER_THERMISTOR
CTI_HOTEND_2, CTI_HOTEND_2,
#endif #endif
#if ENABLED(HEATER_3_USER_THERMISTOR) #if HEATER_3_USER_THERMISTOR
CTI_HOTEND_3, CTI_HOTEND_3,
#endif #endif
#if ENABLED(HEATER_4_USER_THERMISTOR) #if HEATER_4_USER_THERMISTOR
CTI_HOTEND_4, CTI_HOTEND_4,
#endif #endif
#if ENABLED(HEATER_5_USER_THERMISTOR) #if HEATER_5_USER_THERMISTOR
CTI_HOTEND_5, CTI_HOTEND_5,
#endif #endif
#if ENABLED(HEATER_BED_USER_THERMISTOR) #if HEATER_BED_USER_THERMISTOR
CTI_BED, CTI_BED,
#endif #endif
#if ENABLED(HEATER_PROBE_USER_THERMISTOR) #if HEATER_PROBE_USER_THERMISTOR
CTI_PROBE, CTI_PROBE,
#endif #endif
#if ENABLED(HEATER_CHAMBER_USER_THERMISTOR) #if HEATER_CHAMBER_USER_THERMISTOR
CTI_CHAMBER, CTI_CHAMBER,
#endif #endif
USER_THERMISTORS USER_THERMISTORS
@ -811,15 +811,12 @@ class Temperature {
#if HAS_MAX6675 #if HAS_MAX6675
#define COUNT_6675 1 + BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) #define COUNT_6675 1 + BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)
#if COUNT_6675 > 1 #if COUNT_6675 > 1
#define HAS_MULTI_6675 1
#define READ_MAX6675(N) read_max6675(N) #define READ_MAX6675(N) read_max6675(N)
#else #else
#define READ_MAX6675(N) read_max6675() #define READ_MAX6675(N) read_max6675()
#endif #endif
static int read_max6675( static int read_max6675(TERN_(HAS_MULTI_6675, const uint8_t hindex=0));
#if COUNT_6675 > 1
const uint8_t hindex=0
#endif
);
#endif #endif
static void checkExtruderAutoFans(); static void checkExtruderAutoFans();

View file

@ -206,7 +206,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#if THERMISTOR_HEATER_0 #if THERMISTOR_HEATER_0
#define HEATER_0_TEMPTABLE TT_NAME(THERMISTOR_HEATER_0) #define HEATER_0_TEMPTABLE TT_NAME(THERMISTOR_HEATER_0)
#define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE) #define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE)
#elif defined(HEATER_0_USES_THERMISTOR) #elif HEATER_0_USES_THERMISTOR
#error "No heater 0 thermistor table specified" #error "No heater 0 thermistor table specified"
#else #else
#define HEATER_0_TEMPTABLE nullptr #define HEATER_0_TEMPTABLE nullptr
@ -216,7 +216,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#if THERMISTOR_HEATER_1 #if THERMISTOR_HEATER_1
#define HEATER_1_TEMPTABLE TT_NAME(THERMISTOR_HEATER_1) #define HEATER_1_TEMPTABLE TT_NAME(THERMISTOR_HEATER_1)
#define HEATER_1_TEMPTABLE_LEN COUNT(HEATER_1_TEMPTABLE) #define HEATER_1_TEMPTABLE_LEN COUNT(HEATER_1_TEMPTABLE)
#elif defined(HEATER_1_USES_THERMISTOR) #elif HEATER_1_USES_THERMISTOR
#error "No heater 1 thermistor table specified" #error "No heater 1 thermistor table specified"
#else #else
#define HEATER_1_TEMPTABLE nullptr #define HEATER_1_TEMPTABLE nullptr
@ -226,7 +226,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#if THERMISTOR_HEATER_2 #if THERMISTOR_HEATER_2
#define HEATER_2_TEMPTABLE TT_NAME(THERMISTOR_HEATER_2) #define HEATER_2_TEMPTABLE TT_NAME(THERMISTOR_HEATER_2)
#define HEATER_2_TEMPTABLE_LEN COUNT(HEATER_2_TEMPTABLE) #define HEATER_2_TEMPTABLE_LEN COUNT(HEATER_2_TEMPTABLE)
#elif defined(HEATER_2_USES_THERMISTOR) #elif HEATER_2_USES_THERMISTOR
#error "No heater 2 thermistor table specified" #error "No heater 2 thermistor table specified"
#else #else
#define HEATER_2_TEMPTABLE nullptr #define HEATER_2_TEMPTABLE nullptr
@ -236,7 +236,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#if THERMISTOR_HEATER_3 #if THERMISTOR_HEATER_3
#define HEATER_3_TEMPTABLE TT_NAME(THERMISTOR_HEATER_3) #define HEATER_3_TEMPTABLE TT_NAME(THERMISTOR_HEATER_3)
#define HEATER_3_TEMPTABLE_LEN COUNT(HEATER_3_TEMPTABLE) #define HEATER_3_TEMPTABLE_LEN COUNT(HEATER_3_TEMPTABLE)
#elif defined(HEATER_3_USES_THERMISTOR) #elif HEATER_3_USES_THERMISTOR
#error "No heater 3 thermistor table specified" #error "No heater 3 thermistor table specified"
#else #else
#define HEATER_3_TEMPTABLE nullptr #define HEATER_3_TEMPTABLE nullptr
@ -246,7 +246,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#if THERMISTOR_HEATER_4 #if THERMISTOR_HEATER_4
#define HEATER_4_TEMPTABLE TT_NAME(THERMISTOR_HEATER_4) #define HEATER_4_TEMPTABLE TT_NAME(THERMISTOR_HEATER_4)
#define HEATER_4_TEMPTABLE_LEN COUNT(HEATER_4_TEMPTABLE) #define HEATER_4_TEMPTABLE_LEN COUNT(HEATER_4_TEMPTABLE)
#elif defined(HEATER_4_USES_THERMISTOR) #elif HEATER_4_USES_THERMISTOR
#error "No heater 4 thermistor table specified" #error "No heater 4 thermistor table specified"
#else #else
#define HEATER_4_TEMPTABLE nullptr #define HEATER_4_TEMPTABLE nullptr
@ -256,7 +256,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#if THERMISTOR_HEATER_5 #if THERMISTOR_HEATER_5
#define HEATER_5_TEMPTABLE TT_NAME(THERMISTOR_HEATER_5) #define HEATER_5_TEMPTABLE TT_NAME(THERMISTOR_HEATER_5)
#define HEATER_5_TEMPTABLE_LEN COUNT(HEATER_5_TEMPTABLE) #define HEATER_5_TEMPTABLE_LEN COUNT(HEATER_5_TEMPTABLE)
#elif defined(HEATER_5_USES_THERMISTOR) #elif HEATER_5_USES_THERMISTOR
#error "No heater 5 thermistor table specified" #error "No heater 5 thermistor table specified"
#else #else
#define HEATER_5_TEMPTABLE nullptr #define HEATER_5_TEMPTABLE nullptr
@ -266,7 +266,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#if THERMISTOR_HEATER_6 #if THERMISTOR_HEATER_6
#define HEATER_6_TEMPTABLE TT_NAME(THERMISTOR_HEATER_6) #define HEATER_6_TEMPTABLE TT_NAME(THERMISTOR_HEATER_6)
#define HEATER_6_TEMPTABLE_LEN COUNT(HEATER_6_TEMPTABLE) #define HEATER_6_TEMPTABLE_LEN COUNT(HEATER_6_TEMPTABLE)
#elif defined(HEATER_6_USES_THERMISTOR) #elif HEATER_6_USES_THERMISTOR
#error "No heater 6 thermistor table specified" #error "No heater 6 thermistor table specified"
#else #else
#define HEATER_6_TEMPTABLE nullptr #define HEATER_6_TEMPTABLE nullptr
@ -276,7 +276,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#if THERMISTOR_HEATER_7 #if THERMISTOR_HEATER_7
#define HEATER_7_TEMPTABLE TT_NAME(THERMISTOR_HEATER_7) #define HEATER_7_TEMPTABLE TT_NAME(THERMISTOR_HEATER_7)
#define HEATER_7_TEMPTABLE_LEN COUNT(HEATER_7_TEMPTABLE) #define HEATER_7_TEMPTABLE_LEN COUNT(HEATER_7_TEMPTABLE)
#elif defined(HEATER_7_USES_THERMISTOR) #elif HEATER_7_USES_THERMISTOR
#error "No heater 7 thermistor table specified" #error "No heater 7 thermistor table specified"
#else #else
#define HEATER_7_TEMPTABLE nullptr #define HEATER_7_TEMPTABLE nullptr
@ -286,7 +286,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#ifdef THERMISTORBED #ifdef THERMISTORBED
#define BED_TEMPTABLE TT_NAME(THERMISTORBED) #define BED_TEMPTABLE TT_NAME(THERMISTORBED)
#define BED_TEMPTABLE_LEN COUNT(BED_TEMPTABLE) #define BED_TEMPTABLE_LEN COUNT(BED_TEMPTABLE)
#elif defined(HEATER_BED_USES_THERMISTOR) #elif HEATER_BED_USES_THERMISTOR
#error "No bed thermistor table specified" #error "No bed thermistor table specified"
#else #else
#define BED_TEMPTABLE_LEN 0 #define BED_TEMPTABLE_LEN 0
@ -295,7 +295,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#ifdef THERMISTORCHAMBER #ifdef THERMISTORCHAMBER
#define CHAMBER_TEMPTABLE TT_NAME(THERMISTORCHAMBER) #define CHAMBER_TEMPTABLE TT_NAME(THERMISTORCHAMBER)
#define CHAMBER_TEMPTABLE_LEN COUNT(CHAMBER_TEMPTABLE) #define CHAMBER_TEMPTABLE_LEN COUNT(CHAMBER_TEMPTABLE)
#elif defined(HEATER_CHAMBER_USES_THERMISTOR) #elif HEATER_CHAMBER_USES_THERMISTOR
#error "No chamber thermistor table specified" #error "No chamber thermistor table specified"
#else #else
#define CHAMBER_TEMPTABLE_LEN 0 #define CHAMBER_TEMPTABLE_LEN 0
@ -304,7 +304,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
#ifdef THERMISTORPROBE #ifdef THERMISTORPROBE
#define PROBE_TEMPTABLE TT_NAME(THERMISTORPROBE) #define PROBE_TEMPTABLE TT_NAME(THERMISTORPROBE)
#define PROBE_TEMPTABLE_LEN COUNT(PROBE_TEMPTABLE) #define PROBE_TEMPTABLE_LEN COUNT(PROBE_TEMPTABLE)
#elif defined(HEATER_PROBE_USES_THERMISTOR) #elif HEATER_PROBE_USES_THERMISTOR
#error "No probe thermistor table specified" #error "No probe thermistor table specified"
#else #else
#define PROBE_TEMPTABLE_LEN 0 #define PROBE_TEMPTABLE_LEN 0
@ -402,7 +402,7 @@ static_assert(
#endif #endif
#ifndef HEATER_0_RAW_HI_TEMP #ifndef HEATER_0_RAW_HI_TEMP
#if TT_REV(THERMISTOR_HEATER_0) || !defined(HEATER_0_USES_THERMISTOR) #if TT_REV(THERMISTOR_HEATER_0) || !HEATER_0_USES_THERMISTOR
#define HEATER_0_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_0_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_0_RAW_LO_TEMP 0 #define HEATER_0_RAW_LO_TEMP 0
#else #else
@ -411,7 +411,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_1_RAW_HI_TEMP #ifndef HEATER_1_RAW_HI_TEMP
#if TT_REV(THERMISTOR_HEATER_1) || !defined(HEATER_1_USES_THERMISTOR) #if TT_REV(THERMISTOR_HEATER_1) || !HEATER_1_USES_THERMISTOR
#define HEATER_1_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_1_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_1_RAW_LO_TEMP 0 #define HEATER_1_RAW_LO_TEMP 0
#else #else
@ -420,7 +420,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_2_RAW_HI_TEMP #ifndef HEATER_2_RAW_HI_TEMP
#if TT_REV(THERMISTOR_HEATER_2) || !defined(HEATER_2_USES_THERMISTOR) #if TT_REV(THERMISTOR_HEATER_2) || !HEATER_2_USES_THERMISTOR
#define HEATER_2_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_2_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_2_RAW_LO_TEMP 0 #define HEATER_2_RAW_LO_TEMP 0
#else #else
@ -429,7 +429,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_3_RAW_HI_TEMP #ifndef HEATER_3_RAW_HI_TEMP
#if TT_REV(THERMISTOR_HEATER_3) || !defined(HEATER_3_USES_THERMISTOR) #if TT_REV(THERMISTOR_HEATER_3) || !HEATER_3_USES_THERMISTOR
#define HEATER_3_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_3_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_3_RAW_LO_TEMP 0 #define HEATER_3_RAW_LO_TEMP 0
#else #else
@ -438,7 +438,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_4_RAW_HI_TEMP #ifndef HEATER_4_RAW_HI_TEMP
#if TT_REV(THERMISTOR_HEATER_4) || !defined(HEATER_4_USES_THERMISTOR) #if TT_REV(THERMISTOR_HEATER_4) || !HEATER_4_USES_THERMISTOR
#define HEATER_4_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_4_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_4_RAW_LO_TEMP 0 #define HEATER_4_RAW_LO_TEMP 0
#else #else
@ -447,7 +447,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_5_RAW_HI_TEMP #ifndef HEATER_5_RAW_HI_TEMP
#if TT_REV(THERMISTOR_HEATER_5) || !defined(HEATER_5_USES_THERMISTOR) #if TT_REV(THERMISTOR_HEATER_5) || !HEATER_5_USES_THERMISTOR
#define HEATER_5_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_5_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_5_RAW_LO_TEMP 0 #define HEATER_5_RAW_LO_TEMP 0
#else #else
@ -456,7 +456,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_6_RAW_HI_TEMP #ifndef HEATER_6_RAW_HI_TEMP
#if TT_REV(THERMISTOR_HEATER_6) || !defined(HEATER_6_USES_THERMISTOR) #if TT_REV(THERMISTOR_HEATER_6) || !HEATER_6_USES_THERMISTOR
#define HEATER_6_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_6_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_6_RAW_LO_TEMP 0 #define HEATER_6_RAW_LO_TEMP 0
#else #else
@ -465,7 +465,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_7_RAW_HI_TEMP #ifndef HEATER_7_RAW_HI_TEMP
#if TT_REV(THERMISTOR_HEATER_7) || !defined(HEATER_7_USES_THERMISTOR) #if TT_REV(THERMISTOR_HEATER_7) || !HEATER_7_USES_THERMISTOR
#define HEATER_7_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_7_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_7_RAW_LO_TEMP 0 #define HEATER_7_RAW_LO_TEMP 0
#else #else
@ -474,7 +474,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_BED_RAW_HI_TEMP #ifndef HEATER_BED_RAW_HI_TEMP
#if TT_REV(THERMISTORBED) || !defined(HEATER_BED_USES_THERMISTOR) #if TT_REV(THERMISTORBED) || !HEATER_BED_USES_THERMISTOR
#define HEATER_BED_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_BED_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_BED_RAW_LO_TEMP 0 #define HEATER_BED_RAW_LO_TEMP 0
#else #else
@ -483,7 +483,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_CHAMBER_RAW_HI_TEMP #ifndef HEATER_CHAMBER_RAW_HI_TEMP
#if TT_REV(THERMISTORCHAMBER) || !defined(HEATER_CHAMBER_USES_THERMISTOR) #if TT_REV(THERMISTORCHAMBER) || !HEATER_CHAMBER_USES_THERMISTOR
#define HEATER_CHAMBER_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_CHAMBER_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_CHAMBER_RAW_LO_TEMP 0 #define HEATER_CHAMBER_RAW_LO_TEMP 0
#else #else
@ -492,7 +492,7 @@ static_assert(
#endif #endif
#endif #endif
#ifndef HEATER_PROBE_RAW_HI_TEMP #ifndef HEATER_PROBE_RAW_HI_TEMP
#if TT_REV(THERMISTORPROBE) || !defined(HEATER_PROBE_USES_THERMISTOR) #if TT_REV(THERMISTORPROBE) || !HEATER_PROBE_USES_THERMISTOR
#define HEATER_PROBE_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_PROBE_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define HEATER_PROBE_RAW_LO_TEMP 0 #define HEATER_PROBE_RAW_LO_TEMP 0
#else #else

View file

@ -208,31 +208,57 @@
#define E1_SERIAL_TX_PIN P1_01 #define E1_SERIAL_TX_PIN P1_01
#define E1_SERIAL_RX_PIN P1_01 #define E1_SERIAL_RX_PIN P1_01
#define Z2_SERIAL_TX_PIN P1_01
#define Z2_SERIAL_RX_PIN P1_01
// Reduce baud rate to improve software serial reliability // Reduce baud rate to improve software serial reliability
#define TMC_BAUD_RATE 19200 #define TMC_BAUD_RATE 19200
#endif #endif
/* _____ _____
* NC | 1 2 | GND 5V | 1 2 | GND
* RESET | 3 4 | 1.31 1.23 | 3 4 | 1.22
* 0.18 | 5 6 3.25 1.21 | 5 6 1.20
* 0.16 | 7 8 | 3.26 1.19 | 7 8 | 1.18
* 0.15 | 9 10| 0.17 0.28 | 9 10| 1.30
* ----- -----
* EXP2 EXP1
*/
#define EXPA1_03_PIN P1_23
#define EXPA1_04_PIN P1_22
#define EXPA1_05_PIN P1_21
#define EXPA1_06_PIN P1_20
#define EXPA1_07_PIN P1_19
#define EXPA1_08_PIN P1_18
#define EXPA1_09_PIN P0_28
#define EXPA1_10_PIN P1_30
#define EXPA2_03_PIN -1
#define EXPA2_04_PIN P1_31
#define EXPA2_05_PIN P0_18
#define EXPA2_06_PIN P3_25
#define EXPA2_07_PIN P0_16
#define EXPA2_08_PIN P3_26
#define EXPA2_09_PIN P0_15
#define EXPA2_10_PIN P0_17
// //
// SD Connection // SD Connection
// //
#if SD_CONNECTION_IS(LCD) #if SD_CONNECTION_IS(LCD)
#define SS_PIN P0_16 #define SS_PIN EXPA2_07_PIN
#endif #endif
/** /**
* _____ _____ * _____ _____
* NC | · · | GND 5V | · · | GND * NC | · · | GND 5V | · · | GND
* RESET | · · | 1.31 (SD_DETECT) (LCD_D7) 1.23 | · · | 1.22 (LCD_D6) * RESET | · · | 1.31 (SD_DETECT) (LCD_D7) 1.23 | · · | 1.22 (LCD_D6)
* (MOSI) 0.18 | · · | 3.25 (BTN_EN2) (LCD_D5) 1.21 | · · | 1.20 (LCD_D4) * (MOSI) 0.18 | · · 3.25 (BTN_EN2) (LCD_D5) 1.21 | · · 1.20 (LCD_D4)
* (SD_SS) 0.16 | · · | 3.26 (BTN_EN1) (LCD_RS) 1.19 | · · | 1.18 (LCD_EN) * (SD_SS) 0.16 | · · | 3.26 (BTN_EN1) (LCD_RS) 1.19 | · · | 1.18 (LCD_EN)
* (SCK) 0.15 | · · | 0.17 (MISO) (BTN_ENC) 0.28 | · · | 1.30 (BEEPER) * (SCK) 0.15 | · · | 0.17 (MISO) (BTN_ENC) 0.28 | · · | 1.30 (BEEPER)
* ----- ----- * ----- -----
* EXP2 EXP1 * EXP2 EXP1
*/ */
#if HAS_WIRED_LCD
#if HAS_WIRED_LCD && !HAS_BTT_EXP_MOT
#if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING) #if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING)
#error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING only applies to the ANET 1.0 board." #error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING only applies to the ANET 1.0 board."
@ -251,33 +277,33 @@
* *
* BEFORE AFTER * BEFORE AFTER
* _____ _____ * _____ _____
* GND 1 | 1 2 | 2 5V 5V 1 | 1 2 | 2 GND * GND | 1 2 | 5V 5V | 1 2 | GND
* CS 3 | 3 4 | 4 BTN_EN2 CS 3 | 3 4 | 4 BTN_EN2 * CS | 3 4 | BTN_EN2 CS | 3 4 | BTN_EN2
* SID 5 | 5 6 6 BTN_EN1 SID 5 | 5 6 6 BTN_EN1 * SID | 5 6 BTN_EN1 SID | 5 6 BTN_EN1
* open 7 | 7 8 | 8 BTN_ENC CLK 7 | 7 8 | 8 BTN_ENC * open | 7 8 | BTN_ENC CLK | 7 8 | BTN_ENC
* CLK 9 | 9 10| 10 Beeper open 9 | 9 10| 10 Beeper * CLK | 9 10| Beeper open | 9 10| Beeper
* ----- ----- * ----- -----
* LCD LCD * LCD LCD
*/ */
#define LCD_PINS_RS P1_23 #define LCD_PINS_RS EXPA1_03_PIN
#define BTN_EN1 P1_20 #define BTN_EN1 EXPA1_06_PIN
#define BTN_EN2 P1_22 #define BTN_EN2 EXPA1_04_PIN
#define BTN_ENC P1_18 #define BTN_ENC EXPA1_08_PIN
#define LCD_PINS_ENABLE P1_21 #define LCD_PINS_ENABLE EXPA1_05_PIN
#define LCD_PINS_D4 P1_19 #define LCD_PINS_D4 EXPA1_07_PIN
#elif ENABLED(CR10_STOCKDISPLAY) #elif ENABLED(CR10_STOCKDISPLAY)
#define BTN_ENC P0_28 // (58) open-drain #define BTN_ENC EXPA1_09_PIN // (58) open-drain
#define LCD_PINS_RS P1_22 #define LCD_PINS_RS EXPA1_04_PIN
#define BTN_EN1 P1_18 #define BTN_EN1 EXPA1_08_PIN
#define BTN_EN2 P1_20 #define BTN_EN2 EXPA1_06_PIN
#define LCD_PINS_ENABLE P1_23 #define LCD_PINS_ENABLE EXPA1_03_PIN
#define LCD_PINS_D4 P1_21 #define LCD_PINS_D4 EXPA1_05_PIN
#elif ENABLED(ENDER2_STOCKDISPLAY) #elif ENABLED(ENDER2_STOCKDISPLAY)
@ -285,43 +311,43 @@
* _____ * _____
* 5V | 1 2 | GND * 5V | 1 2 | GND
* (MOSI) 1.23 | 3 4 | 1.22 (LCD_RS) * (MOSI) 1.23 | 3 4 | 1.22 (LCD_RS)
* (LCD_A0) 1.21 | 5 6 | 1.20 (BTN_EN2) * (LCD_A0) 1.21 | 5 6 1.20 (BTN_EN2)
* RESET 1.19 | 7 8 | 1.18 (BTN_EN1) * RESET 1.19 | 7 8 | 1.18 (BTN_EN1)
* (BTN_ENC) 0.28 | 9 10| 1.30 (SCK) * (BTN_ENC) 0.28 | 9 10| 1.30 (SCK)
* ----- * -----
* EXP1 * EXP1
*/ */
#define BTN_EN1 P1_18 #define BTN_EN1 EXPA1_08_PIN
#define BTN_EN2 P1_20 #define BTN_EN2 EXPA1_06_PIN
#define BTN_ENC P0_28 #define BTN_ENC EXPA1_09_PIN
#define DOGLCD_CS P1_22 #define DOGLCD_CS EXPA1_04_PIN
#define DOGLCD_A0 P1_21 #define DOGLCD_A0 EXPA1_05_PIN
#define DOGLCD_SCK P1_30 #define DOGLCD_SCK EXPA1_10_PIN
#define DOGLCD_MOSI P1_23 #define DOGLCD_MOSI EXPA1_03_PIN
#define FORCE_SOFT_SPI #define FORCE_SOFT_SPI
#define LCD_BACKLIGHT_PIN -1 #define LCD_BACKLIGHT_PIN -1
#elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
#define TFT_CS_PIN P1_22 #define TFT_CS_PIN EXPA1_04_PIN
#define TFT_A0_PIN P1_23 #define TFT_A0_PIN EXPA1_03_PIN
#define TFT_DC_PIN P1_23 #define TFT_DC_PIN EXPA1_03_PIN
#define TFT_MISO_PIN P0_17 #define TFT_MISO_PIN EXPA2_10_PIN
#define TFT_BACKLIGHT_PIN P1_18 #define TFT_BACKLIGHT_PIN EXPA1_08_PIN
#define TFT_RESET_PIN P1_19 #define TFT_RESET_PIN EXPA1_07_PIN
#define LCD_USE_DMA_SPI #define LCD_USE_DMA_SPI
#define TOUCH_INT_PIN P1_21 #define TOUCH_INT_PIN EXPA1_05_PIN
#define TOUCH_CS_PIN P1_20 #define TOUCH_CS_PIN EXPA1_06_PIN
#define TOUCH_BUTTONS_HW_SPI #define TOUCH_BUTTONS_HW_SPI
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1 #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
// SPI 1 // SPI 1
#define SCK_PIN P0_15 #define SCK_PIN EXPA2_09_PIN
#define MISO_PIN P0_17 #define MISO_PIN EXPA2_10_PIN
#define MOSI_PIN P0_18 #define MOSI_PIN EXPA2_05_PIN
// Disable any LCD related PINs config // Disable any LCD related PINs config
#define LCD_PINS_ENABLE -1 #define LCD_PINS_ENABLE -1
@ -361,72 +387,72 @@
#elif IS_TFTGLCD_PANEL #elif IS_TFTGLCD_PANEL
#if ENABLED(TFTGLCD_PANEL_SPI) #if ENABLED(TFTGLCD_PANEL_SPI)
#define TFTGLCD_CS P3_26 #define TFTGLCD_CS EXPA2_08_PIN
#endif #endif
#define SD_DETECT_PIN P1_31 #define SD_DETECT_PIN EXPA2_04_PIN
#else #else
#define BTN_ENC P0_28 // (58) open-drain #define BTN_ENC EXPA1_09_PIN // (58) open-drain
#define LCD_PINS_RS P1_19 #define LCD_PINS_RS EXPA1_07_PIN
#define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 #define BTN_EN1 EXPA2_08_PIN // (31) J3-2 & AUX-4
#define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 #define BTN_EN2 EXPA2_06_PIN // (33) J3-4 & AUX-4
#define LCD_PINS_ENABLE P1_18 #define LCD_PINS_ENABLE EXPA1_08_PIN
#define LCD_PINS_D4 P1_20 #define LCD_PINS_D4 EXPA1_06_PIN
#define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 #define LCD_SDSS EXPA2_07_PIN // (16) J3-7 & AUX-4
#if SD_CONNECTION_IS(LCD) #if SD_CONNECTION_IS(LCD)
#define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant) #define SD_DETECT_PIN EXPA2_04_PIN // (49) (NOT 5V tolerant)
#endif #endif
#if ENABLED(FYSETC_MINI_12864) #if ENABLED(FYSETC_MINI_12864)
#define DOGLCD_CS P1_18 #define DOGLCD_CS EXPA1_08_PIN
#define DOGLCD_A0 P1_19 #define DOGLCD_A0 EXPA1_07_PIN
#define DOGLCD_SCK P0_15 #define DOGLCD_SCK EXPA2_09_PIN
#define DOGLCD_MOSI P0_18 #define DOGLCD_MOSI EXPA2_05_PIN
#define LCD_BACKLIGHT_PIN -1 #define LCD_BACKLIGHT_PIN -1
#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
// results in LCD soft SPI mode 3, SD soft SPI mode 0 // results in LCD soft SPI mode 3, SD soft SPI mode 0
#define LCD_RESET_PIN P1_20 // Must be high or open for LCD to operate normally. #define LCD_RESET_PIN EXPA1_06_PIN // Must be high or open for LCD to operate normally.
#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
#ifndef RGB_LED_R_PIN #ifndef RGB_LED_R_PIN
#define RGB_LED_R_PIN P1_21 #define RGB_LED_R_PIN EXPA1_05_PIN
#endif #endif
#ifndef RGB_LED_G_PIN #ifndef RGB_LED_G_PIN
#define RGB_LED_G_PIN P1_22 #define RGB_LED_G_PIN EXPA1_04_PIN
#endif #endif
#ifndef RGB_LED_B_PIN #ifndef RGB_LED_B_PIN
#define RGB_LED_B_PIN P1_23 #define RGB_LED_B_PIN EXPA1_03_PIN
#endif #endif
#elif ENABLED(FYSETC_MINI_12864_2_1) #elif ENABLED(FYSETC_MINI_12864_2_1)
#define NEOPIXEL_PIN P1_21 #define NEOPIXEL_PIN EXPA1_05_PIN
#endif #endif
#else // !FYSETC_MINI_12864 #else // !FYSETC_MINI_12864
#if ENABLED(MKS_MINI_12864) #if ENABLED(MKS_MINI_12864)
#define DOGLCD_CS P1_21 #define DOGLCD_CS EXPA1_05_PIN
#define DOGLCD_A0 P1_22 #define DOGLCD_A0 EXPA1_04_PIN
#define DOGLCD_SCK P0_15 #define DOGLCD_SCK EXPA2_09_PIN
#define DOGLCD_MOSI P0_18 #define DOGLCD_MOSI EXPA2_05_PIN
#define FORCE_SOFT_SPI #define FORCE_SOFT_SPI
#endif #endif
#if IS_ULTIPANEL #if IS_ULTIPANEL
#define LCD_PINS_D5 P1_21 #define LCD_PINS_D5 EXPA1_05_PIN
#define LCD_PINS_D6 P1_22 #define LCD_PINS_D6 EXPA1_04_PIN
#define LCD_PINS_D7 P1_23 #define LCD_PINS_D7 EXPA1_03_PIN
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
#define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder #define BTN_ENC_EN EXPA1_03_PIN // Detect the presence of the encoder
#endif #endif
#endif #endif

View file

@ -29,6 +29,14 @@
#error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
#endif #endif
// If you have the Big tree tech driver expantion module, enable HAS_BTT_EXP_MOT
// https://github.com/bigtreetech/BTT-Expansion-module/tree/master/BTT%20EXP-MOT
//#define HAS_BTT_EXP_MOT 1
#if BOTH(HAS_WIRED_LCD,HAS_BTT_EXP_MOT)
#ERROR "Having a LCD on EXP1/EXP2 and a expanion motor module on EXP1/EXP2 is not possable."
#endif
// Ignore temp readings during development. // Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
@ -115,3 +123,46 @@
#elif SD_CONNECTION_IS(CUSTOM_CABLE) #elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board." #error "No custom SD drive cable defined for this board."
#endif #endif
#if HAS_BTT_EXP_MOT
/* _____ _____
* NC | · · | GND NC | · · | GND
* NC | · · | 1.31 (M1EN) (M2EN) 1.23 | · · | 1.22 (M3EN)
* (M1STP) 0.18 | · · 3.25 (M1DIR) (M1RX) 1.21 | · · 1.20 (M1DIAG)
* (M2DIR) 0.16 | · · | 3.26 (M2STP) (M2RX) 1.19 | · · | 1.18 (M2DIAG)
* (M3DIR) 0.15 | · · | 0.17 (M3STP) (M3RX) 0.28 | · · | 1.30 (M3DIAG)
* ----- -----
* EXP2 EXP1
*/
// M1 on Driver Expansion Module
#define E2_STEP_PIN EXPA2_05_PIN
#define E2_DIR_PIN EXPA2_06_PIN
#define E2_ENABLE_PIN EXPA2_04_PIN
#define E2_DIAG_PIN EXPA1_06_PIN
#define E2_CS_PIN EXPA1_05_PIN
#if HAS_TMC_UART
#define E2_SERIAL_TX_PIN EXPA1_05_PIN
#define E2_SERIAL_RX_PIN EXPA1_05_PIN
#endif
// M2 on Driver Expansion Module
#define E3_STEP_PIN EXPA2_08_PIN
#define E3_DIR_PIN EXPA2_07_PIN
#define E3_ENABLE_PIN EXPA1_03_PIN
#define E3_DIAG_PIN EXPA1_08_PIN
#define E3_CS_PIN EXPA1_07_PIN
#if HAS_TMC_UART
#define E3_SERIAL_TX_PIN EXPA1_07_PIN
#define E3_SERIAL_RX_PIN EXPA1_07_PIN
#endif
// M3 on Driver Expansion Module
#define E4_STEP_PIN EXPA2_10_PIN
#define E4_DIR_PIN EXPA2_09_PIN
#define E4_ENABLE_PIN EXPA1_04_PIN
#define E4_DIAG_PIN EXPA1_10_PIN
#define E4_CS_PIN EXPA1_09_PIN
#if HAS_TMC_UART
#define E4_SERIAL_TX_PIN EXPA1_09_PIN
#define E4_SERIAL_RX_PIN EXPA1_09_PIN
#endif
#endif // HAS_BTT_EXP_MOT

View file

@ -229,7 +229,7 @@
* _____ _____ * _____ _____
* (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK) * (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK)
* (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2) * (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2)
* (LCD_D4) 0.15 | · · | 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · | 0.9 (SD_MOSI) * (LCD_D4) 0.15 | · · 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · 0.9 (SD_MOSI)
* (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST * (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST
* GND | · · | 5V GND | · · | NC * GND | · · | 5V GND | · · | NC
* ----- ----- * ----- -----

View file

@ -251,7 +251,7 @@
* _____ _____ * _____ _____
* (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK) * (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK)
* (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2) * (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2)
* (LCD_D4) 0.15 | · · | 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · | 0.9 (SD_MOSI) * (LCD_D4) 0.15 | · · 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · 0.9 (SD_MOSI)
* (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST * (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST
* GND | · · | 5V GND | · · | NC * GND | · · | 5V GND | · · | NC
* ----- ----- * ----- -----

View file

@ -155,7 +155,7 @@
* _____ * _____
* 5V | · · | GND * 5V | · · | GND
* (LCD_EN) P0_18 | · · | P0_16 (LCD_RS) * (LCD_EN) P0_18 | · · | P0_16 (LCD_RS)
* (LCD_D4) P0_15 | · · | P3_25 (BTN_EN2) * (LCD_D4) P0_15 | · · P3_25 (BTN_EN2)
* (RESET) P2_11 | · · | P3_26 (BTN_EN1) * (RESET) P2_11 | · · | P3_26 (BTN_EN1)
* (BTN_ENC) P1_30 | · · | P1_31 (BEEPER) * (BTN_ENC) P1_30 | · · | P1_31 (BEEPER)
* ----- * -----

View file

@ -201,7 +201,7 @@
* ----- ----- * ----- -----
* 5V/D41 | · · | GND 5V | · · | GND * 5V/D41 | · · | GND 5V | · · | GND
* RESET | · · | D49 (SD_DETECT) (LCD_D7) D29 | · · | D27 (LCD_D6) * RESET | · · | D49 (SD_DETECT) (LCD_D7) D29 | · · | D27 (LCD_D6)
* (MOSI) D51 | · · | D33 (BTN_EN2) (LCD_D5) D25 | · · | D23 (LCD_D4) * (MOSI) D51 | · · D33 (BTN_EN2) (LCD_D5) D25 | · · D23 (LCD_D4)
* (SD_SS) D53 | · · | D31 (BTN_EN1) (LCD_RS) D16 | · · | D17 (LCD_EN) * (SD_SS) D53 | · · | D31 (BTN_EN1) (LCD_RS) D16 | · · | D17 (LCD_EN)
* (SCK) D52 | · · | D50 (MISO) (BTN_ENC) D35 | · · | D37 (BEEPER) * (SCK) D52 | · · | D50 (MISO) (BTN_ENC) D35 | · · | D37 (BEEPER)
* ----- ----- * ----- -----

View file

@ -264,7 +264,7 @@
#define BEEPER_PIN PB6 #define BEEPER_PIN PB6
#define CLCD_MOD_RESET PA9 #define CLCD_MOD_RESET PA9
#define CLCD_SPI_CS PA8 #define CLCD_SPI_CS PB8
#endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050 #endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050

View file

@ -1103,19 +1103,67 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
if (WITHIN(seq, 1, MAX_VFAT_ENTRIES)) { if (WITHIN(seq, 1, MAX_VFAT_ENTRIES)) {
// TODO: Store the filename checksum to verify if a long-filename-unaware system modified the file table. // TODO: Store the filename checksum to verify if a long-filename-unaware system modified the file table.
n = (seq - 1) * (FILENAME_LENGTH); n = (seq - 1) * (FILENAME_LENGTH);
LOOP_L_N(i, FILENAME_LENGTH) LOOP_L_N(i, FILENAME_LENGTH) {
longFilename[n + i] = (i < 5) ? VFAT->name1[i] : (i < 11) ? VFAT->name2[i - 5] : VFAT->name3[i - 11]; uint16_t utf16_ch = (i < 5) ? VFAT->name1[i] : (i < 11) ? VFAT->name2[i - 5] : VFAT->name3[i - 11];
#if ENABLED(UTF_FILENAME_SUPPORT)
// We can't reconvert to UTF-8 here as UTF-8 is variable-size encoding, but joining LFN blocks
// needs static bytes addressing. So here just store full UTF-16LE words to re-convert later.
uint16_t idx = (n + i) * 2; // This is fixed as FAT LFN always contain UTF-16LE encoding
longFilename[idx] = utf16_ch & 0xFF;
longFilename[idx+1] = (utf16_ch >> 8) & 0xFF;
#else
// Replace all multibyte characters to '_'
longFilename[n + i] = (utf16_ch > 0xFF) ? '_' : (utf16_ch & 0xFF);
#endif
}
// If this VFAT entry is the last one, add a NUL terminator at the end of the string // If this VFAT entry is the last one, add a NUL terminator at the end of the string
if (VFAT->sequenceNumber & 0x40) longFilename[n + FILENAME_LENGTH] = '\0'; if (VFAT->sequenceNumber & 0x40) longFilename[(n + FILENAME_LENGTH) * LONG_FILENAME_CHARSIZE] = '\0';
} }
} }
} }
// Return if normal file or subdirectory // Return if normal file or subdirectory
if (DIR_IS_FILE_OR_SUBDIR(dir)) return n; if (DIR_IS_FILE_OR_SUBDIR(dir)) {
#if ENABLED(UTF_FILENAME_SUPPORT)
// Convert filename from utf-16 to utf-8 as Marlin expects
#if LONG_FILENAME_CHARSIZE > 2
// Add warning for developers for currently not supported 3-byte cases (Conversion series of 2-byte
// codepoints to 3-byte in-place will break the rest of filename)
#error "Currently filename re-encoding is done in-place. It may break the remaining chars to use 3-byte codepoints."
#endif
uint16_t currentPos = 0;
LOOP_L_N(i, (LONG_FILENAME_LENGTH / 2)) {
uint16_t idx = i * 2; // This is fixed as FAT LFN always contain UTF-16LE encoding
uint16_t utf16_ch = longFilename[idx] | (longFilename[idx + 1] << 8);
if (0xD800 == (utf16_ch & 0xF800)) // Surrogate pair - encode as '_'
longFilename[currentPos++] = '_';
else if (0 == (utf16_ch & 0xFF80)) // Encode as 1-byte utf-8 char
longFilename[currentPos++] = utf16_ch & 0x007F;
else if (0 == (utf16_ch & 0xF800)) { // Encode as 2-byte utf-8 char
longFilename[currentPos++] = 0xC0 | ((utf16_ch >> 6) & 0x1F);
longFilename[currentPos++] = 0x80 | (utf16_ch & 0x3F);
}
else {
#if LONG_FILENAME_CHARSIZE > 2 // Encode as 3-byte utf-8 char
longFilename[currentPos++] = 0xE0 | ((utf16_ch >> 12) & 0x0F);
longFilename[currentPos++] = 0xC0 | ((utf16_ch >> 6) & 0x3F);
longFilename[currentPos++] = 0xC0 | (utf16_ch & 0x3F);
#else // Encode as '_'
longFilename[currentPos++] = '_';
#endif
}
if (0 == utf16_ch) break; // End of filename
}
return currentPos;
#else
return n;
#endif
}
} }
} }
// Read next directory entry into the cache // Read next directory entry into the cache
// Assumes file is correctly positioned // Assumes file is correctly positioned
dir_t* SdBaseFile::readDirCache() { dir_t* SdBaseFile::readDirCache() {

View file

@ -103,5 +103,10 @@
#define FILENAME_LENGTH 13 // Number of UTF-16 characters per entry #define FILENAME_LENGTH 13 // Number of UTF-16 characters per entry
// UTF-8 may use up to 3 bytes to represent single UTF-16 code point.
// We discard 3-byte characters allowing only 2-bytes
// or 1-byte if UTF_FILENAME_SUPPORT disabled.
#define LONG_FILENAME_CHARSIZE TERN(UTF_FILENAME_SUPPORT, 2, 1)
// Total bytes needed to store a single long filename // Total bytes needed to store a single long filename
#define LONG_FILENAME_LENGTH (FILENAME_LENGTH * MAX_VFAT_ENTRIES + 1) #define LONG_FILENAME_LENGTH (FILENAME_LENGTH * LONG_FILENAME_CHARSIZE * MAX_VFAT_ENTRIES + 1)

View file

@ -118,9 +118,11 @@ Sd2Card CardReader::sd2card;
SdVolume CardReader::volume; SdVolume CardReader::volume;
SdFile CardReader::file; SdFile CardReader::file;
uint8_t CardReader::file_subcall_ctr; #if HAS_MEDIA_SUBCALLS
uint32_t CardReader::filespos[SD_PROCEDURE_DEPTH]; uint8_t CardReader::file_subcall_ctr;
char CardReader::proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; uint32_t CardReader::filespos[SD_PROCEDURE_DEPTH];
char CardReader::proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
#endif
uint32_t CardReader::filesize, CardReader::sdpos; uint32_t CardReader::filesize, CardReader::sdpos;
@ -135,7 +137,8 @@ CardReader::CardReader() {
#endif #endif
flag.sdprinting = flag.mounted = flag.saving = flag.logging = false; flag.sdprinting = flag.mounted = flag.saving = flag.logging = false;
filesize = sdpos = 0; filesize = sdpos = 0;
file_subcall_ctr = 0;
TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0);
workDirDepth = 0; workDirDepth = 0;
ZERO(workDirParents); ZERO(workDirParents);
@ -422,6 +425,7 @@ void CardReader::manage_media() {
if (stat) { // Media Inserted if (stat) { // Media Inserted
safe_delay(500); // Some boards need a delay to get settled safe_delay(500); // Some boards need a delay to get settled
if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2))
mount(); // Try to mount the media mount(); // Try to mount the media
#if MB(FYSETC_CHEETAH, FYSETC_CHEETAH_V12, FYSETC_AIO_II) #if MB(FYSETC_CHEETAH, FYSETC_CHEETAH_V12, FYSETC_AIO_II)
reset_stepper_drivers(); // Workaround for Cheetah bug reset_stepper_drivers(); // Workaround for Cheetah bug
@ -540,9 +544,11 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0*
switch (subcall_type) { switch (subcall_type) {
case 0: // Starting a new print. "Now fresh file: ..." case 0: // Starting a new print. "Now fresh file: ..."
announceOpen(2, path); announceOpen(2, path);
file_subcall_ctr = 0; TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0);
break; break;
#if HAS_MEDIA_SUBCALLS
case 1: // Starting a sub-procedure case 1: // Starting a sub-procedure
// With no file is open it's a simple macro. "Now doing file: ..." // With no file is open it's a simple macro. "Now doing file: ..."
@ -550,7 +556,7 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0*
// Too deep? The firmware has to bail. // Too deep? The firmware has to bail.
if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) { if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
SERIAL_ERROR_MSG("Exceeded max SUBROUTINE depth:" STRINGIFY(SD_PROCEDURE_DEPTH)); SERIAL_ERROR_MSG("Exceeded max SUBROUTINE depth:", int(SD_PROCEDURE_DEPTH));
kill(GET_TEXT(MSG_KILL_SUBCALL_OVERFLOW)); kill(GET_TEXT(MSG_KILL_SUBCALL_OVERFLOW));
return; return;
} }
@ -568,6 +574,8 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0*
case 2: // Resuming previous file after sub-procedure case 2: // Resuming previous file after sub-procedure
SERIAL_ECHO_MSG("END SUBROUTINE"); SERIAL_ECHO_MSG("END SUBROUTINE");
break; break;
#endif
} }
endFilePrint(); endFilePrint();
@ -603,7 +611,7 @@ void CardReader::openFileWrite(char * const path) {
if (!isMounted()) return; if (!isMounted()) return;
announceOpen(2, path); announceOpen(2, path);
file_subcall_ctr = 0; TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0);
endFilePrint(); endFilePrint();
@ -1158,17 +1166,19 @@ uint16_t CardReader::get_num_Files() {
void CardReader::fileHasFinished() { void CardReader::fileHasFinished() {
planner.synchronize(); planner.synchronize();
file.close(); file.close();
#if HAS_MEDIA_SUBCALLS
if (file_subcall_ctr > 0) { // Resume calling file after closing procedure if (file_subcall_ctr > 0) { // Resume calling file after closing procedure
file_subcall_ctr--; file_subcall_ctr--;
openFileRead(proc_filenames[file_subcall_ctr], 2); // 2 = Returning from sub-procedure openFileRead(proc_filenames[file_subcall_ctr], 2); // 2 = Returning from sub-procedure
setIndex(filespos[file_subcall_ctr]); setIndex(filespos[file_subcall_ctr]);
startFileprint(); startFileprint();
return;
} }
else { #endif
endFilePrint(TERN_(SD_RESORT, true));
endFilePrint(TERN_(SD_RESORT, true));
marlin_state = MF_SD_COMPLETE; marlin_state = MF_SD_COMPLETE;
}
} }
#if ENABLED(AUTO_REPORT_SD_STATUS) #if ENABLED(AUTO_REPORT_SD_STATUS)

View file

@ -249,12 +249,11 @@ private:
// //
// Procedure calls to other files // Procedure calls to other files
// //
#ifndef SD_PROCEDURE_DEPTH #if HAS_MEDIA_SUBCALLS
#define SD_PROCEDURE_DEPTH 1
#endif
static uint8_t file_subcall_ctr; static uint8_t file_subcall_ctr;
static uint32_t filespos[SD_PROCEDURE_DEPTH]; static uint32_t filespos[SD_PROCEDURE_DEPTH];
static char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; static char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
#endif
// //
// SD Auto Reporting // SD Auto Reporting

View file

@ -109,7 +109,7 @@ Proposed patches should be submitted as a Pull Request against the ([bugfix-2.0.
- This branch is for fixing bugs and integrating any new features for the duration of the Marlin 2.0.x life-cycle. - This branch is for fixing bugs and integrating any new features for the duration of the Marlin 2.0.x life-cycle.
- Follow the [Coding Standards](https://marlinfw.org/docs/development/coding_standards.html) to gain points with the maintainers. - Follow the [Coding Standards](https://marlinfw.org/docs/development/coding_standards.html) to gain points with the maintainers.
- Please submit your questions and concerns to the [Issue Queue](https://github.com/MarlinFirmware/Marlin/issues). - Please submit Feature Requests and Bug Reports to the [Issue Queue](https://github.com/MarlinFirmware/Marlin/issues/new/choose). Support resources are also listed there.
### [RepRap.org Wiki Page](https://reprap.org/wiki/Marlin) ### [RepRap.org Wiki Page](https://reprap.org/wiki/Marlin)

View file

@ -55,10 +55,10 @@ extern "C"{
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
// Number of pins defined in PinDescription array // Number of pins defined in PinDescription array
#define PINS_COUNT (79U) #define PINS_COUNT 79
#define NUM_DIGITAL_PINS (66U) #define NUM_DIGITAL_PINS 66
#define NUM_ANALOG_INPUTS (12U) #define NUM_ANALOG_INPUTS 12
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1) #define analogInputToDigitalPin(p) ((p < 12) ? (p) + 54 : -1)
#define digitalPinToPort(P) ( g_APinDescription[P].pPort ) #define digitalPinToPort(P) ( g_APinDescription[P].pPort )
#define digitalPinToBitMask(P) ( g_APinDescription[P].ulPin ) #define digitalPinToBitMask(P) ( g_APinDescription[P].ulPin )

View file

@ -71,63 +71,49 @@ uint8_t* get_utf8_value(uint8_t *pstart, wchar_t *pval) {
assert(NULL != pstart); assert(NULL != pstart);
#define NEXT_6_BITS() do{ val <<= 6; p++; val |= (*p & 0x3F); }while(0)
if (0 == (0x80 & *p)) { if (0 == (0x80 & *p)) {
val = (size_t)*p; val = (size_t)*p;
p++; p++;
} }
else if (0xC0 == (0xE0 & *p)) { else if (0xC0 == (0xE0 & *p)) {
val = *p & 0x1F; val = *p & 0x1F;
val <<= 6; NEXT_6_BITS();
p++;
val |= (*p & 0x3F);
p++; p++;
assert((wchar_t)val == get_val_utf82uni(pstart)); assert((wchar_t)val == get_val_utf82uni(pstart));
} }
else if (0xE0 == (0xF0 & *p)) { else if (0xE0 == (0xF0 & *p)) {
val = *p & 0x0F; val = *p & 0x0F;
val <<= 6; p++; NEXT_6_BITS();
val |= (*p & 0x3F); NEXT_6_BITS();
val <<= 6; p++;
val |= (*p & 0x3F);
p++; p++;
assert((wchar_t)val == get_val_utf82uni(pstart)); assert((wchar_t)val == get_val_utf82uni(pstart));
} }
else if (0xF0 == (0xF8 & *p)) { else if (0xF0 == (0xF8 & *p)) {
val = *p & 0x07; val = *p & 0x07;
val <<= 6; p++; NEXT_6_BITS();
val |= (*p & 0x3F); NEXT_6_BITS();
val <<= 6; p++; NEXT_6_BITS();
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
p++; p++;
assert((wchar_t)val == get_val_utf82uni(pstart)); assert((wchar_t)val == get_val_utf82uni(pstart));
} }
else if (0xF8 == (0xFC & *p)) { else if (0xF8 == (0xFC & *p)) {
val = *p & 0x03; val = *p & 0x03;
val <<= 6; p++; NEXT_6_BITS();
val |= (*p & 0x3F); NEXT_6_BITS();
val <<= 6; p++; NEXT_6_BITS();
val |= (*p & 0x3F); NEXT_6_BITS();
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
p++; p++;
assert((wchar_t)val == get_val_utf82uni(pstart)); assert((wchar_t)val == get_val_utf82uni(pstart));
} }
else if (0xFC == (0xFE & *p)) { else if (0xFC == (0xFE & *p)) {
val = *p & 0x01; val = *p & 0x01;
val <<= 6; p++; NEXT_6_BITS();
val |= (*p & 0x3F); NEXT_6_BITS();
val <<= 6; p++; NEXT_6_BITS();
val |= (*p & 0x3F); NEXT_6_BITS();
val <<= 6; p++; NEXT_6_BITS();
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
p++; p++;
assert((wchar_t)val == get_val_utf82uni(pstart)); assert((wchar_t)val == get_val_utf82uni(pstart));
} }

View file

@ -24,7 +24,20 @@ opt_set E2_AUTO_FAN_PIN PC12
opt_set X_DRIVER_TYPE TMC2208 opt_set X_DRIVER_TYPE TMC2208
opt_set Y_DRIVER_TYPE TMC2130 opt_set Y_DRIVER_TYPE TMC2130
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
exec_test $1 $2 "BigTreeTech GTR 8 Extruders with Auto-Fan and Mixed TMC Drivers" opt_enable FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE
opt_set FIL_RUNOUT_PIN 3
opt_set FIL_RUNOUT2_PIN 4
opt_set FIL_RUNOUT3_PIN 5
opt_set FIL_RUNOUT4_PIN 6
opt_set FIL_RUNOUT5_PIN 7
opt_set FIL_RUNOUT6_PIN 8
opt_set FIL_RUNOUT7_PIN 9
opt_set FIL_RUNOUT8_PIN 10
opt_set FIL_RUNOUT4_STATE HIGH
opt_enable FIL_RUNOUT4_PULL
opt_set FIL_RUNOUT8_STATE HIGH
opt_enable FIL_RUNOUT8_PULL
exec_test $1 $2 "BigTreeTech GTR 8 Extruders with Auto-Fan, Mixed TMC Drivers, and Runout Sensors with distinct states"
restore_configs restore_configs
opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0

View file

@ -23,6 +23,7 @@ opt_enable VIKI2 SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \
PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \ PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \
Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \ Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \
LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA EMERGENCY_PARSER LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA EMERGENCY_PARSER
opt_disable SD_PROCEDURE_DEPTH
opt_set GRID_MAX_POINTS_X 16 opt_set GRID_MAX_POINTS_X 16
exec_test $1 $2 "Smoothieboard with many features" exec_test $1 $2 "Smoothieboard with many features"

View file

@ -75,6 +75,21 @@ opt_enable ZONESTAR_LCD Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_
FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE Z_SAFE_HOMING FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE Z_SAFE_HOMING
exec_test $1 $2 "RAMPS | ZONESTAR + Chinese | MMU2 | Servo | 3-Point + Debug | G38 ..." exec_test $1 $2 "RAMPS | ZONESTAR + Chinese | MMU2 | Servo | 3-Point + Debug | G38 ..."
#
# 5 runout sensors with distinct states
#
restore_configs
opt_set EXTRUDERS 5
opt_set NUM_SERVOS 1
opt_enable ZONESTAR_LCD Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE BOOT_MARLIN_LOGO_ANIMATED \
AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL \
NO_VOLUMETRICS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET JOYSTICK \
PRUSA_MMU2 MMU2_MENUS PRUSA_MMU2_S_MODE DIRECT_STEPPING DETECT_BROKEN_ENDSTOP \
FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE Z_SAFE_HOMING FIL_RUNOUT3_PULL
opt_set MIXING_STEPPERS 5
opt_set FIL_RUNOUT3_STATE HIGH
exec_test $1 $2 "Multiple runout sensors (x5) | Distinct runout states"
# #
# Test MINIRAMBO with PWM_MOTOR_CURRENT and many features # Test MINIRAMBO with PWM_MOTOR_CURRENT and many features
# #

View file

@ -180,6 +180,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
-<src/gcode/probe/M951.cpp> -<src/gcode/probe/M951.cpp>
-<src/gcode/scara> -<src/gcode/scara>
-<src/gcode/sd> -<src/gcode/sd>
-<src/gcode/sd/M32.cpp>
-<src/gcode/temp/M104_M109.cpp> -<src/gcode/temp/M104_M109.cpp>
-<src/gcode/temp/M155.cpp> -<src/gcode/temp/M155.cpp>
-<src/gcode/units/G20_G21.cpp> -<src/gcode/units/G20_G21.cpp>
@ -221,7 +222,7 @@ HAS_L64XX = Arduino-L6470@0.8.0
src_filter=+<src/libs/L64XX> +<src/module/stepper/L64xx.cpp> +<src/gcode/feature/L6470> src_filter=+<src/libs/L64XX> +<src/module/stepper/L64xx.cpp> +<src/gcode/feature/L6470>
NEOPIXEL_LED = Adafruit NeoPixel@1.5.0 NEOPIXEL_LED = Adafruit NeoPixel@1.5.0
src_filter=+<src/feature/leds/neopixel.cpp> src_filter=+<src/feature/leds/neopixel.cpp>
MAX6675_IS_MAX31865 = Adafruit MAX31865 library@~1.1.0 MAX6675_._IS_MAX31865 = Adafruit MAX31865 library@~1.1.0
USES_LIQUIDCRYSTAL = LiquidCrystal@1.5.0 USES_LIQUIDCRYSTAL = LiquidCrystal@1.5.0
USES_LIQUIDCRYSTAL_I2C = marcoschwartz/LiquidCrystal_I2C@1.1.4 USES_LIQUIDCRYSTAL_I2C = marcoschwartz/LiquidCrystal_I2C@1.1.4
USES_LIQUIDTWI2 = LiquidTWI2@1.2.7 USES_LIQUIDTWI2 = LiquidTWI2@1.2.7
@ -370,6 +371,7 @@ Z_PROBE_SLED = src_filter=+<src/gcode/probe/G31_G32.cpp>
G38_PROBE_TARGET = src_filter=+<src/gcode/probe/G38.cpp> G38_PROBE_TARGET = src_filter=+<src/gcode/probe/G38.cpp>
MAGNETIC_PARKING_EXTRUDER = src_filter=+<src/gcode/probe/M951.cpp> MAGNETIC_PARKING_EXTRUDER = src_filter=+<src/gcode/probe/M951.cpp>
SDSUPPORT = src_filter=+<src/gcode/sd> SDSUPPORT = src_filter=+<src/gcode/sd>
HAS_MEDIA_SUBCALLS = src_filter=+<src/gcode/sd/M32.cpp>
HAS_EXTRUDERS = src_filter=+<src/gcode/temp/M104_M109.cpp> +<src/gcode/config/M221.cpp> HAS_EXTRUDERS = src_filter=+<src/gcode/temp/M104_M109.cpp> +<src/gcode/config/M221.cpp>
AUTO_REPORT_TEMPERATURES = src_filter=+<src/gcode/temp/M155.cpp> AUTO_REPORT_TEMPERATURES = src_filter=+<src/gcode/temp/M155.cpp>
INCH_MODE_SUPPORT = src_filter=+<src/gcode/units/G20_G21.cpp> INCH_MODE_SUPPORT = src_filter=+<src/gcode/units/G20_G21.cpp>