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

This commit is contained in:
Scott Lahteine 2020-11-11 16:03:40 -06:00
commit 6987a1d0a3
46 changed files with 735 additions and 424 deletions

3
.gitignore vendored
View file

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

View file

@ -436,11 +436,11 @@
#define DUMMY_THERMISTOR_998_VALUE 25
#define DUMMY_THERMISTOR_999_VALUE 100
// Resistor values when using a MAX31865 (sensor -5)
// Sensor value is typically 100 (PT100) or 1000 (PT1000)
// Calibration value is typically 430 ohm for AdaFruit PT100 modules and 4300 ohm for AdaFruit PT1000 modules.
//#define MAX31865_SENSOR_OHMS 100
//#define MAX31865_CALIBRATION_OHMS 430
// Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
//#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
//#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for AdaFruit PT100; 4300 for AdaFruit PT1000
//#define MAX31865_SENSOR_OHMS_1 100
//#define MAX31865_CALIBRATION_OHMS_1 430
// 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.
@ -748,7 +748,7 @@
* Override with M92
* 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)
@ -1186,9 +1186,27 @@
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#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 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_PULLDOWN // Use internal pulldown for filament runout pins.
#define FIL_RUNOUT_PULL // Use internal pullup / 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.
// (After 'M412 H' Marlin will ask the host to handle the process.)

View file

@ -811,6 +811,7 @@
//#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_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment
/**
* Screw thread:
@ -1171,6 +1172,7 @@
// Enable this option and set to HIGH if your SD cards are incorrectly detected.
//#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 SD_PROCEDURE_DEPTH 1 // Increase if you need more nested M32 calls
@ -1255,6 +1257,10 @@
// Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM.
#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
//#define LONG_FILENAME_HOST_SUPPORT

View file

@ -163,6 +163,9 @@
#define SET_INPUT(IO) _SET_INPUT(IO)
// Set pin as input with pullup (wrapper)
#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
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
// Set pin as PWM

View file

@ -52,6 +52,9 @@
// Set pin as input with pullup wrapper
#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
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)

View file

@ -19,22 +19,23 @@
*/
#ifdef __PLAT_LINUX__
extern void setup();
extern void loop();
#include <thread>
#include <iostream>
#include <fstream>
//#define GPIO_LOGGING // Full GPIO and Positional Logging
#include "../../inc/MarlinConfig.h"
#include <stdio.h>
#include <stdarg.h>
#include "../shared/Delay.h"
#include "hardware/IOLoggerCSV.h"
#include "hardware/Heater.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
void write_serial_thread() {
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 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
IOLoggerCSV logger("all_gpio_log.csv");
Gpio::attachLogger(&logger);
@ -88,7 +87,7 @@ void simulation_loop() {
#ifdef GPIO_LOGGING
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.flush();
x = x_axis.position;

View file

@ -163,7 +163,7 @@ uint8_t MMU2::get_current_tool() {
}
#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
void MMU2::mmu_loop() {

View file

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

View file

@ -149,17 +149,33 @@ class FilamentSensorBase {
public:
static inline void setup() {
#if ENABLED(FIL_RUNOUT_PULLUP)
#define INIT_RUNOUT_PIN(P) SET_INPUT_PULLUP(P)
#elif ENABLED(FIL_RUNOUT_PULLDOWN)
#define INIT_RUNOUT_PIN(P) SET_INPUT_PULLDOWN(P)
#else
#define INIT_RUNOUT_PIN(P) SET_INPUT(P)
#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(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULL)
#if NUM_RUNOUT_SENSORS >= 1
INIT_RUNOUT_PIN(1);
#endif
#define _INIT_RUNOUT(N) INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN);
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _INIT_RUNOUT)
#undef _INIT_RUNOUT
#if NUM_RUNOUT_SENSORS >= 2
INIT_RUNOUT_PIN(2);
#endif
#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
}
@ -172,11 +188,32 @@ class FilamentSensorBase {
// Return a bitmask of runout flag states (1 bits always indicates runout)
static inline uint8_t poll_runout_states() {
return poll_runout_pins()
#if FIL_RUNOUT_STATE == LOW
^ uint8_t(_BV(NUM_RUNOUT_SENSORS) - 1)
return poll_runout_pins() ^ uint8_t(0
#if NUM_RUNOUT_SENSORS >= 1
| (FIL_RUNOUT1_STATE ? 0 : _BV(1 - 1))
#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

@ -88,7 +88,7 @@ void GcodeSuite::M600() {
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
#if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
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
DXC_ext = active_extruder;
#endif

View file

@ -675,6 +675,73 @@
#define HAS_BED_PROBE 1
#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)
#undef PROBE_MANUALLY
#endif

View file

@ -445,9 +445,9 @@
#define HEATER_0_MAX6675_TMAX 1024
#endif
#if TEMP_SENSOR_0 == -5
#define MAX6675_IS_MAX31865 1
#define MAX6675_0_IS_MAX31865 1
#elif TEMP_SENSOR_0 == -3
#define MAX6675_IS_MAX31855 1
#define MAX6675_0_IS_MAX31855 1
#endif
#elif TEMP_SENSOR_0 == -4
#define HEATER_0_USES_AD8495 1
@ -473,6 +473,11 @@
#define HEATER_1_MAX6675_TMIN 0
#define HEATER_1_MAX6675_TMAX 1024
#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 == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."

View file

@ -111,7 +111,7 @@
#elif defined(FILAMENT_SENSOR)
#error "FILAMENT_SENSOR is now FILAMENT_WIDTH_SENSOR. Please update your configuration."
#elif defined(ENDSTOPPULLUP_FIL_RUNOUT)
#error "ENDSTOPPULLUP_FIL_RUNOUT is now FIL_RUNOUT_PULLUP. Please update your configuration."
#error "ENDSTOPPULLUP_FIL_RUNOUT is now FIL_RUNOUT_PULL. Please update your configuration."
#elif defined(DISABLE_MAX_ENDSTOPS) || defined(DISABLE_MIN_ENDSTOPS)
#error "DISABLE_MAX_ENDSTOPS and DISABLE_MIN_ENDSTOPS deprecated. Use individual USE_*_PLUG options instead."
#elif defined(LANGUAGE_INCLUDE)
@ -405,6 +405,10 @@
#error "MAX6675_SS is now MAX6675_SS_PIN. Please update your configuration and/or pins."
#elif defined(MAX6675_SS2)
#error "MAX6675_SS2 is now MAX6675_SS2_PIN. Please update your configuration and/or pins."
#elif defined(MAX31865_SENSOR_OHMS)
#error "MAX31865_SENSOR_OHMS is now MAX31865_SENSOR_OHMS_0. Please update your configuration."
#elif defined(MAX31865_CALIBRATION_OHMS)
#error "MAX31865_CALIBRATION_OHMS is now MAX31865_CALIBRATION_OHMS_0. Please update your configuration."
#elif defined(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE is now SPINDLE_FEATURE or LASER_FEATURE. Please update your Configuration_adv.h."
#elif defined(SPINDLE_LASER_ENABLE_PIN)
@ -582,6 +586,11 @@
/**
* Serial
*/
#ifndef SERIAL_PORT
#error "SERIAL_PORT must be defined in Configuration.h"
#elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT. Please update your configuration."
#endif
#if !(defined(__AVR__) && defined(USBCON))
#if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
#error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
@ -594,12 +603,6 @@
#error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
#endif
#ifndef SERIAL_PORT
#error "SERIAL_PORT must be defined in Configuration.h"
#elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT. Please update your configuration."
#endif
/**
* Multiple Stepper Drivers Per Axis
*/
@ -660,8 +663,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#if BOTH(ENDSTOPPULLUPS, ENDSTOPPULLDOWNS)
#error "Enable only one of ENDSTOPPULLUPS or ENDSTOPPULLDOWNS."
#elif BOTH(FIL_RUNOUT_PULLUP, FIL_RUNOUT_PULLDOWN)
#error "Enable only one of FIL_RUNOUT_PULLUP or FIL_RUNOUT_PULLDOWN."
#elif BOTH(ENDSTOPPULLUP_XMAX, ENDSTOPPULLDOWN_XMAX)
#error "Enable only one of ENDSTOPPULLUP_X_MAX or ENDSTOPPULLDOWN_X_MAX."
#elif BOTH(ENDSTOPPULLUP_YMAX, ENDSTOPPULLDOWN_YMAX)
@ -814,18 +815,20 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "FILAMENT_RUNOUT_SENSOR requires FIL_RUNOUT_PIN."
#elif NUM_RUNOUT_SENSORS > E_STEPPERS
#error "NUM_RUNOUT_SENSORS cannot exceed the number of E steppers."
#elif NUM_RUNOUT_SENSORS > 1 && !PIN_EXISTS(FIL_RUNOUT2)
#error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 1 requires FIL_RUNOUT2_PIN."
#elif NUM_RUNOUT_SENSORS > 2 && !PIN_EXISTS(FIL_RUNOUT3)
#error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 2 requires FIL_RUNOUT3_PIN."
#elif NUM_RUNOUT_SENSORS > 3 && !PIN_EXISTS(FIL_RUNOUT4)
#error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 3 requires FIL_RUNOUT4_PIN."
#elif NUM_RUNOUT_SENSORS > 4 && !PIN_EXISTS(FIL_RUNOUT5)
#error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 4 requires FIL_RUNOUT5_PIN."
#elif NUM_RUNOUT_SENSORS > 5 && !PIN_EXISTS(FIL_RUNOUT6)
#error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 5 requires FIL_RUNOUT6_PIN."
#elif NONE(SDSUPPORT, PRINTJOB_TIMER_AUTOSTART)
#error "FILAMENT_RUNOUT_SENSOR requires SDSUPPORT or PRINTJOB_TIMER_AUTOSTART."
#elif NUM_RUNOUT_SENSORS >= 2 && !PIN_EXISTS(FIL_RUNOUT2)
#error "FIL_RUNOUT2_PIN is required with NUM_RUNOUT_SENSORS >= 2."
#elif NUM_RUNOUT_SENSORS >= 3 && !PIN_EXISTS(FIL_RUNOUT3)
#error "FIL_RUNOUT3_PIN is required with NUM_RUNOUT_SENSORS >= 3."
#elif NUM_RUNOUT_SENSORS >= 4 && !PIN_EXISTS(FIL_RUNOUT4)
#error "FIL_RUNOUT4_PIN is required with NUM_RUNOUT_SENSORS >= 4."
#elif NUM_RUNOUT_SENSORS >= 5 && !PIN_EXISTS(FIL_RUNOUT5)
#error "FIL_RUNOUT5_PIN is required with NUM_RUNOUT_SENSORS >= 5."
#elif NUM_RUNOUT_SENSORS >= 6 && !PIN_EXISTS(FIL_RUNOUT6)
#error "FIL_RUNOUT6_PIN is required with NUM_RUNOUT_SENSORS >= 6."
#elif NUM_RUNOUT_SENSORS >= 7 && !PIN_EXISTS(FIL_RUNOUT7)
#error "FIL_RUNOUT7_PIN is required with NUM_RUNOUT_SENSORS >= 7."
#elif NUM_RUNOUT_SENSORS >= 8 && !PIN_EXISTS(FIL_RUNOUT8)
#error "FIL_RUNOUT8_PIN is required with NUM_RUNOUT_SENSORS >= 8."
#elif FILAMENT_RUNOUT_DISTANCE_MM < 0
#error "FILAMENT_RUNOUT_DISTANCE_MM must be greater than or equal to zero."
#elif DISABLED(ADVANCED_PAUSE_FEATURE)
@ -1815,8 +1818,10 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT."
#endif
#if MAX6675_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS) && defined(MAX31865_CALIBRATION_OHMS))
#error "MAX31865_SENSOR_OHMS and MAX31865_CALIBRATION_OHMS must be set in Configuration.h when using a MAX31865 temperature sensor."
#if MAX6675_0_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS_0) && defined(MAX31865_CALIBRATION_OHMS_0))
#error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set in Configuration.h if TEMP_SENSOR_0 is MAX31865."
#elif MAX6675_1_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS_1) && defined(MAX31865_CALIBRATION_OHMS_1))
#error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set in Configuration.h if TEMP_SENSOR_1 is MAX31865."
#endif
/**
@ -2194,6 +2199,14 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#endif
#endif
#if ENABLED(SD_IGNORE_AT_STARTUP)
#if ENABLED(POWER_LOSS_RECOVERY)
#error "SD_IGNORE_AT_STARTUP is incompatible with POWER_LOSS_RECOVERY."
#elif ENABLED(SDCARD_EEPROM_EMULATION)
#error "SD_IGNORE_AT_STARTUP is incompatible with SDCARD_EEPROM_EMULATION."
#endif
#endif
/**
* Make sure only one display is enabled
*/

View file

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

View file

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

View file

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

View file

@ -87,7 +87,7 @@ void AnycubicTFTClass::OnSetup() {
SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
SET_INPUT_PULLUP(FIL_RUNOUT_PIN);
SET_INPUT_PULLUP(FIL_RUNOUT1_PIN);
#endif
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
@ -935,7 +935,7 @@ void AnycubicTFTClass::DoFilamentRunoutCheck() {
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
// 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
if (READ(FIL_RUNOUT_PIN)) {
if (READ(FIL_RUNOUT1_PIN)) {
if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) {
// 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"));
@ -983,7 +983,7 @@ void AnycubicTFTClass::PausePrint() {
void AnycubicTFTClass::ResumePrint() {
#if ENABLED(SDSUPPORT)
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
if (READ(FIL_RUNOUT_PIN)) {
if (READ(FIL_RUNOUT1_PIN)) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... ");
#endif

View file

@ -92,12 +92,12 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) {
PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN)
#endif
#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
PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT)
#endif
#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
PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2)
#endif

View file

@ -181,7 +181,7 @@ static void disp_language(uint8_t language, uint8_t state) {
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);
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);
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");
if (i < 3)
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]);
char *temp = strstr(test_public_buf_l, ".GCO");
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);
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);
@ -308,7 +308,7 @@ void disp_gcode_icon(uint8_t file_num) {
lv_btn_use_label_style(buttonText[i]);
lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
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_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_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
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_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);
}
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");
if (i < 3)
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 *btn = lv_btn_create(par, nullptr);
if (id)
lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0);
lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
else
lv_obj_set_event_cb(btn, cb);
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);
if (img) lv_imgbtn_set_src_both(btn, img);
if (id)
lv_obj_set_event_cb_mks(btn, cb, id, nullptr, 0);
lv_obj_set_event_cb_mks(btn, cb, id, "", 0);
else
lv_obj_set_event_cb(btn, cb);
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_set_pos(btn, x, y); /*Set its position*/
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_set_layout(btn, LV_LAYOUT_OFF);
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);
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_use_label_style(buttonReconnect);

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
#include "draw_ui.h"
#include "wifi_module.h"
@ -822,4 +822,4 @@ int32_t wifi_upload(int type) {
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"
#define MAX_UTF8_CHAR_SIZE 4
#if HAS_WIRED_LCD
#include "marlinui.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;
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);
if (0 == (0x80 & 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)) {
val = valcur & 0x1F;
val <<= 6;
p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
NEXT_6_BITS();
p++;
}
#if MAX_UTF8_CHAR_SIZE >= 3
else if (0xE0 == (0xF0 & valcur)) {
val = valcur & 0x0F;
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
NEXT_6_BITS();
NEXT_6_BITS();
p++;
}
#endif
#if MAX_UTF8_CHAR_SIZE >= 4
else if (0xF0 == (0xF8 & valcur)) {
val = valcur & 0x07;
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);
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
p++;
}
#endif
#if MAX_UTF8_CHAR_SIZE >= 5
else if (0xF8 == (0xFC & valcur)) {
val = valcur & 0x03;
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);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
p++;
}
#endif
#if MAX_UTF8_CHAR_SIZE >= 6
else if (0xFC == (0xFE & valcur)) {
val = valcur & 0x01;
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);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
val <<= 6; p++;
valcur = cb_read_byte(p);
val |= (valcur & 0x3F);
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
p++;
}
#endif
else if (0x80 == (0xC0 & valcur))
for (; 0x80 == (0xC0 & valcur); ) { p++; valcur = cb_read_byte(p); }
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;

View file

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

View file

@ -262,6 +262,8 @@ millis_t MarlinUI::next_button_update_ms; // = 0
#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*/) {
SETCURSOR(col, row);
if (!string) return;
@ -324,6 +326,8 @@ millis_t MarlinUI::next_button_update_ms; // = 0
if (suff) wrap_string_P(col, row, suff);
}
#endif // !HAS_GRAPHICAL_TFT
#endif // HAS_LCD_MENU
void MarlinUI::init() {

View file

@ -80,12 +80,10 @@
#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);
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); }
#if ENABLED(SDSUPPORT)
#include "../sd/cardreader.h"
#endif
typedef void (*screenFunc_t)();

View file

@ -50,6 +50,14 @@ bool probe_single_point() {
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");
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);
}

View file

@ -649,7 +649,7 @@ void menu_item(const uint8_t row, bool sel ) {
menu_line(row, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND);
#if ENABLED(TOUCH_SCREEN)
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
}

View file

@ -459,18 +459,19 @@ void _O2 Endstops::report_states() {
#endif
#if HAS_FILAMENT_SENSOR
#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
#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) {
pin_t pin;
uint8_t state;
switch (i) {
default: continue;
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _CASE_RUNOUT)
}
SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
if (i > 1) SERIAL_CHAR(' ', '0' + i);
print_es_state(extDigitalRead(pin) != FIL_RUNOUT_STATE);
print_es_state(extDigitalRead(pin) != state);
}
#undef _CASE_RUNOUT
#endif

View file

@ -44,30 +44,44 @@
#include "../lcd/extui/ui_api.h"
#endif
#if MAX6675_IS_MAX31865
#if MAX6675_0_IS_MAX31865 || MAX6675_1_IS_MAX31865
#include <Adafruit_MAX31865.h>
#ifndef MAX31865_CS_PIN
#define MAX31865_CS_PIN MAX6675_SS_PIN // HW:49 SW:65 for example
#if MAX6675_0_IS_MAX31865 && !defined(MAX31865_CS_PIN) && PIN_EXISTS(MAX6675_SS)
#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
#ifndef MAX31865_MOSI_PIN
#define MAX31865_MOSI_PIN MOSI_PIN // 63
#define MAX31865_MOSI_PIN MOSI_PIN
#endif
#ifndef MAX31865_MISO_PIN
#define MAX31865_MISO_PIN MAX6675_DO_PIN // 42
#define MAX31865_MISO_PIN MAX6675_DO_PIN
#endif
#ifndef MAX31865_SCK_PIN
#define MAX31865_SCK_PIN MAX6675_SCK_PIN // 40
#define MAX31865_SCK_PIN MAX6675_SCK_PIN
#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
, MAX31865_MOSI_PIN // For software SPI also set MOSI/MISO/SCK
, MAX31865_MISO_PIN
, MAX31865_SCK_PIN
, MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN // For software SPI also set MOSI/MISO/SCK
#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
#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
#include "../libs/private_spi.h"
@ -1471,13 +1485,7 @@ void Temperature::manage_heater() {
#if HEATER_0_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_0, raw);
#elif HEATER_0_USES_MAX6675
return (
#if MAX6675_IS_MAX31865
max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS)
#else
raw * 0.25
#endif
);
return TERN(MAX6675_0_IS_MAX31865, max31865_0.temperature(MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0), raw * 0.25);
#elif HEATER_0_USES_AD595
return TEMP_AD595(raw);
#elif HEATER_0_USES_AD8495
@ -1489,7 +1497,7 @@ void Temperature::manage_heater() {
#if HEATER_1_USER_THERMISTOR
return user_thermistor_to_deg_c(CTI_HOTEND_1, raw);
#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 HEATER_1_USES_AD595
return TEMP_AD595(raw);
#elif HEATER_1_USES_AD8495
@ -1691,7 +1699,8 @@ void Temperature::updateTemperaturesFromRawValues() {
*/
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
// Flag that the thermalManager should be running
@ -2200,27 +2209,19 @@ void Temperature::disable_all_heaters() {
#define THERMOCOUPLE_MAX_ERRORS 15
#endif
int Temperature::read_max6675(
#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 };
int Temperature::read_max6675(TERN_(HAS_MULTI_6675, const uint8_t hindex/*=0*/)) {
#define MAX6675_HEAT_INTERVAL 250UL
#if MAX6675_IS_MAX31855
#if MAX6675_0_IS_MAX31855 || MAX6675_1_IS_MAX31855
static uint32_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 7
#define MAX6675_DISCARD_BITS 18
#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
static uint16_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 4
@ -2228,22 +2229,44 @@ void Temperature::disable_all_heaters() {
#define MAX6675_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16
#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
static millis_t next_max6675_ms[COUNT_6675] = { 0 };
millis_t ms = millis();
if (PENDING(ms, next_max6675_ms[hindex]))
return int(
#if COUNT_6675 == 1
max6675_temp
#else
max6675_temp_previous[hindex] // Need to return the correct previous value
#endif
);
if (PENDING(ms, next_max6675_ms[hindex])) return int(MAX6675_TEMP(hindex));
next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL;
#if MAX6675_IS_MAX31865
max6675_temp = int(max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS));
#if HAS_MAX31865
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
//
@ -2254,35 +2277,22 @@ void Temperature::disable_all_heaters() {
spiInit(MAX6675_SPEED_BITS);
#endif
#if COUNT_6675 > 1
#define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0)
#elif HEATER_1_USES_MAX6675
#define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V)
#else
#define WRITE_MAX6675(V) WRITE(MAX6675_SS_PIN, V)
#endif
WRITE_MAX6675(LOW); // enable TT_MAX6675
MAX6675_WRITE(LOW); // enable TT_MAX6675
DELAY_NS(100); // Ensure 100ns delay
// Read a big-endian temperature value
max6675_temp = 0;
for (uint8_t i = sizeof(max6675_temp); i--;) {
max6675_temp |= (
#if MAX6675_SEPARATE_SPI
max6675_spi.receive()
#else
spiRec()
#endif
);
max6675_temp |= TERN(MAX6675_SEPARATE_SPI, max6675_spi.receive(), spiRec());
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)) {
max6675_errors[hindex] += 1;
const uint8_t fault_31865 = TERN1(HAS_MAX31865, maxref.readFault());
if (DISABLED(IGNORE_THERMOCOUPLE_ERRORS) && (max6675_temp & MAX6675_ERROR_MASK) && fault_31865) {
max6675_errors[hindex]++;
if (max6675_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
SERIAL_ERROR_START();
SERIAL_ECHOPGM("Temp measurement error! ");
@ -2294,18 +2304,29 @@ void Temperature::disable_all_heaters() {
SERIAL_ECHOLNPGM("Short to GND");
else if (max6675_temp & 4)
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
SERIAL_ECHOLNPGM("MAX6675");
#endif
// Thermocouple open
max6675_temp = 4 * (
#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
);
max6675_temp = 4 * MAX6675_SEL(HEATER_0_MAX6675_TMAX, HEATER_1_MAX6675_TMAX);
}
else
max6675_temp >>= MAX6675_DISCARD_BITS;
@ -2315,13 +2336,11 @@ void Temperature::disable_all_heaters() {
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
#endif
#if COUNT_6675 > 1
max6675_temp_previous[hindex] = max6675_temp;
#endif
MAX6675_TEMP(hindex) = max6675_temp;
return int(max6675_temp);
}

View file

@ -811,7 +811,7 @@ class Temperature {
#if HAS_MAX6675
#define COUNT_6675 1 + BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)
#if COUNT_6675 > 1
#define HAS_MULTI_6675
#define HAS_MULTI_6675 1
#define READ_MAX6675(N) read_max6675(N)
#else
#define READ_MAX6675(N) read_max6675()

View file

@ -208,31 +208,57 @@
#define E1_SERIAL_TX_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
#define TMC_BAUD_RATE 19200
#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
//
#if SD_CONNECTION_IS(LCD)
#define SS_PIN P0_16
#define SS_PIN EXPA2_07_PIN
#endif
/**
* _____ _____
* NC | · · | GND 5V | · · | GND
* 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)
* (SCK) 0.15 | · · | 0.17 (MISO) (BTN_ENC) 0.28 | · · | 1.30 (BEEPER)
* ----- -----
* EXP2 EXP1
*/
#if HAS_WIRED_LCD
#if HAS_WIRED_LCD && !HAS_BTT_EXP_MOT
#if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING)
#error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING only applies to the ANET 1.0 board."
@ -251,33 +277,33 @@
*
* BEFORE AFTER
* _____ _____
* GND 1 | 1 2 | 2 5V 5V 1 | 1 2 | 2 GND
* CS 3 | 3 4 | 4 BTN_EN2 CS 3 | 3 4 | 4 BTN_EN2
* SID 5 | 5 6 6 BTN_EN1 SID 5 | 5 6 6 BTN_EN1
* open 7 | 7 8 | 8 BTN_ENC CLK 7 | 7 8 | 8 BTN_ENC
* CLK 9 | 9 10| 10 Beeper open 9 | 9 10| 10 Beeper
* GND | 1 2 | 5V 5V | 1 2 | GND
* CS | 3 4 | BTN_EN2 CS | 3 4 | BTN_EN2
* SID | 5 6 BTN_EN1 SID | 5 6 BTN_EN1
* open | 7 8 | BTN_ENC CLK | 7 8 | BTN_ENC
* CLK | 9 10| Beeper open | 9 10| Beeper
* ----- -----
* LCD LCD
*/
#define LCD_PINS_RS P1_23
#define LCD_PINS_RS EXPA1_03_PIN
#define BTN_EN1 P1_20
#define BTN_EN2 P1_22
#define BTN_ENC P1_18
#define BTN_EN1 EXPA1_06_PIN
#define BTN_EN2 EXPA1_04_PIN
#define BTN_ENC EXPA1_08_PIN
#define LCD_PINS_ENABLE P1_21
#define LCD_PINS_D4 P1_19
#define LCD_PINS_ENABLE EXPA1_05_PIN
#define LCD_PINS_D4 EXPA1_07_PIN
#elif ENABLED(CR10_STOCKDISPLAY)
#define BTN_ENC P0_28 // (58) open-drain
#define LCD_PINS_RS P1_22
#define BTN_ENC EXPA1_09_PIN // (58) open-drain
#define LCD_PINS_RS EXPA1_04_PIN
#define BTN_EN1 P1_18
#define BTN_EN2 P1_20
#define BTN_EN1 EXPA1_08_PIN
#define BTN_EN2 EXPA1_06_PIN
#define LCD_PINS_ENABLE P1_23
#define LCD_PINS_D4 P1_21
#define LCD_PINS_ENABLE EXPA1_03_PIN
#define LCD_PINS_D4 EXPA1_05_PIN
#elif ENABLED(ENDER2_STOCKDISPLAY)
@ -285,43 +311,43 @@
* _____
* 5V | 1 2 | GND
* (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)
* (BTN_ENC) 0.28 | 9 10| 1.30 (SCK)
* -----
* EXP1
*/
#define BTN_EN1 P1_18
#define BTN_EN2 P1_20
#define BTN_ENC P0_28
#define BTN_EN1 EXPA1_08_PIN
#define BTN_EN2 EXPA1_06_PIN
#define BTN_ENC EXPA1_09_PIN
#define DOGLCD_CS P1_22
#define DOGLCD_A0 P1_21
#define DOGLCD_SCK P1_30
#define DOGLCD_MOSI P1_23
#define DOGLCD_CS EXPA1_04_PIN
#define DOGLCD_A0 EXPA1_05_PIN
#define DOGLCD_SCK EXPA1_10_PIN
#define DOGLCD_MOSI EXPA1_03_PIN
#define FORCE_SOFT_SPI
#define LCD_BACKLIGHT_PIN -1
#elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
#define TFT_CS_PIN P1_22
#define TFT_A0_PIN P1_23
#define TFT_DC_PIN P1_23
#define TFT_MISO_PIN P0_17
#define TFT_BACKLIGHT_PIN P1_18
#define TFT_RESET_PIN P1_19
#define TFT_CS_PIN EXPA1_04_PIN
#define TFT_A0_PIN EXPA1_03_PIN
#define TFT_DC_PIN EXPA1_03_PIN
#define TFT_MISO_PIN EXPA2_10_PIN
#define TFT_BACKLIGHT_PIN EXPA1_08_PIN
#define TFT_RESET_PIN EXPA1_07_PIN
#define LCD_USE_DMA_SPI
#define TOUCH_INT_PIN P1_21
#define TOUCH_CS_PIN P1_20
#define TOUCH_INT_PIN EXPA1_05_PIN
#define TOUCH_CS_PIN EXPA1_06_PIN
#define TOUCH_BUTTONS_HW_SPI
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
// SPI 1
#define SCK_PIN P0_15
#define MISO_PIN P0_17
#define MOSI_PIN P0_18
#define SCK_PIN EXPA2_09_PIN
#define MISO_PIN EXPA2_10_PIN
#define MOSI_PIN EXPA2_05_PIN
// Disable any LCD related PINs config
#define LCD_PINS_ENABLE -1
@ -361,72 +387,72 @@
#elif IS_TFTGLCD_PANEL
#if ENABLED(TFTGLCD_PANEL_SPI)
#define TFTGLCD_CS P3_26
#define TFTGLCD_CS EXPA2_08_PIN
#endif
#define SD_DETECT_PIN P1_31
#define SD_DETECT_PIN EXPA2_04_PIN
#else
#define BTN_ENC P0_28 // (58) open-drain
#define LCD_PINS_RS P1_19
#define BTN_ENC EXPA1_09_PIN // (58) open-drain
#define LCD_PINS_RS EXPA1_07_PIN
#define BTN_EN1 P3_26 // (31) J3-2 & AUX-4
#define BTN_EN2 P3_25 // (33) J3-4 & AUX-4
#define BTN_EN1 EXPA2_08_PIN // (31) J3-2 & AUX-4
#define BTN_EN2 EXPA2_06_PIN // (33) J3-4 & AUX-4
#define LCD_PINS_ENABLE P1_18
#define LCD_PINS_D4 P1_20
#define LCD_PINS_ENABLE EXPA1_08_PIN
#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)
#define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant)
#define SD_DETECT_PIN EXPA2_04_PIN // (49) (NOT 5V tolerant)
#endif
#if ENABLED(FYSETC_MINI_12864)
#define DOGLCD_CS P1_18
#define DOGLCD_A0 P1_19
#define DOGLCD_SCK P0_15
#define DOGLCD_MOSI P0_18
#define DOGLCD_CS EXPA1_08_PIN
#define DOGLCD_A0 EXPA1_07_PIN
#define DOGLCD_SCK EXPA2_09_PIN
#define DOGLCD_MOSI EXPA2_05_PIN
#define LCD_BACKLIGHT_PIN -1
#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
#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)
#ifndef RGB_LED_R_PIN
#define RGB_LED_R_PIN P1_21
#define RGB_LED_R_PIN EXPA1_05_PIN
#endif
#ifndef RGB_LED_G_PIN
#define RGB_LED_G_PIN P1_22
#define RGB_LED_G_PIN EXPA1_04_PIN
#endif
#ifndef RGB_LED_B_PIN
#define RGB_LED_B_PIN P1_23
#define RGB_LED_B_PIN EXPA1_03_PIN
#endif
#elif ENABLED(FYSETC_MINI_12864_2_1)
#define NEOPIXEL_PIN P1_21
#define NEOPIXEL_PIN EXPA1_05_PIN
#endif
#else // !FYSETC_MINI_12864
#if ENABLED(MKS_MINI_12864)
#define DOGLCD_CS P1_21
#define DOGLCD_A0 P1_22
#define DOGLCD_SCK P0_15
#define DOGLCD_MOSI P0_18
#define DOGLCD_CS EXPA1_05_PIN
#define DOGLCD_A0 EXPA1_04_PIN
#define DOGLCD_SCK EXPA2_09_PIN
#define DOGLCD_MOSI EXPA2_05_PIN
#define FORCE_SOFT_SPI
#endif
#if IS_ULTIPANEL
#define LCD_PINS_D5 P1_21
#define LCD_PINS_D6 P1_22
#define LCD_PINS_D7 P1_23
#define LCD_PINS_D5 EXPA1_05_PIN
#define LCD_PINS_D6 EXPA1_04_PIN
#define LCD_PINS_D7 EXPA1_03_PIN
#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

View file

@ -29,6 +29,14 @@
#error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
#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.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
@ -115,3 +123,46 @@
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board."
#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)
* (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
* GND | · · | 5V GND | · · | NC
* ----- -----

View file

@ -251,7 +251,7 @@
* _____ _____
* (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_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
* GND | · · | 5V GND | · · | NC
* ----- -----

View file

@ -155,7 +155,7 @@
* _____
* 5V | · · | GND
* (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)
* (BTN_ENC) P1_30 | · · | P1_31 (BEEPER)
* -----

View file

@ -201,7 +201,7 @@
* ----- -----
* 5V/D41 | · · | GND 5V | · · | GND
* 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)
* (SCK) D52 | · · | D50 (MISO) (BTN_ENC) D35 | · · | D37 (BEEPER)
* ----- -----

View file

@ -1103,18 +1103,66 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
if (WITHIN(seq, 1, MAX_VFAT_ENTRIES)) {
// TODO: Store the filename checksum to verify if a long-filename-unaware system modified the file table.
n = (seq - 1) * (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];
LOOP_L_N(i, FILENAME_LENGTH) {
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 (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
if (DIR_IS_FILE_OR_SUBDIR(dir)) return n;
}
}
// Return if normal file or subdirectory
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
// Assumes file is correctly positioned

View file

@ -103,5 +103,10 @@
#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
#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

@ -425,6 +425,7 @@ void CardReader::manage_media() {
if (stat) { // Media Inserted
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
#if MB(FYSETC_CHEETAH, FYSETC_CHEETAH_V12, FYSETC_AIO_II)
reset_stepper_drivers(); // Workaround for Cheetah bug
@ -562,8 +563,7 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0*
// Store current filename (based on workDirParents) and position
getAbsFilename(proc_filenames[file_subcall_ctr]);
TERN_(HAS_MEDIA_SUBCALLS, filespos[file_subcall_ctr] = sdpos);
filespos[file_subcall_ctr] = sdpos;
// For sub-procedures say 'SUBROUTINE CALL target: "..." parent: "..." pos12345'
SERIAL_ECHO_START();

View file

@ -55,10 +55,10 @@ extern "C"{
*----------------------------------------------------------------------------*/
// Number of pins defined in PinDescription array
#define PINS_COUNT (79U)
#define NUM_DIGITAL_PINS (66U)
#define NUM_ANALOG_INPUTS (12U)
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
#define PINS_COUNT 79
#define NUM_DIGITAL_PINS 66
#define NUM_ANALOG_INPUTS 12
#define analogInputToDigitalPin(p) ((p < 12) ? (p) + 54 : -1)
#define digitalPinToPort(P) ( g_APinDescription[P].pPort )
#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);
#define NEXT_6_BITS() do{ val <<= 6; p++; val |= (*p & 0x3F); }while(0)
if (0 == (0x80 & *p)) {
val = (size_t)*p;
p++;
}
else if (0xC0 == (0xE0 & *p)) {
val = *p & 0x1F;
val <<= 6;
p++;
val |= (*p & 0x3F);
NEXT_6_BITS();
p++;
assert((wchar_t)val == get_val_utf82uni(pstart));
}
else if (0xE0 == (0xF0 & *p)) {
val = *p & 0x0F;
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
NEXT_6_BITS();
NEXT_6_BITS();
p++;
assert((wchar_t)val == get_val_utf82uni(pstart));
}
else if (0xF0 == (0xF8 & *p)) {
val = *p & 0x07;
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
p++;
assert((wchar_t)val == get_val_utf82uni(pstart));
}
else if (0xF8 == (0xFC & *p)) {
val = *p & 0x03;
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
p++;
assert((wchar_t)val == get_val_utf82uni(pstart));
}
else if (0xFC == (0xFE & *p)) {
val = *p & 0x01;
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
val <<= 6; p++;
val |= (*p & 0x3F);
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
NEXT_6_BITS();
p++;
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 Y_DRIVER_TYPE TMC2130
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
opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0

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
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
#

View file

@ -222,7 +222,7 @@ HAS_L64XX = Arduino-L6470@0.8.0
src_filter=+<src/libs/L64XX> +<src/module/stepper/L64xx.cpp> +<src/gcode/feature/L6470>
NEOPIXEL_LED = Adafruit NeoPixel@1.5.0
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_I2C = marcoschwartz/LiquidCrystal_I2C@1.1.4
USES_LIQUIDTWI2 = LiquidTWI2@1.2.7