Merge branch 'bugfix-2.0.x' into CrealityDwin2.0_Bleeding
This commit is contained in:
+12
-10
@@ -1042,6 +1042,7 @@
|
||||
* 67 : 500kΩ SliceEngineering 450°C Thermistor
|
||||
* 70 : 100kΩ bq Hephestos 2
|
||||
* 75 : 100kΩ Generic Silicon Heat Pad with NTC100K MGB18-104F39050L32
|
||||
* 2000 : 100kΩ Ultimachine Rambo TDK NTCG104LH104KT1 NTC100K motherboard Thermistor
|
||||
*
|
||||
* Analog Thermistors - 1kΩ pullup - Atypical, and requires changing out the 4.7kΩ pullup for 1kΩ.
|
||||
* ------- (but gives greater accuracy and more stable PID)
|
||||
@@ -1065,7 +1066,7 @@
|
||||
* NOTE: ADC pins are not 5V tolerant. Not recommended because it's possible to damage the CPU by going over 500°C.
|
||||
* 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x
|
||||
*
|
||||
* Custom/Dummy/Other Thermos
|
||||
* Custom/Dummy/Other Thermal Sensors
|
||||
* ------
|
||||
* 0 : not used
|
||||
* 1000 : Custom - Specify parameters in Configuration_adv.h
|
||||
@@ -1118,6 +1119,8 @@
|
||||
#define TEMP_CHAMBER_PIN 12
|
||||
#endif
|
||||
#define TEMP_SENSOR_COOLER 0
|
||||
#define TEMP_SENSOR_BOARD 0
|
||||
#define TEMP_SENSOR_REDUNDANT 0
|
||||
|
||||
// Dummy thermistor constant temperature readings, for use with 998 and 999
|
||||
#define DUMMY_THERMISTOR_998_VALUE 25
|
||||
@@ -1155,17 +1158,11 @@
|
||||
* the print will be aborted. Whichever sensor is selected will have its normal functions disabled; i.e. selecting
|
||||
* the Bed sensor (-1) will disable bed heating/monitoring.
|
||||
*
|
||||
* Use the following to select temp sensors:
|
||||
* -5 : Cooler
|
||||
* -4 : Probe
|
||||
* -3 : not used
|
||||
* -2 : Chamber
|
||||
* -1 : Bed
|
||||
* 0-7 : E0 through E7
|
||||
* For selecting source/target use: COOLER, PROBE, BOARD, CHAMBER, BED, E0, E1, E2, E3, E4, E5, E6, E7
|
||||
*/
|
||||
#if TEMP_SENSOR_REDUNDANT
|
||||
#define TEMP_SENSOR_REDUNDANT_SOURCE 1 // The sensor that will provide the redundant reading.
|
||||
#define TEMP_SENSOR_REDUNDANT_TARGET 0 // The sensor that we are providing a redundant reading for.
|
||||
#define TEMP_SENSOR_REDUNDANT_SOURCE E1 // The sensor that will provide the redundant reading.
|
||||
#define TEMP_SENSOR_REDUNDANT_TARGET E0 // The sensor that we are providing a redundant reading for.
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_DIFF 10 // (°C) Temperature difference that will trigger a print abort.
|
||||
#endif
|
||||
|
||||
@@ -3742,6 +3739,11 @@
|
||||
//
|
||||
//#define MKS_MINI_12864
|
||||
|
||||
//
|
||||
// MKS MINI12864 V3 is an alias for FYSETC_MINI_12864_2_1. Type A/B. NeoPixel RGB Backlight.
|
||||
//
|
||||
//#define MKS_MINI_12864_V3
|
||||
|
||||
//
|
||||
// MKS LCD12864A/B with graphic controller and SD support. Follows MKS_MINI_12864 pinout.
|
||||
// https://www.aliexpress.com/item/33018110072.html
|
||||
|
||||
+34
-11
@@ -125,6 +125,12 @@
|
||||
#define PROBE_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_BOARD == 1000
|
||||
#define BOARD_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define BOARD_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
#define BOARD_BETA 3950 // Beta value
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_REDUNDANT == 1000
|
||||
#define REDUNDANT_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
|
||||
#define REDUNDANT_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
|
||||
@@ -224,6 +230,18 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Motherboard Sensor options
|
||||
//
|
||||
#if TEMP_SENSOR_BOARD
|
||||
#define THERMAL_PROTECTION_BOARD // Halt the printer if the board sensor leaves the temp range below.
|
||||
#define BOARD_MINTEMP 8 // (°C)
|
||||
#define BOARD_MAXTEMP 70 // (°C)
|
||||
#ifndef TEMP_BOARD_PIN
|
||||
//#define TEMP_BOARD_PIN -1 // Board temp sensor pin, if not set in pins file.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Laser Coolant Flow Meter
|
||||
//
|
||||
@@ -505,15 +523,20 @@
|
||||
#define USE_CONTROLLER_FAN
|
||||
#endif
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
|
||||
//#define CONTROLLER_FAN_USE_Z_ONLY // With this option only the Z axis is considered
|
||||
#define CONTROLLERFAN_SPEED_MIN 0 // (0-255) Minimum speed. (If set below this value the fan is turned off.)
|
||||
#define CONTROLLERFAN_SPEED_ACTIVE 255 // (0-255) Active speed, used when any motor is enabled
|
||||
#define CONTROLLERFAN_SPEED_IDLE 0 // (0-255) Idle speed, used when motors are disabled
|
||||
#define CONTROLLERFAN_IDLE_TIME 60 // (seconds) Extra time to keep the fan running after disabling motors
|
||||
//#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings
|
||||
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
|
||||
//#define CONTROLLER_FAN_USE_Z_ONLY // With this option only the Z axis is considered
|
||||
//#define CONTROLLER_FAN_IGNORE_Z // Ignore Z stepper. Useful when stepper timeout is disabled.
|
||||
#define CONTROLLERFAN_SPEED_MIN 0 // (0-255) Minimum speed. (If set below this value the fan is turned off.)
|
||||
#define CONTROLLERFAN_SPEED_ACTIVE 255 // (0-255) Active speed, used when any motor is enabled
|
||||
#define CONTROLLERFAN_SPEED_IDLE 0 // (0-255) Idle speed, used when motors are disabled
|
||||
#define CONTROLLERFAN_IDLE_TIME 60 // (seconds) Extra time to keep the fan running after disabling motors
|
||||
|
||||
// Use TEMP_SENSOR_BOARD as a trigger for enabling the controller fan
|
||||
//#define CONTROLLER_FAN_MIN_BOARD_TEMP 40 // (°C) Turn on the fan if the board reaches this temperature
|
||||
|
||||
//#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings
|
||||
#if ENABLED(CONTROLLER_FAN_EDITABLE)
|
||||
#define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu
|
||||
#define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -2093,9 +2116,9 @@
|
||||
// calibration.
|
||||
//#define BTC_PROBE_TEMP 30 // (°C)
|
||||
|
||||
// Height above Z=0.0f to raise the nozzle. Lowering this can help the probe to heat faster.
|
||||
// Note: the Z=0.0f offset is determined by the probe offset which can be set using M851.
|
||||
//#define PTC_PROBE_HEATING_OFFSET 0.5f
|
||||
// Height above Z=0.0 to raise the nozzle. Lowering this can help the probe to heat faster.
|
||||
// Note: the Z=0.0 offset is determined by the probe offset which can be set using M851.
|
||||
//#define PTC_PROBE_HEATING_OFFSET 0.5
|
||||
|
||||
// Height to raise the Z-probe between heating and taking the next measurement. Some probes
|
||||
// may fail to untrigger if they have been triggered for a long time, which can be solved by
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
#define STRING_DISTRIBUTION_DATE "2021-06-18"
|
||||
#define STRING_DISTRIBUTION_DATE "2021-07-21"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
uint8_t u8g_bitData, u8g_bitNotData, u8g_bitClock, u8g_bitNotClock;
|
||||
volatile uint8_t *u8g_outData, *u8g_outClock;
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
}
|
||||
|
||||
// all the others
|
||||
static uint32_t spiDelayCyclesX4 = 4 * (F_CPU) / 1000000; // 4µs => 125khz
|
||||
static uint16_t spiDelayNS = 4000; // 4000ns => 125khz
|
||||
|
||||
static uint8_t spiTransferX(uint8_t b) { // using Mode 0
|
||||
int bits = 8;
|
||||
@@ -249,12 +249,12 @@
|
||||
b <<= 1; // little setup time
|
||||
|
||||
WRITE(SD_SCK_PIN, HIGH);
|
||||
DELAY_CYCLES(spiDelayCyclesX4);
|
||||
DELAY_NS(spiDelayNS);
|
||||
|
||||
b |= (READ(SD_MISO_PIN) != 0);
|
||||
|
||||
WRITE(SD_SCK_PIN, LOW);
|
||||
DELAY_CYCLES(spiDelayCyclesX4);
|
||||
DELAY_NS(spiDelayNS);
|
||||
} while (--bits);
|
||||
return b;
|
||||
}
|
||||
@@ -510,7 +510,7 @@
|
||||
spiRxBlock = (pfnSpiRxBlock)spiRxBlockX;
|
||||
break;
|
||||
default:
|
||||
spiDelayCyclesX4 = ((F_CPU) / 1000000) >> (6 - spiRate) << 2; // spiRate of 2 gives the maximum error with current CPU
|
||||
spiDelayNS = 4000 >> (6 - spiRate); // spiRate of 2 gives the maximum error with current CPU
|
||||
spiTransferTx = (pfnSpiTransfer)spiTransferX;
|
||||
spiTransferRx = (pfnSpiTransfer)spiTransferX;
|
||||
spiTxBlock = (pfnSpiTxBlock)spiTxBlockX;
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#include "../../../MarlinCore.h"
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
#include "../../shared/Delay.h"
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#include "u8g_com_HAL_DUE_sw_spi_shared.h"
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
#include "../../shared/Marduino.h"
|
||||
#include "../../shared/Delay.h"
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#if ENABLED(FYSETC_MINI_12864)
|
||||
#define SPISEND_SW_DUE u8g_spiSend_sw_DUE_mode_3
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
#include "../../shared/Delay.h"
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#include "u8g_com_HAL_DUE_sw_spi_shared.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "../../shared/Marduino.h"
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index);
|
||||
void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level);
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
#ifndef LCD_SPI_SPEED
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#define I2C_SLA (0x3C*2)
|
||||
//#define I2C_CMD_MODE 0x080
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
#include "../../shared/Delay.h"
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
#if ENABLED(U8GLIB_ST7920)
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
#include <SoftwareSPI.h>
|
||||
#include "../../shared/Delay.h"
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
#include <LPC17xx.h>
|
||||
#include <gpio.h>
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "HAL.h"
|
||||
#include "usb_serial.h"
|
||||
@@ -91,15 +91,13 @@ void HAL_init() {
|
||||
USB_Hook_init();
|
||||
#endif
|
||||
|
||||
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
|
||||
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
|
||||
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
MSC_SD_init(); // Enable USB SD card access
|
||||
#endif
|
||||
TERN_(HAS_SD_HOST_DRIVE, MSC_SD_init()); // Enable USB SD card access
|
||||
|
||||
#if PIN_EXISTS(USB_CONNECT)
|
||||
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
|
||||
delay(1000); // Give OS time to notice
|
||||
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
|
||||
delay(1000); // Give OS time to notice
|
||||
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
|
||||
#endif
|
||||
}
|
||||
@@ -167,4 +165,4 @@ void HAL_SYSTICK_Callback() {
|
||||
if (systick_user_callback) systick_user_callback();
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -224,4 +224,4 @@ static SPISettings spiConfig;
|
||||
|
||||
#endif // SOFTWARE_SPI
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(STM32H7xx)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1) && !defined(STM32H7xx)
|
||||
|
||||
#include "MarlinSPI.h"
|
||||
|
||||
@@ -165,4 +165,4 @@ uint8_t MarlinSPI::dmaSend(const void * transmitBuf, uint16_t length, bool minc)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1 && !STM32H7xx
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "MarlinSerial.h"
|
||||
@@ -101,4 +101,4 @@ void MarlinSerial::_rx_complete_irq(serial_t *obj) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -28,319 +28,296 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if NONE(STM32F103xE, STM32F103xG, STM32F4xx, STM32F7xx)
|
||||
#error "ERROR - Only STM32F103xE, STM32F103xG, STM32F4xx or STM32F7xx CPUs supported"
|
||||
// use local drivers
|
||||
#if defined(STM32F103xE) || defined(STM32F103xG)
|
||||
#include <stm32f1xx_hal_rcc_ex.h>
|
||||
#include <stm32f1xx_hal_sd.h>
|
||||
#elif defined(STM32F4xx)
|
||||
#include <stm32f4xx_hal_rcc.h>
|
||||
#include <stm32f4xx_hal_dma.h>
|
||||
#include <stm32f4xx_hal_gpio.h>
|
||||
#include <stm32f4xx_hal_sd.h>
|
||||
#elif defined(STM32F7xx)
|
||||
#include <stm32f7xx_hal_rcc.h>
|
||||
#include <stm32f7xx_hal_dma.h>
|
||||
#include <stm32f7xx_hal_gpio.h>
|
||||
#include <stm32f7xx_hal_sd.h>
|
||||
#else
|
||||
#error "SDIO only supported with STM32F103xE, STM32F103xG, STM32F4xx, or STM32F7xx."
|
||||
#endif
|
||||
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
// Fixed
|
||||
#define SDIO_D0_PIN PC8
|
||||
#define SDIO_D1_PIN PC9
|
||||
#define SDIO_D2_PIN PC10
|
||||
#define SDIO_D3_PIN PC11
|
||||
#define SDIO_CK_PIN PC12
|
||||
#define SDIO_CMD_PIN PD2
|
||||
|
||||
// use USB drivers
|
||||
SD_HandleTypeDef hsd; // create SDIO structure
|
||||
// F4 supports one DMA for RX and another for TX, but Marlin will never
|
||||
// do read and write at same time, so we use the same DMA for both.
|
||||
DMA_HandleTypeDef hdma_sdio;
|
||||
|
||||
extern "C" {
|
||||
int8_t SD_MSC_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
|
||||
int8_t SD_MSC_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
|
||||
extern SD_HandleTypeDef hsd;
|
||||
}
|
||||
/*
|
||||
SDIO_INIT_CLK_DIV is 118
|
||||
SDIO clock frequency is 48MHz / (TRANSFER_CLOCK_DIV + 2)
|
||||
SDIO init clock frequency should not exceed 400KHz = 48MHz / (118 + 2)
|
||||
|
||||
bool SDIO_Init() {
|
||||
return hsd.State == HAL_SD_STATE_READY; // return pass/fail status
|
||||
}
|
||||
Default TRANSFER_CLOCK_DIV is 2 (118 / 40)
|
||||
Default SDIO clock frequency is 48MHz / (2 + 2) = 12 MHz
|
||||
This might be too fast for stable SDIO operations
|
||||
|
||||
bool SDIO_ReadBlock(uint32_t block, uint8_t *src) {
|
||||
int8_t status = SD_MSC_Read(0, (uint8_t*)src, block, 1); // read one 512 byte block
|
||||
return (bool) status;
|
||||
}
|
||||
MKS Robin board seems to have stable SDIO with BusWide 1bit and ClockDiv 8 i.e. 4.8MHz SDIO clock frequency
|
||||
Additional testing is required as there are clearly some 4bit initialization problems
|
||||
*/
|
||||
|
||||
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
||||
int8_t status = SD_MSC_Write(0, (uint8_t*)src, block, 1); // write one 512 byte block
|
||||
return (bool) status;
|
||||
}
|
||||
#ifndef USBD_OK
|
||||
#define USBD_OK 0
|
||||
#endif
|
||||
|
||||
#else // !USBD_USE_CDC_COMPOSITE
|
||||
// Target Clock, configurable. Default is 18MHz, from STM32F1
|
||||
#ifndef SDIO_CLOCK
|
||||
#define SDIO_CLOCK 18000000 // 18 MHz
|
||||
#endif
|
||||
|
||||
// use local drivers
|
||||
#if defined(STM32F103xE) || defined(STM32F103xG)
|
||||
#include <stm32f1xx_hal_rcc_ex.h>
|
||||
#include <stm32f1xx_hal_sd.h>
|
||||
#elif defined(STM32F4xx)
|
||||
#include <stm32f4xx_hal_rcc.h>
|
||||
#include <stm32f4xx_hal_dma.h>
|
||||
#include <stm32f4xx_hal_gpio.h>
|
||||
#include <stm32f4xx_hal_sd.h>
|
||||
#elif defined(STM32F7xx)
|
||||
#include <stm32f7xx_hal_rcc.h>
|
||||
#include <stm32f7xx_hal_dma.h>
|
||||
#include <stm32f7xx_hal_gpio.h>
|
||||
#include <stm32f7xx_hal_sd.h>
|
||||
#else
|
||||
#error "ERROR - Only STM32F103xE, STM32F103xG, STM32F4xx or STM32F7xx CPUs supported"
|
||||
// SDIO retries, configurable. Default is 3, from STM32F1
|
||||
#ifndef SDIO_READ_RETRIES
|
||||
#define SDIO_READ_RETRIES 3
|
||||
#endif
|
||||
|
||||
// SDIO Max Clock (naming from STM Manual, don't change)
|
||||
#define SDIOCLK 48000000
|
||||
|
||||
static uint32_t clock_to_divider(uint32_t clk) {
|
||||
// limit the SDIO master clock to 8/3 of PCLK2. See STM32 Manuals
|
||||
// Also limited to no more than 48Mhz (SDIOCLK).
|
||||
const uint32_t pclk2 = HAL_RCC_GetPCLK2Freq();
|
||||
clk = min(clk, (uint32_t)(pclk2 * 8 / 3));
|
||||
clk = min(clk, (uint32_t)SDIOCLK);
|
||||
// Round up divider, so we don't run the card over the speed supported,
|
||||
// and subtract by 2, because STM32 will add 2, as written in the manual:
|
||||
// SDIO_CK frequency = SDIOCLK / [CLKDIV + 2]
|
||||
return pclk2 / clk + (pclk2 % clk != 0) - 2;
|
||||
}
|
||||
|
||||
void go_to_transfer_speed() {
|
||||
/* Default SDIO peripheral configuration for SD card initialization */
|
||||
hsd.Init.ClockEdge = hsd.Init.ClockEdge;
|
||||
hsd.Init.ClockBypass = hsd.Init.ClockBypass;
|
||||
hsd.Init.ClockPowerSave = hsd.Init.ClockPowerSave;
|
||||
hsd.Init.BusWide = hsd.Init.BusWide;
|
||||
hsd.Init.HardwareFlowControl = hsd.Init.HardwareFlowControl;
|
||||
hsd.Init.ClockDiv = clock_to_divider(SDIO_CLOCK);
|
||||
|
||||
/* Initialize SDIO peripheral interface with default configuration */
|
||||
SDIO_Init(hsd.Instance, hsd.Init);
|
||||
}
|
||||
|
||||
void SD_LowLevel_Init(void) {
|
||||
uint32_t tempreg;
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = 1; //GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
|
||||
#if DISABLED(STM32F1xx)
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
|
||||
#endif
|
||||
|
||||
// Fixed
|
||||
#define SDIO_D0_PIN PC8
|
||||
#define SDIO_D1_PIN PC9
|
||||
#define SDIO_D2_PIN PC10
|
||||
#define SDIO_D3_PIN PC11
|
||||
#define SDIO_CK_PIN PC12
|
||||
#define SDIO_CMD_PIN PD2
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_12; // D0 & SCK
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
SD_HandleTypeDef hsd; // create SDIO structure
|
||||
// F4 supports one DMA for RX and another for TX, but Marlin will never
|
||||
// do read and write at same time, so we use the same DMA for both.
|
||||
DMA_HandleTypeDef hdma_sdio;
|
||||
|
||||
/*
|
||||
SDIO_INIT_CLK_DIV is 118
|
||||
SDIO clock frequency is 48MHz / (TRANSFER_CLOCK_DIV + 2)
|
||||
SDIO init clock frequency should not exceed 400KHz = 48MHz / (118 + 2)
|
||||
|
||||
Default TRANSFER_CLOCK_DIV is 2 (118 / 40)
|
||||
Default SDIO clock frequency is 48MHz / (2 + 2) = 12 MHz
|
||||
This might be too fast for stable SDIO operations
|
||||
|
||||
MKS Robin board seems to have stable SDIO with BusWide 1bit and ClockDiv 8 i.e. 4.8MHz SDIO clock frequency
|
||||
Additional testing is required as there are clearly some 4bit initialization problems
|
||||
*/
|
||||
|
||||
#ifndef USBD_OK
|
||||
#define USBD_OK 0
|
||||
#endif
|
||||
|
||||
// Target Clock, configurable. Default is 18MHz, from STM32F1
|
||||
#ifndef SDIO_CLOCK
|
||||
#define SDIO_CLOCK 18000000 // 18 MHz
|
||||
#endif
|
||||
|
||||
// SDIO retries, configurable. Default is 3, from STM32F1
|
||||
#ifndef SDIO_READ_RETRIES
|
||||
#define SDIO_READ_RETRIES 3
|
||||
#endif
|
||||
|
||||
// SDIO Max Clock (naming from STM Manual, don't change)
|
||||
#define SDIOCLK 48000000
|
||||
|
||||
static uint32_t clock_to_divider(uint32_t clk) {
|
||||
// limit the SDIO master clock to 8/3 of PCLK2. See STM32 Manuals
|
||||
// Also limited to no more than 48Mhz (SDIOCLK).
|
||||
const uint32_t pclk2 = HAL_RCC_GetPCLK2Freq();
|
||||
clk = min(clk, (uint32_t)(pclk2 * 8 / 3));
|
||||
clk = min(clk, (uint32_t)SDIOCLK);
|
||||
// Round up divider, so we don't run the card over the speed supported,
|
||||
// and subtract by 2, because STM32 will add 2, as written in the manual:
|
||||
// SDIO_CK frequency = SDIOCLK / [CLKDIV + 2]
|
||||
return pclk2 / clk + (pclk2 % clk != 0) - 2;
|
||||
}
|
||||
|
||||
void go_to_transfer_speed() {
|
||||
/* Default SDIO peripheral configuration for SD card initialization */
|
||||
hsd.Init.ClockEdge = hsd.Init.ClockEdge;
|
||||
hsd.Init.ClockBypass = hsd.Init.ClockBypass;
|
||||
hsd.Init.ClockPowerSave = hsd.Init.ClockPowerSave;
|
||||
hsd.Init.BusWide = hsd.Init.BusWide;
|
||||
hsd.Init.HardwareFlowControl = hsd.Init.HardwareFlowControl;
|
||||
hsd.Init.ClockDiv = clock_to_divider(SDIO_CLOCK);
|
||||
|
||||
/* Initialize SDIO peripheral interface with default configuration */
|
||||
SDIO_Init(hsd.Instance, hsd.Init);
|
||||
}
|
||||
|
||||
void SD_LowLevel_Init(void) {
|
||||
uint32_t tempreg;
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = 1; //GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
|
||||
#if DISABLED(STM32F1xx)
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
|
||||
#endif
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_12; // D0 & SCK
|
||||
#if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // define D1-D3 only if have a four bit wide SDIO bus
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11; // D1-D3
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
#endif
|
||||
|
||||
#if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // define D1-D3 only if have a four bit wide SDIO bus
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11; // D1-D3
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
#endif
|
||||
// Configure PD.02 CMD line
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
// Configure PD.02 CMD line
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
// Setup DMA
|
||||
#if defined(STM32F1xx)
|
||||
hdma_sdio.Init.Mode = DMA_NORMAL;
|
||||
hdma_sdio.Instance = DMA2_Channel4;
|
||||
HAL_NVIC_EnableIRQ(DMA2_Channel4_5_IRQn);
|
||||
#elif defined(STM32F4xx)
|
||||
hdma_sdio.Init.Mode = DMA_PFCTRL;
|
||||
hdma_sdio.Instance = DMA2_Stream3;
|
||||
hdma_sdio.Init.Channel = DMA_CHANNEL_4;
|
||||
hdma_sdio.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
|
||||
hdma_sdio.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
|
||||
hdma_sdio.Init.MemBurst = DMA_MBURST_INC4;
|
||||
hdma_sdio.Init.PeriphBurst = DMA_PBURST_INC4;
|
||||
HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
|
||||
#endif
|
||||
HAL_NVIC_EnableIRQ(SDIO_IRQn);
|
||||
hdma_sdio.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_sdio.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
|
||||
hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
|
||||
hdma_sdio.Init.Priority = DMA_PRIORITY_LOW;
|
||||
__HAL_LINKDMA(&hsd, hdmarx, hdma_sdio);
|
||||
__HAL_LINKDMA(&hsd, hdmatx, hdma_sdio);
|
||||
|
||||
// Setup DMA
|
||||
#if defined(STM32F1xx)
|
||||
hdma_sdio.Init.Mode = DMA_NORMAL;
|
||||
hdma_sdio.Instance = DMA2_Channel4;
|
||||
HAL_NVIC_EnableIRQ(DMA2_Channel4_5_IRQn);
|
||||
#elif defined(STM32F4xx)
|
||||
hdma_sdio.Init.Mode = DMA_PFCTRL;
|
||||
hdma_sdio.Instance = DMA2_Stream3;
|
||||
hdma_sdio.Init.Channel = DMA_CHANNEL_4;
|
||||
hdma_sdio.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
|
||||
hdma_sdio.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
|
||||
hdma_sdio.Init.MemBurst = DMA_MBURST_INC4;
|
||||
hdma_sdio.Init.PeriphBurst = DMA_PBURST_INC4;
|
||||
HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
|
||||
#endif
|
||||
HAL_NVIC_EnableIRQ(SDIO_IRQn);
|
||||
hdma_sdio.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_sdio.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
|
||||
hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
|
||||
hdma_sdio.Init.Priority = DMA_PRIORITY_LOW;
|
||||
__HAL_LINKDMA(&hsd, hdmarx, hdma_sdio);
|
||||
__HAL_LINKDMA(&hsd, hdmatx, hdma_sdio);
|
||||
#if defined(STM32F1xx)
|
||||
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
#else
|
||||
__HAL_RCC_SDIO_FORCE_RESET();
|
||||
delay(2);
|
||||
__HAL_RCC_SDIO_RELEASE_RESET();
|
||||
delay(2);
|
||||
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||
|
||||
#if defined(STM32F1xx)
|
||||
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
#else
|
||||
__HAL_RCC_SDIO_FORCE_RESET();
|
||||
delay(2);
|
||||
__HAL_RCC_SDIO_RELEASE_RESET();
|
||||
delay(2);
|
||||
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||
__HAL_RCC_DMA2_FORCE_RESET();
|
||||
delay(2);
|
||||
__HAL_RCC_DMA2_RELEASE_RESET();
|
||||
delay(2);
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
#endif
|
||||
|
||||
__HAL_RCC_DMA2_FORCE_RESET();
|
||||
delay(2);
|
||||
__HAL_RCC_DMA2_RELEASE_RESET();
|
||||
delay(2);
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
#endif
|
||||
//Initialize the SDIO (with initial <400Khz Clock)
|
||||
tempreg = 0; //Reset value
|
||||
tempreg |= SDIO_CLKCR_CLKEN; // Clock enabled
|
||||
tempreg |= SDIO_INIT_CLK_DIV; // Clock Divider. Clock = 48000 / (118 + 2) = 400Khz
|
||||
// Keep the rest at 0 => HW_Flow Disabled, Rising Clock Edge, Disable CLK ByPass, Bus Width = 0, Power save Disable
|
||||
SDIO->CLKCR = tempreg;
|
||||
|
||||
//Initialize the SDIO (with initial <400Khz Clock)
|
||||
tempreg = 0; //Reset value
|
||||
tempreg |= SDIO_CLKCR_CLKEN; // Clock enabled
|
||||
tempreg |= SDIO_INIT_CLK_DIV; // Clock Divider. Clock = 48000 / (118 + 2) = 400Khz
|
||||
// Keep the rest at 0 => HW_Flow Disabled, Rising Clock Edge, Disable CLK ByPass, Bus Width = 0, Power save Disable
|
||||
SDIO->CLKCR = tempreg;
|
||||
// Power up the SDIO
|
||||
SDIO_PowerState_ON(SDIO);
|
||||
hsd.Instance = SDIO;
|
||||
}
|
||||
|
||||
// Power up the SDIO
|
||||
SDIO_PowerState_ON(SDIO);
|
||||
hsd.Instance = SDIO;
|
||||
void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init
|
||||
UNUSED(hsd); // Prevent unused argument(s) compilation warning
|
||||
__HAL_RCC_SDIO_CLK_ENABLE(); // turn on SDIO clock
|
||||
}
|
||||
|
||||
bool SDIO_Init() {
|
||||
uint8_t retryCnt = SDIO_READ_RETRIES;
|
||||
|
||||
bool status;
|
||||
hsd.Instance = SDIO;
|
||||
hsd.State = HAL_SD_STATE_RESET;
|
||||
|
||||
SD_LowLevel_Init();
|
||||
|
||||
uint8_t retry_Cnt = retryCnt;
|
||||
for (;;) {
|
||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
||||
status = (bool) HAL_SD_Init(&hsd);
|
||||
if (!status) break;
|
||||
if (!--retry_Cnt) return false; // return failing status if retries are exhausted
|
||||
}
|
||||
|
||||
void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init
|
||||
UNUSED(hsd); // Prevent unused argument(s) compilation warning
|
||||
__HAL_RCC_SDIO_CLK_ENABLE(); // turn on SDIO clock
|
||||
}
|
||||
go_to_transfer_speed();
|
||||
|
||||
bool SDIO_Init() {
|
||||
uint8_t retryCnt = SDIO_READ_RETRIES;
|
||||
|
||||
bool status;
|
||||
hsd.Instance = SDIO;
|
||||
hsd.State = HAL_SD_STATE_RESET;
|
||||
|
||||
SD_LowLevel_Init();
|
||||
|
||||
uint8_t retry_Cnt = retryCnt;
|
||||
#if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // go to 4 bit wide mode if pins are defined
|
||||
retry_Cnt = retryCnt;
|
||||
for (;;) {
|
||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
||||
status = (bool) HAL_SD_Init(&hsd);
|
||||
if (!status) break;
|
||||
if (!--retry_Cnt) return false; // return failing status if retries are exhausted
|
||||
if (!HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B)) break; // some cards are only 1 bit wide so a pass here is not required
|
||||
if (!--retry_Cnt) break;
|
||||
}
|
||||
|
||||
go_to_transfer_speed();
|
||||
|
||||
#if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // go to 4 bit wide mode if pins are defined
|
||||
if (!retry_Cnt) { // wide bus failed, go back to one bit wide mode
|
||||
hsd.State = (HAL_SD_StateTypeDef) 0; // HAL_SD_STATE_RESET
|
||||
SD_LowLevel_Init();
|
||||
retry_Cnt = retryCnt;
|
||||
for (;;) {
|
||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
||||
if (!HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B)) break; // some cards are only 1 bit wide so a pass here is not required
|
||||
if (!--retry_Cnt) break;
|
||||
status = (bool) HAL_SD_Init(&hsd);
|
||||
if (!status) break;
|
||||
if (!--retry_Cnt) return false; // return failing status if retries are exhausted
|
||||
}
|
||||
if (!retry_Cnt) { // wide bus failed, go back to one bit wide mode
|
||||
hsd.State = (HAL_SD_StateTypeDef) 0; // HAL_SD_STATE_RESET
|
||||
SD_LowLevel_Init();
|
||||
retry_Cnt = retryCnt;
|
||||
for (;;) {
|
||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
||||
status = (bool) HAL_SD_Init(&hsd);
|
||||
if (!status) break;
|
||||
if (!--retry_Cnt) return false; // return failing status if retries are exhausted
|
||||
}
|
||||
go_to_transfer_speed();
|
||||
}
|
||||
#endif
|
||||
go_to_transfer_speed();
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) {
|
||||
if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false;
|
||||
|
||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
||||
|
||||
HAL_StatusTypeDef ret;
|
||||
if (src) {
|
||||
hdma_sdio.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||
HAL_DMA_Init(&hdma_sdio);
|
||||
ret = HAL_SD_WriteBlocks_DMA(&hsd, (uint8_t *)src, block, 1);
|
||||
}
|
||||
else {
|
||||
hdma_sdio.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
HAL_DMA_Init(&hdma_sdio);
|
||||
ret = HAL_SD_ReadBlocks_DMA(&hsd, (uint8_t *)dst, block, 1);
|
||||
}
|
||||
|
||||
static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) {
|
||||
if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false;
|
||||
if (ret != HAL_OK) {
|
||||
HAL_DMA_Abort_IT(&hdma_sdio);
|
||||
HAL_DMA_DeInit(&hdma_sdio);
|
||||
return false;
|
||||
}
|
||||
|
||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
||||
|
||||
HAL_StatusTypeDef ret;
|
||||
if (src) {
|
||||
hdma_sdio.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||
HAL_DMA_Init(&hdma_sdio);
|
||||
ret = HAL_SD_WriteBlocks_DMA(&hsd, (uint8_t *)src, block, 1);
|
||||
}
|
||||
else {
|
||||
hdma_sdio.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
HAL_DMA_Init(&hdma_sdio);
|
||||
ret = HAL_SD_ReadBlocks_DMA(&hsd, (uint8_t *)dst, block, 1);
|
||||
}
|
||||
|
||||
if (ret != HAL_OK) {
|
||||
millis_t timeout = millis() + 500;
|
||||
// Wait the transfer
|
||||
while (hsd.State != HAL_SD_STATE_READY) {
|
||||
if (ELAPSED(millis(), timeout)) {
|
||||
HAL_DMA_Abort_IT(&hdma_sdio);
|
||||
HAL_DMA_DeInit(&hdma_sdio);
|
||||
return false;
|
||||
}
|
||||
|
||||
millis_t timeout = millis() + 500;
|
||||
// Wait the transfer
|
||||
while (hsd.State != HAL_SD_STATE_READY) {
|
||||
if (ELAPSED(millis(), timeout)) {
|
||||
HAL_DMA_Abort_IT(&hdma_sdio);
|
||||
HAL_DMA_DeInit(&hdma_sdio);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
while (__HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TC_FLAG_INDEX(&hdma_sdio)) != 0
|
||||
|| __HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TE_FLAG_INDEX(&hdma_sdio)) != 0) { /* nada */ }
|
||||
|
||||
HAL_DMA_Abort_IT(&hdma_sdio);
|
||||
HAL_DMA_DeInit(&hdma_sdio);
|
||||
|
||||
timeout = millis() + 500;
|
||||
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) if (ELAPSED(millis(), timeout)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
||||
uint8_t retries = SDIO_READ_RETRIES;
|
||||
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, NULL, dst)) return true;
|
||||
return false;
|
||||
}
|
||||
while (__HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TC_FLAG_INDEX(&hdma_sdio)) != 0
|
||||
|| __HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TE_FLAG_INDEX(&hdma_sdio)) != 0) { /* nada */ }
|
||||
|
||||
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
||||
uint8_t retries = SDIO_READ_RETRIES;
|
||||
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, NULL)) return true;
|
||||
return false;
|
||||
}
|
||||
HAL_DMA_Abort_IT(&hdma_sdio);
|
||||
HAL_DMA_DeInit(&hdma_sdio);
|
||||
|
||||
#if defined(STM32F1xx)
|
||||
#define DMA_IRQ_HANDLER DMA2_Channel4_5_IRQHandler
|
||||
#elif defined(STM32F4xx)
|
||||
#define DMA_IRQ_HANDLER DMA2_Stream3_IRQHandler
|
||||
#else
|
||||
#error "Unknown STM32 architecture."
|
||||
#endif
|
||||
timeout = millis() + 500;
|
||||
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) if (ELAPSED(millis(), timeout)) return false;
|
||||
|
||||
extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
|
||||
extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); }
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
||||
uint8_t retries = SDIO_READ_RETRIES;
|
||||
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, NULL, dst)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
||||
uint8_t retries = SDIO_READ_RETRIES;
|
||||
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, NULL)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SDIO_IsReady() {
|
||||
return hsd.State == HAL_SD_STATE_READY;
|
||||
}
|
||||
|
||||
uint32_t SDIO_GetCardSize() {
|
||||
return (uint32_t)(hsd.SdCard.BlockNbr) * (hsd.SdCard.BlockSize);
|
||||
}
|
||||
|
||||
#if defined(STM32F1xx)
|
||||
#define DMA_IRQ_HANDLER DMA2_Channel4_5_IRQHandler
|
||||
#elif defined(STM32F4xx)
|
||||
#define DMA_IRQ_HANDLER DMA2_Stream3_IRQHandler
|
||||
#else
|
||||
#error "Unknown STM32 architecture."
|
||||
#endif
|
||||
|
||||
extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
|
||||
extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); }
|
||||
|
||||
#endif // !USBD_USE_CDC_COMPOSITE
|
||||
#endif // SDIO_SUPPORT
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -107,4 +107,4 @@ void libServo::setInterruptPriority(uint32_t preemptPriority, uint32_t subPriori
|
||||
}
|
||||
|
||||
#endif // HAS_SERVOS
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -270,4 +270,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
|
||||
}
|
||||
|
||||
#endif // FLASH_EEPROM_EMULATION
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
/**
|
||||
* Implementation of EEPROM settings in SD Card
|
||||
@@ -88,4 +88,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uin
|
||||
}
|
||||
|
||||
#endif // SDCARD_EEPROM_EMULATION
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -65,4 +65,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
|
||||
}
|
||||
|
||||
#endif // SRAM_EEPROM_EMULATION
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -75,4 +75,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
|
||||
}
|
||||
|
||||
#endif // USE_WIRED_EEPROM
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -56,4 +56,4 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255
|
||||
}
|
||||
|
||||
#endif // NEEDS_HARDWARE_PWM
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -31,4 +31,4 @@ void FastIO_init() {
|
||||
FastIOPortMap[STM_PORT(digitalPin[i])] = get_GPIO_Port(STM_PORT(digitalPin[i]));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -13,21 +13,24 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && HAS_SD_HOST_DRIVE
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
|
||||
#include "msc_sd.h"
|
||||
#include "../shared/Marduino.h"
|
||||
#include "msc_sd.h"
|
||||
#include "usbd_core.h"
|
||||
|
||||
#include "../../sd/cardreader.h"
|
||||
|
||||
#include <USB.h>
|
||||
#include <USBMscHandler.h>
|
||||
|
||||
#define BLOCK_SIZE 512
|
||||
#define PRODUCT_ID 0x29
|
||||
|
||||
#include "../../sd/cardreader.h"
|
||||
|
||||
class Sd2CardUSBMscHandler : public USBMscHandler {
|
||||
public:
|
||||
DiskIODriver* diskIODriver() {
|
||||
@@ -121,4 +124,5 @@ void MSC_SD_init() {
|
||||
USBDevice.begin();
|
||||
}
|
||||
|
||||
#endif // __STM32F1__ && HAS_SD_HOST_DRIVE
|
||||
#endif // HAS_SD_HOST_DRIVE
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -199,4 +199,4 @@ bool GT911::getPoint(int16_t *x, int16_t *y) {
|
||||
}
|
||||
|
||||
#endif // TFT_TOUCH_DEVICE_GT911
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -178,4 +178,4 @@ void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
|
||||
}
|
||||
|
||||
#endif // HAS_FSMC_TFT
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -384,4 +384,4 @@ void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
|
||||
}
|
||||
|
||||
#endif // HAS_LTDC_TFT
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -240,4 +240,4 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun
|
||||
}
|
||||
|
||||
#endif // HAS_SPI_TFT
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -167,4 +167,4 @@ uint16_t XPT2046::SoftwareIO(uint16_t data) {
|
||||
}
|
||||
|
||||
#endif // HAS_TFT_XPT2046
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -319,4 +319,4 @@ static constexpr bool verify_no_timer_conflicts() {
|
||||
// when hovering over it, making it easy to identify the conflicting timers.
|
||||
static_assert(verify_no_timer_conflicts(), "One or more timer conflict detected. Examine \"timers_in_use\" to help identify conflict.");
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -114,4 +114,4 @@ uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t b
|
||||
}
|
||||
|
||||
#endif // USE_OTG_USB_HOST && USBHOST
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -51,4 +51,4 @@ void USB_Hook_init() {
|
||||
}
|
||||
|
||||
#endif // EMERGENCY_PARSER && USBD_USE_CDC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -46,4 +46,4 @@ void HAL_watchdog_refresh() {
|
||||
}
|
||||
|
||||
#endif // USE_WATCHDOG
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
#ifndef LCD_SPI_SPEED
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#error "SERIAL_STATS_DROPPED_RX is not supported on the STM32F1 platform."
|
||||
#endif
|
||||
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
#if ENABLED(NEOPIXEL_LED) && DISABLED(MKS_MINI_12864_V3)
|
||||
#error "NEOPIXEL_LED (Adafruit NeoPixel) is not supported for HAL/STM32F1. Comment out this line to proceed at your own risk!"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if defined(__STM32F1__) && HAS_SD_HOST_DRIVE
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
|
||||
#include "msc_sd.h"
|
||||
#include "SPI.h"
|
||||
@@ -92,4 +94,5 @@ void MSC_SD_init() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // __STM32F1__ && HAS_SD_HOST_DRIVE
|
||||
#endif // HAS_SD_HOST_DRIVE
|
||||
#endif // __STM32F1__
|
||||
|
||||
@@ -184,6 +184,10 @@ bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) {
|
||||
|
||||
inline uint32_t SDIO_GetCardState() { return SDIO_CmdSendStatus(SdCard.RelCardAdd << 16U) ? (SDIO_GetResponse(SDIO_RESP1) >> 9U) & 0x0FU : SDIO_CARD_ERROR; }
|
||||
|
||||
// No F1 board with SDIO + MSC using Maple, that I aware of...
|
||||
bool SDIO_IsReady() { return true; }
|
||||
uint32_t SDIO_GetCardSize() { return 0; }
|
||||
|
||||
// ------------------------
|
||||
// SD Commands and Responses
|
||||
// ------------------------
|
||||
|
||||
@@ -97,43 +97,65 @@ void calibrate_delay_loop();
|
||||
#define DELAY_US(x) DelayCycleFnc((x) * ((F_CPU) / 1000000UL))
|
||||
|
||||
#elif defined(__AVR__)
|
||||
|
||||
#define nop() __asm__ __volatile__("nop;\n\t":::)
|
||||
|
||||
FORCE_INLINE static void __delay_4cycles(uint8_t cy) {
|
||||
__asm__ __volatile__(
|
||||
L("1")
|
||||
A("dec %[cnt]")
|
||||
A("nop")
|
||||
A("brne 1b")
|
||||
: [cnt] "+r"(cy) // output: +r means input+output
|
||||
: // input:
|
||||
: "cc" // clobbers:
|
||||
);
|
||||
FORCE_INLINE static void __delay_up_to_3c(uint8_t cycles) {
|
||||
switch (cycles) {
|
||||
case 3:
|
||||
__asm__ __volatile__(A("RJMP .+0") A("NOP"));
|
||||
break;
|
||||
case 2:
|
||||
__asm__ __volatile__(A("RJMP .+0"));
|
||||
break;
|
||||
case 1:
|
||||
__asm__ __volatile__(A("NOP"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Delay in cycles
|
||||
FORCE_INLINE static void DELAY_CYCLES(uint16_t x) {
|
||||
|
||||
if (__builtin_constant_p(x)) {
|
||||
#define MAXNOPS 4
|
||||
|
||||
if (x <= (MAXNOPS)) {
|
||||
switch (x) { case 4: nop(); case 3: nop(); case 2: nop(); case 1: nop(); }
|
||||
FORCE_INLINE static void DELAY_CYCLES(uint16_t cycles) {
|
||||
if (__builtin_constant_p(cycles)) {
|
||||
if (cycles <= 3) {
|
||||
__delay_up_to_3c(cycles);
|
||||
}
|
||||
else if (cycles == 4) {
|
||||
__delay_up_to_3c(2);
|
||||
__delay_up_to_3c(2);
|
||||
}
|
||||
else {
|
||||
const uint32_t rem = (x) % (MAXNOPS);
|
||||
switch (rem) { case 3: nop(); case 2: nop(); case 1: nop(); }
|
||||
if ((x = (x) / (MAXNOPS)))
|
||||
__delay_4cycles(x); // if need more then 4 nop loop is more optimal
|
||||
}
|
||||
cycles -= 1 + 4; // Compensate for the first LDI (1) and the first round (4)
|
||||
__delay_up_to_3c(cycles % 4);
|
||||
|
||||
#undef MAXNOPS
|
||||
cycles /= 4;
|
||||
// The following code burns [1 + 4 * (rounds+1)] cycles
|
||||
uint16_t dummy;
|
||||
__asm__ __volatile__(
|
||||
// "manually" load counter from constants, otherwise the compiler may optimize this part away
|
||||
A("LDI %A[rounds], %[l]") // 1c
|
||||
A("LDI %B[rounds], %[h]") // 1c (compensating the non branching BRCC)
|
||||
L("1")
|
||||
A("SBIW %[rounds], 1") // 2c
|
||||
A("BRCC 1b") // 2c when branching, else 1c (end of loop)
|
||||
: // Outputs ...
|
||||
[rounds] "=w" (dummy) // Restrict to a wo (=) 16 bit register pair (w)
|
||||
: // Inputs ...
|
||||
[l] "M" (cycles%256), // Restrict to 0..255 constant (M)
|
||||
[h] "M" (cycles/256) // Restrict to 0..255 constant (M)
|
||||
:// Clobbers ...
|
||||
"cc" // Indicate we are modifying flags like Carry (cc)
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
__asm__ __volatile__(
|
||||
L("1")
|
||||
A("SBIW %[cycles], 4") // 2c
|
||||
A("BRCC 1b") // 2c when branching, else 1c (end of loop)
|
||||
: [cycles] "+w" (cycles) // output: Restrict to a rw (+) 16 bit register pair (w)
|
||||
: // input: -
|
||||
: "cc" // clobbers: We are modifying flags like Carry (cc)
|
||||
);
|
||||
}
|
||||
else if ((x >>= 2))
|
||||
__delay_4cycles(x);
|
||||
}
|
||||
#undef nop
|
||||
|
||||
// Delay in microseconds
|
||||
#define DELAY_US(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL))
|
||||
|
||||
+99
-56
@@ -70,7 +70,7 @@
|
||||
#if HAS_TFT_LVGL_UI
|
||||
#include "lcd/extui/mks_ui/tft_lvgl_configuration.h"
|
||||
#include "lcd/extui/mks_ui/draw_ui.h"
|
||||
#include "lcd/extui/mks_ui/mks_hardware_test.h"
|
||||
#include "lcd/extui/mks_ui/mks_hardware.h"
|
||||
#include <lvgl.h>
|
||||
#endif
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
#include "module/servo.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#if HAS_MOTOR_CURRENT_DAC
|
||||
#include "feature/dac/stepper_dac.h"
|
||||
#endif
|
||||
|
||||
@@ -236,6 +236,10 @@
|
||||
#include "feature/stepper_driver_safety.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
#include "feature/power.h"
|
||||
#endif
|
||||
|
||||
PGMSTR(M112_KILL_STR, "M112 Shutdown");
|
||||
|
||||
MarlinState marlin_state = MF_INITIALIZING;
|
||||
@@ -510,7 +514,6 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
constexpr millis_t HOME_DEBOUNCE_DELAY = 1000UL;
|
||||
static millis_t next_home_key_ms; // = 0
|
||||
if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, next_home_key_ms)) {
|
||||
next_home_key_ms = ms + HOME_DEBOUNCE_DELAY;
|
||||
LCD_MESSAGEPGM(MSG_AUTO_HOME);
|
||||
@@ -522,95 +525,147 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
#if ENABLED(CUSTOM_USER_BUTTONS)
|
||||
// Handle a custom user button if defined
|
||||
const bool printer_not_busy = !printingIsActive();
|
||||
#define HAS_CUSTOM_USER_BUTTON(N) (PIN_EXISTS(BUTTON##N) && defined(BUTTON##N##_HIT_STATE) && defined(BUTTON##N##_GCODE) && defined(BUTTON##N##_DESC))
|
||||
#define CHECK_CUSTOM_USER_BUTTON(N) do{ \
|
||||
#define HAS_CUSTOM_USER_BUTTON(N) (PIN_EXISTS(BUTTON##N) && defined(BUTTON##N##_HIT_STATE) && defined(BUTTON##N##_GCODE))
|
||||
#define HAS_BETTER_USER_BUTTON(N) HAS_CUSTOM_USER_BUTTON(N) && defined(BUTTON##N##_DESC)
|
||||
#define _CHECK_CUSTOM_USER_BUTTON(N, CODE) do{ \
|
||||
constexpr millis_t CUB_DEBOUNCE_DELAY_##N = 250UL; \
|
||||
static millis_t next_cub_ms_##N; \
|
||||
if (BUTTON##N##_HIT_STATE == READ(BUTTON##N##_PIN) \
|
||||
&& (ENABLED(BUTTON##N##_WHEN_PRINTING) || printer_not_busy)) { \
|
||||
const millis_t ms = millis(); \
|
||||
if (ELAPSED(ms, next_cub_ms_##N)) { \
|
||||
next_cub_ms_##N = ms + CUB_DEBOUNCE_DELAY_##N; \
|
||||
if (strlen(BUTTON##N##_DESC)) \
|
||||
LCD_MESSAGEPGM_P(PSTR(BUTTON##N##_DESC)); \
|
||||
CODE; \
|
||||
queue.inject_P(PSTR(BUTTON##N##_GCODE)); \
|
||||
} \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#if HAS_CUSTOM_USER_BUTTON(1)
|
||||
#define CHECK_CUSTOM_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, NOOP)
|
||||
#define CHECK_BETTER_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, if (strlen(BUTTON##N##_DESC)) LCD_MESSAGEPGM_P(PSTR(BUTTON##N##_DESC)))
|
||||
|
||||
#if HAS_BETTER_USER_BUTTON(1)
|
||||
CHECK_BETTER_USER_BUTTON(1);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(1)
|
||||
CHECK_CUSTOM_USER_BUTTON(1);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(2)
|
||||
#if HAS_BETTER_USER_BUTTON(2)
|
||||
CHECK_BETTER_USER_BUTTON(2);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(2)
|
||||
CHECK_CUSTOM_USER_BUTTON(2);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(3)
|
||||
#if HAS_BETTER_USER_BUTTON(3)
|
||||
CHECK_BETTER_USER_BUTTON(3);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(3)
|
||||
CHECK_CUSTOM_USER_BUTTON(3);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(4)
|
||||
#if HAS_BETTER_USER_BUTTON(4)
|
||||
CHECK_BETTER_USER_BUTTON(4);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(4)
|
||||
CHECK_CUSTOM_USER_BUTTON(4);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(5)
|
||||
#if HAS_BETTER_USER_BUTTON(5)
|
||||
CHECK_BETTER_USER_BUTTON(5);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(5)
|
||||
CHECK_CUSTOM_USER_BUTTON(5);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(6)
|
||||
#if HAS_BETTER_USER_BUTTON(6)
|
||||
CHECK_BETTER_USER_BUTTON(6);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(6)
|
||||
CHECK_CUSTOM_USER_BUTTON(6);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(7)
|
||||
#if HAS_BETTER_USER_BUTTON(7)
|
||||
CHECK_BETTER_USER_BUTTON(7);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(7)
|
||||
CHECK_CUSTOM_USER_BUTTON(7);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(8)
|
||||
#if HAS_BETTER_USER_BUTTON(8)
|
||||
CHECK_BETTER_USER_BUTTON(8);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(8)
|
||||
CHECK_CUSTOM_USER_BUTTON(8);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(9)
|
||||
#if HAS_BETTER_USER_BUTTON(9)
|
||||
CHECK_BETTER_USER_BUTTON(9);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(9)
|
||||
CHECK_CUSTOM_USER_BUTTON(9);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(10)
|
||||
#if HAS_BETTER_USER_BUTTON(10)
|
||||
CHECK_BETTER_USER_BUTTON(10);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(10)
|
||||
CHECK_CUSTOM_USER_BUTTON(10);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(11)
|
||||
#if HAS_BETTER_USER_BUTTON(11)
|
||||
CHECK_BETTER_USER_BUTTON(11);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(11)
|
||||
CHECK_CUSTOM_USER_BUTTON(11);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(12)
|
||||
#if HAS_BETTER_USER_BUTTON(12)
|
||||
CHECK_BETTER_USER_BUTTON(12);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(12)
|
||||
CHECK_CUSTOM_USER_BUTTON(12);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(13)
|
||||
#if HAS_BETTER_USER_BUTTON(13)
|
||||
CHECK_BETTER_USER_BUTTON(13);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(13)
|
||||
CHECK_CUSTOM_USER_BUTTON(13);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(14)
|
||||
#if HAS_BETTER_USER_BUTTON(14)
|
||||
CHECK_BETTER_USER_BUTTON(14);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(14)
|
||||
CHECK_CUSTOM_USER_BUTTON(14);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(15)
|
||||
#if HAS_BETTER_USER_BUTTON(15)
|
||||
CHECK_BETTER_USER_BUTTON(15);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(15)
|
||||
CHECK_CUSTOM_USER_BUTTON(15);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(16)
|
||||
#if HAS_BETTER_USER_BUTTON(16)
|
||||
CHECK_BETTER_USER_BUTTON(16);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(16)
|
||||
CHECK_CUSTOM_USER_BUTTON(16);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(17)
|
||||
#if HAS_BETTER_USER_BUTTON(17)
|
||||
CHECK_BETTER_USER_BUTTON(17);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(17)
|
||||
CHECK_CUSTOM_USER_BUTTON(17);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(18)
|
||||
#if HAS_BETTER_USER_BUTTON(18)
|
||||
CHECK_BETTER_USER_BUTTON(18);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(18)
|
||||
CHECK_CUSTOM_USER_BUTTON(18);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(19)
|
||||
#if HAS_BETTER_USER_BUTTON(19)
|
||||
CHECK_BETTER_USER_BUTTON(19);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(19)
|
||||
CHECK_CUSTOM_USER_BUTTON(19);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(20)
|
||||
#if HAS_BETTER_USER_BUTTON(20)
|
||||
CHECK_BETTER_USER_BUTTON(20);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(20)
|
||||
CHECK_CUSTOM_USER_BUTTON(20);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(21)
|
||||
#if HAS_BETTER_USER_BUTTON(21)
|
||||
CHECK_BETTER_USER_BUTTON(21);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(21)
|
||||
CHECK_CUSTOM_USER_BUTTON(21);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(22)
|
||||
#if HAS_BETTER_USER_BUTTON(22)
|
||||
CHECK_BETTER_USER_BUTTON(22);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(22)
|
||||
CHECK_CUSTOM_USER_BUTTON(22);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(23)
|
||||
#if HAS_BETTER_USER_BUTTON(23)
|
||||
CHECK_BETTER_USER_BUTTON(23);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(23)
|
||||
CHECK_CUSTOM_USER_BUTTON(23);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(24)
|
||||
#if HAS_BETTER_USER_BUTTON(24)
|
||||
CHECK_BETTER_USER_BUTTON(24);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(24)
|
||||
CHECK_CUSTOM_USER_BUTTON(24);
|
||||
#endif
|
||||
#if HAS_CUSTOM_USER_BUTTON(25)
|
||||
#if HAS_BETTER_USER_BUTTON(25)
|
||||
CHECK_BETTER_USER_BUTTON(25);
|
||||
#elif HAS_CUSTOM_USER_BUTTON(25)
|
||||
CHECK_CUSTOM_USER_BUTTON(25);
|
||||
#endif
|
||||
#endif
|
||||
@@ -771,10 +826,8 @@ void idle(bool no_stepper_sleep/*=false*/) {
|
||||
|
||||
// Run StallGuard endstop checks
|
||||
#if ENABLED(SPI_ENDSTOPS)
|
||||
if (endstops.tmc_spi_homing.any
|
||||
&& TERN1(IMPROVE_HOMING_RELIABILITY, ELAPSED(millis(), sg_guard_period))
|
||||
) LOOP_L_N(i, 4) // Read SGT 4 times per idle loop
|
||||
if (endstops.tmc_spi_homing_check()) break;
|
||||
if (endstops.tmc_spi_homing.any && TERN1(IMPROVE_HOMING_RELIABILITY, ELAPSED(millis(), sg_guard_period)))
|
||||
LOOP_L_N(i, 4) if (endstops.tmc_spi_homing_check()) break; // Read SGT 4 times per idle loop
|
||||
#endif
|
||||
|
||||
// Handle SD Card insert / remove
|
||||
@@ -883,18 +936,18 @@ void minkill(const bool steppers_off/*=false*/) {
|
||||
// Power off all steppers (for M112) or just the E steppers
|
||||
steppers_off ? disable_all_steppers() : disable_e_steppers();
|
||||
|
||||
TERN_(PSU_CONTROL, PSU_OFF());
|
||||
TERN_(PSU_CONTROL, powerManager.power_off());
|
||||
|
||||
TERN_(HAS_SUICIDE, suicide());
|
||||
|
||||
#if EITHER(HAS_KILL, SOFT_RESET_ON_KILL)
|
||||
|
||||
// Wait for both KILL and ENC to be released
|
||||
while (TERN0(HAS_KILL, !kill_state()) || TERN0(SOFT_RESET_ON_KILL, !ui.button_pressed()))
|
||||
while (TERN0(HAS_KILL, kill_state()) || TERN0(SOFT_RESET_ON_KILL, ui.button_pressed()))
|
||||
watchdog_refresh();
|
||||
|
||||
// Wait for either KILL or ENC press
|
||||
while (TERN1(HAS_KILL, kill_state()) && TERN1(SOFT_RESET_ON_KILL, ui.button_pressed()))
|
||||
// Wait for either KILL or ENC to be pressed again
|
||||
while (TERN1(HAS_KILL, !kill_state()) && TERN1(SOFT_RESET_ON_KILL, !ui.button_pressed()))
|
||||
watchdog_refresh();
|
||||
|
||||
// Reboot the board
|
||||
@@ -1156,22 +1209,15 @@ void setup() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE)
|
||||
mks_esp_wifi_init();
|
||||
WIFISERIAL.begin(WIFI_BAUDRATE);
|
||||
serial_connect_timeout = millis() + 1000UL;
|
||||
while (/*!WIFISERIAL && */PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
|
||||
#endif
|
||||
|
||||
TERN_(DYNAMIC_VECTORTABLE, hook_cpu_exceptions()); // If supported, install Marlin exception handlers at runtime
|
||||
|
||||
SETUP_RUN(HAL_init());
|
||||
|
||||
// Init and disable SPI thermocouples; this is still needed
|
||||
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0)
|
||||
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E0))
|
||||
OUT_WRITE(TEMP_0_CS_PIN, HIGH); // Disable
|
||||
#endif
|
||||
#if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
|
||||
#if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1))
|
||||
OUT_WRITE(TEMP_1_CS_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
@@ -1189,8 +1235,7 @@ void setup() {
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
SETUP_LOG("PSU_CONTROL");
|
||||
powersupply_on = ENABLED(PSU_DEFAULT_OFF);
|
||||
if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON();
|
||||
powerManager.init();
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
@@ -1228,9 +1273,7 @@ void setup() {
|
||||
if (mcu & RST_SOFTWARE) SERIAL_ECHOLNPGM(STR_SOFTWARE_RESET);
|
||||
HAL_clear_reset_source();
|
||||
|
||||
SERIAL_ECHOPGM_P(GET_TEXT(MSG_MARLIN));
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOLNPGM(SHORT_BUILD_VERSION);
|
||||
SERIAL_ECHOLNPGM("Marlin " SHORT_BUILD_VERSION);
|
||||
SERIAL_EOL();
|
||||
#if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR)
|
||||
SERIAL_ECHO_MSG(
|
||||
@@ -1355,7 +1398,7 @@ void setup() {
|
||||
SETUP_RUN(digipot_i2c.init());
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#if HAS_MOTOR_CURRENT_DAC
|
||||
SETUP_RUN(stepper_dac.init());
|
||||
#endif
|
||||
|
||||
|
||||
@@ -81,25 +81,6 @@ extern bool wait_for_heatup;
|
||||
void wait_for_user_response(millis_t ms=0, const bool no_sleep=false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
extern bool powersupply_on;
|
||||
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_STATE); powersupply_on = true; }while(0)
|
||||
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_STATE); powersupply_on = false; }while(0)
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#define PSU_ON() powerManager.power_on()
|
||||
#define PSU_OFF() powerManager.power_off()
|
||||
#define PSU_OFF_SOON() powerManager.power_off_soon()
|
||||
#else
|
||||
#define PSU_ON() PSU_PIN_ON()
|
||||
#if ENABLED(PS_OFF_SOUND)
|
||||
#define PSU_OFF() do{ BUZZ(1000, 659); PSU_PIN_OFF(); }while(0)
|
||||
#else
|
||||
#define PSU_OFF() PSU_PIN_OFF()
|
||||
#endif
|
||||
#define PSU_OFF_SOON PSU_OFF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool pin_is_protected(const pin_t pin);
|
||||
|
||||
#if HAS_SUICIDE
|
||||
|
||||
+15
-14
@@ -249,7 +249,7 @@
|
||||
#define BOARD_BTT_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_MKS_SGEN_L_V2 2509 // MKS SGEN_L V2 (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_BTT_SKR_E3_TURBO 2510 // BigTreeTech SKR E3 Turbo (Power outputs: Hotend0, Hotend1, Bed, Fan0, Fan1)
|
||||
#define BOARD_FLY_CDY 2511 // FLY_CDY (Power outputs: Hotend0, Hotend1, Hotend2, Bed, Fan0, Fan1, Fan2)
|
||||
#define BOARD_FLY_CDY 2511 // FLYmaker FLY CDY (Power outputs: Hotend0, Hotend1, Hotend2, Bed, Fan0, Fan1, Fan2)
|
||||
|
||||
//
|
||||
// SAM3X8E ARM Cortex M3
|
||||
@@ -333,18 +333,19 @@
|
||||
#define BOARD_CCROBOT_MEEB_3DP 4035 // ccrobot-online.com MEEB_3DP (STM32F103RC)
|
||||
#define BOARD_CHITU3D_V5 4036 // Chitu3D TronXY X5SA V5 Board
|
||||
#define BOARD_CHITU3D_V6 4037 // Chitu3D TronXY X5SA V6 Board
|
||||
#define BOARD_CREALITY_V4 4038 // Creality v4.x (STM32F103RE)
|
||||
#define BOARD_CREALITY_V427 4039 // Creality v4.2.7 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V4210 4040 // Creality v4.2.10 (STM32F103RE) as found in the CR-30
|
||||
#define BOARD_CREALITY_V431 4041 // Creality v4.3.1 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V452 4042 // Creality v4.5.2 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V453 4043 // Creality v4.5.3 (STM32F103RE)
|
||||
#define BOARD_TRIGORILLA_PRO 4044 // Trigorilla Pro (STM32F103ZET6)
|
||||
#define BOARD_FLY_MINI 4045 // FLY MINI (STM32F103RCT6)
|
||||
#define BOARD_FLSUN_HISPEED 4046 // FLSUN HiSpeedV1 (STM32F103VET6)
|
||||
#define BOARD_BEAST 4047 // STM32F103RET6 Libmaple-based controller
|
||||
#define BOARD_MINGDA_MPX_ARM_MINI 4048 // STM32F103ZET6 Mingda MD-16
|
||||
#define BOARD_GTM32_PRO_VD 4049 // STM32F103VET6 controller
|
||||
#define BOARD_CHITU3D_V9 4038 // Chitu3D TronXY X5SA V9 Board
|
||||
#define BOARD_CREALITY_V4 4039 // Creality v4.x (STM32F103RE)
|
||||
#define BOARD_CREALITY_V427 4040 // Creality v4.2.7 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V4210 4041 // Creality v4.2.10 (STM32F103RE) as found in the CR-30
|
||||
#define BOARD_CREALITY_V431 4042 // Creality v4.3.1 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V452 4043 // Creality v4.5.2 (STM32F103RE)
|
||||
#define BOARD_CREALITY_V453 4044 // Creality v4.5.3 (STM32F103RE)
|
||||
#define BOARD_TRIGORILLA_PRO 4045 // Trigorilla Pro (STM32F103ZET6)
|
||||
#define BOARD_FLY_MINI 4046 // FLYmaker FLY MINI (STM32F103RCT6)
|
||||
#define BOARD_FLSUN_HISPEED 4047 // FLSUN HiSpeedV1 (STM32F103VET6)
|
||||
#define BOARD_BEAST 4048 // STM32F103RET6 Libmaple-based controller
|
||||
#define BOARD_MINGDA_MPX_ARM_MINI 4049 // STM32F103ZET6 Mingda MD-16
|
||||
#define BOARD_GTM32_PRO_VD 4050 // STM32F103VET6 controller
|
||||
|
||||
//
|
||||
// ARM Cortex-M4F
|
||||
@@ -380,7 +381,7 @@
|
||||
#define BOARD_FYSETC_S6 4220 // FYSETC S6 (STM32F446VET6)
|
||||
#define BOARD_FYSETC_S6_V2_0 4221 // FYSETC S6 v2.0 (STM32F446VET6)
|
||||
#define BOARD_FYSETC_SPIDER 4222 // FYSETC Spider (STM32F446VET6)
|
||||
#define BOARD_FLYF407ZG 4223 // FLYF407ZG (STM32F407ZG)
|
||||
#define BOARD_FLYF407ZG 4223 // FLYmaker FLYF407ZG (STM32F407ZG)
|
||||
#define BOARD_MKS_ROBIN2 4224 // MKS_ROBIN2 (STM32F407ZE)
|
||||
#define BOARD_MKS_ROBIN_PRO_V2 4225 // MKS Robin Pro V2 (STM32F407VE)
|
||||
#define BOARD_MKS_ROBIN_NANO_V3 4226 // MKS Robin Nano V3 (STM32F407VG)
|
||||
|
||||
@@ -231,6 +231,9 @@
|
||||
#define STR_HEATER_BED "bed"
|
||||
#define STR_HEATER_CHAMBER "chamber"
|
||||
#define STR_COOLER "cooler"
|
||||
#define STR_MOTHERBOARD "motherboard"
|
||||
#define STR_PROBE "probe"
|
||||
#define STR_REDUNDANT "redundant "
|
||||
#define STR_LASER_TEMP "laser temperature"
|
||||
|
||||
#define STR_STOPPED_HEATER ", system stopped! Heater_ID: "
|
||||
|
||||
@@ -442,7 +442,7 @@
|
||||
return contains(str, '/') ? findLastPos(findStringEnd(str), '/') : str;
|
||||
}
|
||||
|
||||
// Find the first occurence of a character in a string (or return the last position in the string)
|
||||
// Find the first occurrence of a character in a string (or return the last position in the string)
|
||||
constexpr const char* findFirst(const char *str, const char ch) {
|
||||
return *str == ch || *str == 0 ? (str + 1) : findFirst(str + 1, ch);
|
||||
}
|
||||
|
||||
@@ -42,15 +42,12 @@ typedef const char Language_Str[];
|
||||
#ifndef LCD_LANGUAGE_2
|
||||
#define LCD_LANGUAGE_2 LCD_LANGUAGE
|
||||
#endif
|
||||
|
||||
#ifndef LCD_LANGUAGE_3
|
||||
#define LCD_LANGUAGE_3 LCD_LANGUAGE_2
|
||||
#endif
|
||||
|
||||
#ifndef LCD_LANGUAGE_4
|
||||
#define LCD_LANGUAGE_4 LCD_LANGUAGE_3
|
||||
#endif
|
||||
|
||||
#ifndef LCD_LANGUAGE_5
|
||||
#define LCD_LANGUAGE_5 LCD_LANGUAGE_4
|
||||
#endif
|
||||
|
||||
@@ -307,7 +307,7 @@ void unified_bed_leveling::G29() {
|
||||
|
||||
const uint8_t p_val = parser.byteval('P');
|
||||
const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen_test('J');
|
||||
#if ENABLED(HAS_MULTI_HOTEND)
|
||||
#if HAS_MULTI_HOTEND
|
||||
const uint8_t old_tool_index = active_extruder;
|
||||
#endif
|
||||
|
||||
@@ -916,11 +916,11 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
if (do_ubl_mesh_map) display_map(param.T_map_type); // Show user where we're probing
|
||||
|
||||
if (parser.seen_test('B')) {
|
||||
SERIAL_ECHOPGM_P(GET_TEXT(MSG_UBL_BC_INSERT));
|
||||
SERIAL_ECHOPGM("Place Shim & Measure");
|
||||
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHOPGM_P(GET_TEXT(MSG_UBL_BC_INSERT2));
|
||||
SERIAL_ECHOPGM("Measure");
|
||||
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT2);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,9 +76,14 @@ void ControllerFan::update() {
|
||||
)
|
||||
);
|
||||
|
||||
// If any of the drivers or the heated bed are enabled...
|
||||
if (motor_on || TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0))
|
||||
lastMotorOn = ms; //... set time to NOW so the fan will turn on
|
||||
// If any triggers for the controller fan are true...
|
||||
// - At least one stepper driver is enabled
|
||||
// - The heated bed is enabled
|
||||
// - TEMP_SENSOR_BOARD is reporting >= CONTROLLER_FAN_MIN_BOARD_TEMP
|
||||
if ( motor_on
|
||||
|| TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0)
|
||||
|| TERN0(HAS_CONTROLLER_FAN_MIN_BOARD_TEMP, thermalManager.wholeDegBoard() >= CONTROLLER_FAN_MIN_BOARD_TEMP)
|
||||
) lastMotorOn = ms; //... set time to NOW so the fan will turn on
|
||||
|
||||
// Fan Settings. Set fan > 0:
|
||||
// - If AutoMode is on and steppers have been enabled for CONTROLLERFAN_IDLE_TIME seconds.
|
||||
|
||||
@@ -22,26 +22,27 @@
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_COOLER
|
||||
#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
|
||||
|
||||
#include "cooler.h"
|
||||
Cooler cooler;
|
||||
|
||||
uint8_t Cooler::mode = 0;
|
||||
uint16_t Cooler::capacity;
|
||||
uint16_t Cooler::load;
|
||||
bool Cooler::enabled = false;
|
||||
#if HAS_COOLER
|
||||
uint8_t Cooler::mode = 0;
|
||||
uint16_t Cooler::capacity;
|
||||
uint16_t Cooler::load;
|
||||
bool Cooler::enabled = false;
|
||||
#endif
|
||||
|
||||
#if ENABLED(LASER_COOLANT_FLOW_METER)
|
||||
bool Cooler::flowmeter = false;
|
||||
millis_t Cooler::flowmeter_next_ms; // = 0
|
||||
volatile uint16_t Cooler::flowpulses;
|
||||
float Cooler::flowrate;
|
||||
#if ENABLED(FLOWMETER_SAFETY)
|
||||
bool Cooler::flowsafety_enabled = true;
|
||||
bool Cooler::flowfault = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(FLOWMETER_SAFETY)
|
||||
bool Cooler::flowsafety_enabled = true;
|
||||
bool Cooler::fault = false;
|
||||
#endif
|
||||
|
||||
#endif // HAS_COOLER
|
||||
#endif // HAS_COOLER || LASER_COOLANT_FLOW_METER
|
||||
|
||||
@@ -94,12 +94,12 @@ public:
|
||||
}
|
||||
|
||||
#if ENABLED(FLOWMETER_SAFETY)
|
||||
static bool fault; // Flag that the cooler is in a fault state
|
||||
static bool flowsafety_enabled; // Flag to disable the cutter if flow rate is too low
|
||||
static bool flowfault; // Flag that the cooler is in a fault state
|
||||
static bool flowsafety_enabled; // Flag to disable the cutter if flow rate is too low
|
||||
static void flowsafety_toggle() { flowsafety_enabled = !flowsafety_enabled; }
|
||||
static bool check_flow_too_low() {
|
||||
const bool too_low = flowsafety_enabled && flowrate < (FLOWMETER_MIN_LITERS_PER_MINUTE);
|
||||
if (too_low) fault = true;
|
||||
flowfault = too_low;
|
||||
return too_low;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#if HAS_MOTOR_CURRENT_DAC
|
||||
|
||||
#include "dac_mcp4728.h"
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#if HAS_MOTOR_CURRENT_DAC
|
||||
|
||||
#include "stepper_dac.h"
|
||||
#include "../../MarlinCore.h" // for SP_X_LBL...
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
class Joystick {
|
||||
friend class Temperature;
|
||||
private:
|
||||
#if ENABLED(HAS_JOY_ADC_X)
|
||||
#if HAS_JOY_ADC_X
|
||||
static temp_info_t x;
|
||||
#endif
|
||||
#if ENABLED(HAS_JOY_ADC_Y)
|
||||
#if HAS_JOY_ADC_Y
|
||||
static temp_info_t y;
|
||||
#endif
|
||||
#if ENABLED(HAS_JOY_ADC_Z)
|
||||
#if HAS_JOY_ADC_Z
|
||||
static temp_info_t z;
|
||||
#endif
|
||||
public:
|
||||
|
||||
@@ -75,7 +75,7 @@ MMU2 mmu2;
|
||||
#define MMU2_NO_TOOL 99
|
||||
#define MMU_BAUD 115200
|
||||
|
||||
bool MMU2::enabled, MMU2::ready, MMU2::mmu_print_saved;
|
||||
bool MMU2::_enabled, MMU2::ready, MMU2::mmu_print_saved;
|
||||
#if HAS_PRUSA_MMU2S
|
||||
bool MMU2::mmu2s_triggered;
|
||||
#endif
|
||||
@@ -219,7 +219,7 @@ void MMU2::mmu_loop() {
|
||||
|
||||
DEBUG_ECHOLNPAIR("MMU => ", finda, "\nMMU - ENABLED");
|
||||
|
||||
enabled = true;
|
||||
_enabled = true;
|
||||
state = 1;
|
||||
TERN_(HAS_PRUSA_MMU2S, mmu2s_triggered = false);
|
||||
}
|
||||
@@ -480,7 +480,7 @@ static void mmu2_not_responding() {
|
||||
*/
|
||||
void MMU2::tool_change(const uint8_t index) {
|
||||
|
||||
if (!enabled) return;
|
||||
if (!_enabled) return;
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
@@ -512,7 +512,7 @@ static void mmu2_not_responding() {
|
||||
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
|
||||
*/
|
||||
void MMU2::tool_change(const char *special) {
|
||||
if (!enabled) return;
|
||||
if (!_enabled) return;
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
@@ -561,7 +561,7 @@ static void mmu2_not_responding() {
|
||||
* Handle tool change
|
||||
*/
|
||||
void MMU2::tool_change(const uint8_t index) {
|
||||
if (!enabled) return;
|
||||
if (!_enabled) return;
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
@@ -599,7 +599,7 @@ static void mmu2_not_responding() {
|
||||
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
|
||||
*/
|
||||
void MMU2::tool_change(const char *special) {
|
||||
if (!enabled) return;
|
||||
if (!_enabled) return;
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
@@ -665,7 +665,7 @@ static void mmu2_not_responding() {
|
||||
* Handle tool change
|
||||
*/
|
||||
void MMU2::tool_change(const uint8_t index) {
|
||||
if (!enabled) return;
|
||||
if (!_enabled) return;
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
@@ -693,7 +693,7 @@ static void mmu2_not_responding() {
|
||||
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
|
||||
*/
|
||||
void MMU2::tool_change(const char *special) {
|
||||
if (!enabled) return;
|
||||
if (!_enabled) return;
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
@@ -744,7 +744,7 @@ static void mmu2_not_responding() {
|
||||
* Set next command
|
||||
*/
|
||||
void MMU2::command(const uint8_t mmu_cmd) {
|
||||
if (!enabled) return;
|
||||
if (!_enabled) return;
|
||||
cmd = mmu_cmd;
|
||||
ready = false;
|
||||
}
|
||||
@@ -833,7 +833,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
|
||||
}
|
||||
|
||||
void MMU2::set_filament_type(const uint8_t index, const uint8_t filamentType) {
|
||||
if (!enabled) return;
|
||||
if (!_enabled) return;
|
||||
|
||||
cmd_arg = filamentType;
|
||||
command(MMU_CMD_F0 + index);
|
||||
@@ -892,7 +892,7 @@ void MMU2::filament_runout() {
|
||||
|
||||
// Load filament into MMU2
|
||||
void MMU2::load_filament(const uint8_t index) {
|
||||
if (!enabled) return;
|
||||
if (!_enabled) return;
|
||||
|
||||
command(MMU_CMD_L0 + index);
|
||||
manage_response(false, false);
|
||||
@@ -904,7 +904,7 @@ void MMU2::load_filament(const uint8_t index) {
|
||||
*/
|
||||
bool MMU2::load_filament_to_nozzle(const uint8_t index) {
|
||||
|
||||
if (!enabled) return false;
|
||||
if (!_enabled) return false;
|
||||
|
||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||
BUZZ(200, 404);
|
||||
@@ -940,7 +940,7 @@ void MMU2::load_to_nozzle() {
|
||||
|
||||
bool MMU2::eject_filament(const uint8_t index, const bool recover) {
|
||||
|
||||
if (!enabled) return false;
|
||||
if (!_enabled) return false;
|
||||
|
||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||
BUZZ(200, 404);
|
||||
@@ -989,7 +989,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
|
||||
*/
|
||||
bool MMU2::unload() {
|
||||
|
||||
if (!enabled) return false;
|
||||
if (!_enabled) return false;
|
||||
|
||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||
BUZZ(200, 404);
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
|
||||
static void init();
|
||||
static void reset();
|
||||
static inline bool enabled() { return _enabled; }
|
||||
static void mmu_loop();
|
||||
static void tool_change(const uint8_t index);
|
||||
static void tool_change(const char *special);
|
||||
@@ -88,7 +89,7 @@ private:
|
||||
static void mmu_continue_loading();
|
||||
#endif
|
||||
|
||||
static bool enabled, ready, mmu_print_saved;
|
||||
static bool _enabled, ready, mmu_print_saved;
|
||||
|
||||
static uint8_t cmd, cmd_arg, last_cmd, extruder;
|
||||
static int8_t state;
|
||||
|
||||
+161
-114
@@ -26,10 +26,7 @@
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
|
||||
#include "power.h"
|
||||
#include "../module/temperature.h"
|
||||
#include "../module/stepper/indirection.h"
|
||||
#include "../MarlinCore.h"
|
||||
|
||||
@@ -41,133 +38,183 @@
|
||||
#include "../gcode/gcode.h"
|
||||
#endif
|
||||
|
||||
#if BOTH(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN)
|
||||
#include "controllerfan.h"
|
||||
#endif
|
||||
#if EITHER(PSU_CONTROL, AUTO_POWER_CONTROL)
|
||||
|
||||
Power powerManager;
|
||||
bool Power::psu_on;
|
||||
|
||||
millis_t Power::lastPowerOn;
|
||||
|
||||
bool Power::is_power_needed() {
|
||||
|
||||
if (printJobOngoing() || printingIsPaused()) return true;
|
||||
|
||||
#if ENABLED(AUTO_POWER_FANS)
|
||||
FANS_LOOP(i) if (thermalManager.fan_speed[i]) return true;
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_POWER_E_FANS)
|
||||
HOTEND_LOOP() if (thermalManager.autofan_speed[e]) return true;
|
||||
#endif
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#include "../module/temperature.h"
|
||||
|
||||
#if BOTH(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN)
|
||||
if (controllerFan.state()) return true;
|
||||
#include "controllerfan.h"
|
||||
#endif
|
||||
|
||||
if (TERN0(AUTO_POWER_CHAMBER_FAN, thermalManager.chamberfan_speed))
|
||||
return true;
|
||||
|
||||
if (TERN0(AUTO_POWER_COOLER_FAN, thermalManager.coolerfan_speed))
|
||||
return true;
|
||||
|
||||
// If any of the drivers or the bed are enabled...
|
||||
if (X_ENABLE_READ() == X_ENABLE_ON || Y_ENABLE_READ() == Y_ENABLE_ON || Z_ENABLE_READ() == Z_ENABLE_ON
|
||||
#if HAS_X2_ENABLE
|
||||
|| X2_ENABLE_READ() == X_ENABLE_ON
|
||||
#endif
|
||||
#if HAS_Y2_ENABLE
|
||||
|| Y2_ENABLE_READ() == Y_ENABLE_ON
|
||||
#endif
|
||||
#if HAS_Z2_ENABLE
|
||||
|| Z2_ENABLE_READ() == Z_ENABLE_ON
|
||||
#endif
|
||||
#if E_STEPPERS
|
||||
#define _OR_ENABLED_E(N) || E##N##_ENABLE_READ() == E_ENABLE_ON
|
||||
REPEAT(E_STEPPERS, _OR_ENABLED_E)
|
||||
#endif
|
||||
) return true;
|
||||
|
||||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() if (thermalManager.degTargetHotend(e) > 0 || thermalManager.temp_hotend[e].soft_pwm_amount > 0) return true;
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0 || thermalManager.temp_bed.soft_pwm_amount > 0)) return true;
|
||||
|
||||
#if HAS_HOTEND && AUTO_POWER_E_TEMP
|
||||
HOTEND_LOOP() if (thermalManager.degHotend(e) >= (AUTO_POWER_E_TEMP)) return true;
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER && AUTO_POWER_CHAMBER_TEMP
|
||||
if (thermalManager.degChamber() >= (AUTO_POWER_CHAMBER_TEMP)) return true;
|
||||
#endif
|
||||
|
||||
#if HAS_COOLER && AUTO_POWER_COOLER_TEMP
|
||||
if (thermalManager.degCooler() >= (AUTO_POWER_COOLER_TEMP)) return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef POWER_TIMEOUT
|
||||
#define POWER_TIMEOUT 0
|
||||
millis_t Power::lastPowerOn;
|
||||
#endif
|
||||
|
||||
void Power::check(const bool pause) {
|
||||
static bool _pause = false;
|
||||
static millis_t nextPowerCheck = 0;
|
||||
const millis_t now = millis();
|
||||
#if POWER_TIMEOUT > 0
|
||||
if (pause != _pause) {
|
||||
lastPowerOn = now + !now;
|
||||
_pause = pause;
|
||||
}
|
||||
if (pause) return;
|
||||
#endif
|
||||
if (ELAPSED(now, nextPowerCheck)) {
|
||||
nextPowerCheck = now + 2500UL;
|
||||
if (is_power_needed())
|
||||
power_on();
|
||||
else if (!lastPowerOn || (POWER_TIMEOUT > 0 && ELAPSED(now, lastPowerOn + SEC_TO_MS(POWER_TIMEOUT))))
|
||||
power_off();
|
||||
}
|
||||
/**
|
||||
* Initialize pins & state for the power manager.
|
||||
*
|
||||
*/
|
||||
void Power::init(){
|
||||
psu_on = ENABLED(PSU_DEFAULT_OFF); // Set opposite state to get full power_off/on
|
||||
TERN(PSU_DEFAULT_OFF, power_off(), power_on());
|
||||
}
|
||||
|
||||
/**
|
||||
* Power on if the power is currently off.
|
||||
* Restores stepper drivers and processes any PSU_POWERUP_GCODE.
|
||||
*
|
||||
*/
|
||||
void Power::power_on() {
|
||||
const millis_t now = millis();
|
||||
lastPowerOn = now + !now;
|
||||
if (!powersupply_on) {
|
||||
PSU_PIN_ON();
|
||||
safe_delay(PSU_POWERUP_DELAY);
|
||||
restore_stepper_drivers();
|
||||
TERN_(HAS_TRINAMIC_CONFIG, safe_delay(PSU_POWERUP_DELAY));
|
||||
#ifdef PSU_POWERUP_GCODE
|
||||
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWERUP_GCODE));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
const millis_t now = millis();
|
||||
lastPowerOn = now + !now;
|
||||
#endif
|
||||
|
||||
void Power::power_off() {
|
||||
if (powersupply_on) {
|
||||
#ifdef PSU_POWEROFF_GCODE
|
||||
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWEROFF_GCODE));
|
||||
#endif
|
||||
if (psu_on) return;
|
||||
|
||||
#if ENABLED(PS_OFF_SOUND)
|
||||
BUZZ(1000, 659);
|
||||
#endif
|
||||
OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_STATE);
|
||||
psu_on = true;
|
||||
safe_delay(PSU_POWERUP_DELAY);
|
||||
restore_stepper_drivers();
|
||||
TERN_(HAS_TRINAMIC_CONFIG, safe_delay(PSU_POWERUP_DELAY));
|
||||
|
||||
PSU_PIN_OFF();
|
||||
}
|
||||
}
|
||||
|
||||
void Power::power_off_soon() {
|
||||
#if POWER_OFF_DELAY
|
||||
lastPowerOn = millis() - SEC_TO_MS(POWER_TIMEOUT) + SEC_TO_MS(POWER_OFF_DELAY);
|
||||
//if (!lastPowerOn) ++lastPowerOn;
|
||||
#else
|
||||
power_off();
|
||||
#ifdef PSU_POWERUP_GCODE
|
||||
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWERUP_GCODE));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Power off if the power is currently on.
|
||||
* Processes any PSU_POWEROFF_GCODE and makes a PS_OFF_SOUND if enabled.
|
||||
*
|
||||
*/
|
||||
void Power::power_off() {
|
||||
if (!psu_on) return;
|
||||
|
||||
#ifdef PSU_POWEROFF_GCODE
|
||||
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWEROFF_GCODE));
|
||||
#endif
|
||||
|
||||
#if ENABLED(PS_OFF_SOUND)
|
||||
BUZZ(1000, 659);
|
||||
#endif
|
||||
|
||||
OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_STATE);
|
||||
psu_on = false;
|
||||
}
|
||||
|
||||
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
|
||||
#ifndef POWER_TIMEOUT
|
||||
#define POWER_TIMEOUT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Check all conditions that would signal power needing to be on.
|
||||
*
|
||||
* @returns bool if power is needed
|
||||
*/
|
||||
bool Power::is_power_needed() {
|
||||
|
||||
if (printJobOngoing() || printingIsPaused()) return true;
|
||||
|
||||
#if ENABLED(AUTO_POWER_FANS)
|
||||
FANS_LOOP(i) if (thermalManager.fan_speed[i]) return true;
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_POWER_E_FANS)
|
||||
HOTEND_LOOP() if (thermalManager.autofan_speed[e]) return true;
|
||||
#endif
|
||||
|
||||
#if BOTH(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN)
|
||||
if (controllerFan.state()) return true;
|
||||
#endif
|
||||
|
||||
if (TERN0(AUTO_POWER_CHAMBER_FAN, thermalManager.chamberfan_speed))
|
||||
return true;
|
||||
|
||||
if (TERN0(AUTO_POWER_COOLER_FAN, thermalManager.coolerfan_speed))
|
||||
return true;
|
||||
|
||||
// If any of the drivers or the bed are enabled...
|
||||
if (X_ENABLE_READ() == X_ENABLE_ON || Y_ENABLE_READ() == Y_ENABLE_ON || Z_ENABLE_READ() == Z_ENABLE_ON
|
||||
#if HAS_X2_ENABLE
|
||||
|| X2_ENABLE_READ() == X_ENABLE_ON
|
||||
#endif
|
||||
#if HAS_Y2_ENABLE
|
||||
|| Y2_ENABLE_READ() == Y_ENABLE_ON
|
||||
#endif
|
||||
#if HAS_Z2_ENABLE
|
||||
|| Z2_ENABLE_READ() == Z_ENABLE_ON
|
||||
#endif
|
||||
#if E_STEPPERS
|
||||
#define _OR_ENABLED_E(N) || E##N##_ENABLE_READ() == E_ENABLE_ON
|
||||
REPEAT(E_STEPPERS, _OR_ENABLED_E)
|
||||
#endif
|
||||
) return true;
|
||||
|
||||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() if (thermalManager.degTargetHotend(e) > 0 || thermalManager.temp_hotend[e].soft_pwm_amount > 0) return true;
|
||||
#endif
|
||||
|
||||
if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0 || thermalManager.temp_bed.soft_pwm_amount > 0)) return true;
|
||||
|
||||
#if HAS_HOTEND && AUTO_POWER_E_TEMP
|
||||
HOTEND_LOOP() if (thermalManager.degHotend(e) >= (AUTO_POWER_E_TEMP)) return true;
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER && AUTO_POWER_CHAMBER_TEMP
|
||||
if (thermalManager.degChamber() >= (AUTO_POWER_CHAMBER_TEMP)) return true;
|
||||
#endif
|
||||
|
||||
#if HAS_COOLER && AUTO_POWER_COOLER_TEMP
|
||||
if (thermalManager.degCooler() >= (AUTO_POWER_COOLER_TEMP)) return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we should power off automatically (POWER_TIMEOUT elapsed, !is_power_needed).
|
||||
*
|
||||
* @param pause pause the 'timer'
|
||||
*/
|
||||
void Power::check(const bool pause) {
|
||||
static millis_t nextPowerCheck = 0;
|
||||
const millis_t now = millis();
|
||||
#if POWER_TIMEOUT > 0
|
||||
static bool _pause = false;
|
||||
if (pause != _pause) {
|
||||
lastPowerOn = now + !now;
|
||||
_pause = pause;
|
||||
}
|
||||
if (pause) return;
|
||||
#endif
|
||||
if (ELAPSED(now, nextPowerCheck)) {
|
||||
nextPowerCheck = now + 2500UL;
|
||||
if (is_power_needed())
|
||||
power_on();
|
||||
else if (!lastPowerOn || (POWER_TIMEOUT > 0 && ELAPSED(now, lastPowerOn + SEC_TO_MS(POWER_TIMEOUT))))
|
||||
power_off();
|
||||
}
|
||||
}
|
||||
|
||||
#if POWER_OFF_DELAY > 0
|
||||
|
||||
/**
|
||||
* Power off with a delay. Power off is triggered by check() after the delay.
|
||||
*
|
||||
*/
|
||||
void Power::power_off_soon() {
|
||||
lastPowerOn = millis() - SEC_TO_MS(POWER_TIMEOUT) + SEC_TO_MS(POWER_OFF_DELAY);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // AUTO_POWER_CONTROL
|
||||
|
||||
#endif // PSU_CONTROL || AUTO_POWER_CONTROL
|
||||
|
||||
@@ -25,17 +25,32 @@
|
||||
* power.h - power control
|
||||
*/
|
||||
|
||||
#include "../core/millis_t.h"
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#include "../core/millis_t.h"
|
||||
#endif
|
||||
|
||||
class Power {
|
||||
public:
|
||||
static void check(const bool pause);
|
||||
static bool psu_on;
|
||||
|
||||
static void init();
|
||||
static void power_on();
|
||||
static void power_off();
|
||||
|
||||
#if ENABLED(AUTO_POWER_CONTROL) && POWER_OFF_DELAY > 0
|
||||
static void power_off_soon();
|
||||
private:
|
||||
static millis_t lastPowerOn;
|
||||
static bool is_power_needed();
|
||||
#else
|
||||
static inline void power_off_soon() { power_off(); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
static void check(const bool pause);
|
||||
|
||||
private:
|
||||
static millis_t lastPowerOn;
|
||||
static bool is_power_needed();
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
extern Power powerManager;
|
||||
|
||||
@@ -64,13 +64,13 @@ typedef struct {
|
||||
Repeat stored_repeat;
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_HOME_OFFSET)
|
||||
#if HAS_HOME_OFFSET
|
||||
xyz_pos_t home_offset;
|
||||
#endif
|
||||
#if ENABLED(HAS_POSITION_SHIFT)
|
||||
#if HAS_POSITION_SHIFT
|
||||
xyz_pos_t position_shift;
|
||||
#endif
|
||||
#if ENABLED(HAS_MULTI_EXTRUDER)
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
uint8_t active_extruder;
|
||||
#endif
|
||||
|
||||
@@ -78,13 +78,13 @@ typedef struct {
|
||||
float filament_size[EXTRUDERS];
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_HOTEND)
|
||||
#if HAS_HOTEND
|
||||
celsius_t target_temperature[HOTENDS];
|
||||
#endif
|
||||
#if ENABLED(HAS_HEATED_BED)
|
||||
#if HAS_HEATED_BED
|
||||
celsius_t target_temperature_bed;
|
||||
#endif
|
||||
#if ENABLED(HAS_FAN)
|
||||
#if HAS_FAN
|
||||
uint8_t fan_speed[FAN_COUNT];
|
||||
#endif
|
||||
|
||||
|
||||
@@ -360,13 +360,6 @@ void test_tmc_connection(LOGICAL_AXIS_DECL(const bool, true));
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
extern millis_t sg_guard_period;
|
||||
constexpr uint16_t default_sg_guard_duration = 400;
|
||||
|
||||
struct motion_state_t {
|
||||
xy_ulong_t acceleration;
|
||||
#if ENABLED(HAS_CLASSIC_JERK)
|
||||
xy_float_t jerk_state;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
bool tmc_enable_stallguard(TMC2130Stepper &st);
|
||||
|
||||
@@ -70,7 +70,8 @@ void GcodeSuite::G29() {
|
||||
return;
|
||||
}
|
||||
|
||||
int8_t ix, iy = 0;
|
||||
int8_t ix, iy;
|
||||
ix = iy = 0;
|
||||
|
||||
switch (state) {
|
||||
case MeshReport:
|
||||
|
||||
@@ -167,12 +167,15 @@
|
||||
motion_state_t begin_slow_homing() {
|
||||
motion_state_t motion_state{0};
|
||||
motion_state.acceleration.set(planner.settings.max_acceleration_mm_per_s2[X_AXIS],
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS]
|
||||
OPTARG(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS])
|
||||
);
|
||||
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100;
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100;
|
||||
TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = 100);
|
||||
#if HAS_CLASSIC_JERK
|
||||
motion_state.jerk_state = planner.max_jerk;
|
||||
planner.max_jerk.set(0, 0);
|
||||
planner.max_jerk.set(0, 0 OPTARG(DELTA, 0));
|
||||
#endif
|
||||
planner.reset_acceleration_rates();
|
||||
return motion_state;
|
||||
@@ -181,6 +184,7 @@
|
||||
void end_slow_homing(const motion_state_t &motion_state) {
|
||||
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = motion_state.acceleration.x;
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y;
|
||||
TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = motion_state.acceleration.z);
|
||||
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state);
|
||||
planner.reset_acceleration_rates();
|
||||
}
|
||||
@@ -259,7 +263,7 @@ void GcodeSuite::G28() {
|
||||
reset_stepper_timeout();
|
||||
|
||||
#define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT)
|
||||
#if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2)
|
||||
#if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2) || (ENABLED(DELTA) && HAS_CURRENT_HOME(Z))
|
||||
#define HAS_HOMING_CURRENT 1
|
||||
#endif
|
||||
|
||||
@@ -287,6 +291,11 @@ void GcodeSuite::G28() {
|
||||
stepperY2.rms_current(Y2_CURRENT_HOME);
|
||||
if (DEBUGGING(LEVELING)) debug_current(PSTR("Y2"), tmc_save_current_Y2, Y2_CURRENT_HOME);
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
|
||||
const int16_t tmc_save_current_Z = stepperZ.getMilliamps();
|
||||
stepperZ.rms_current(Z_CURRENT_HOME);
|
||||
if (DEBUGGING(LEVELING)) debug_current(PSTR("Z"), tmc_save_current_Z, Z_CURRENT_HOME);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
@@ -497,6 +506,9 @@ void GcodeSuite::G28() {
|
||||
#if HAS_CURRENT_HOME(Y2)
|
||||
stepperY2.rms_current(tmc_save_current_Y2);
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
|
||||
stepperZ.rms_current(tmc_save_current_Z);
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME(I)
|
||||
stepperI.rms_current(tmc_save_current_I);
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,7 @@ enum CalEnum : char { // the 7 main calibration points -
|
||||
#define LOOP_CAL_RAD(VAR) LOOP_CAL_PT(VAR, __A, _7P_STEP)
|
||||
#define LOOP_CAL_ACT(VAR, _4P, _OP) LOOP_CAL_PT(VAR, _OP ? _AB : __A, _4P ? _4P_STEP : _7P_STEP)
|
||||
|
||||
#if ENABLED(HAS_MULTI_HOTEND)
|
||||
#if HAS_MULTI_HOTEND
|
||||
const uint8_t old_tool_index = active_extruder;
|
||||
#endif
|
||||
|
||||
@@ -71,7 +71,9 @@ float lcd_probe_pt(const xy_pos_t &xy);
|
||||
|
||||
void ac_home() {
|
||||
endstops.enable(true);
|
||||
TERN_(SENSORLESS_HOMING, probe.set_homing_current(true));
|
||||
home_delta();
|
||||
TERN_(SENSORLESS_HOMING, probe.set_homing_current(false));
|
||||
endstops.not_homing();
|
||||
}
|
||||
|
||||
@@ -384,6 +386,12 @@ static float auto_tune_a() {
|
||||
* V3 Report settings and probe results
|
||||
*
|
||||
* E Engage the probe for each point
|
||||
*
|
||||
* With SENSORLESS_PROBING:
|
||||
* Use these flags to calibrate stall sensitivity: (e.g., `G33 P1 Y Z` to calibrate X only.)
|
||||
* X Don't activate stallguard on X.
|
||||
* Y Don't activate stallguard on Y.
|
||||
* Z Don't activate stallguard on Z.
|
||||
*/
|
||||
void GcodeSuite::G33() {
|
||||
|
||||
@@ -417,6 +425,12 @@ void GcodeSuite::G33() {
|
||||
|
||||
const bool stow_after_each = parser.seen_test('E');
|
||||
|
||||
#if ENABLED(SENSORLESS_PROBING)
|
||||
probe.test_sensitivity.x = !parser.seen_test('X');
|
||||
TERN_(HAS_Y_AXIS, probe.test_sensitivity.y = !parser.seen_test('Y'));
|
||||
TERN_(HAS_Z_AXIS, probe.test_sensitivity.z = !parser.seen_test('Z'));
|
||||
#endif
|
||||
|
||||
const bool _0p_calibration = probe_points == 0,
|
||||
_1p_calibration = probe_points == 1 || probe_points == -1,
|
||||
_4p_calibration = probe_points == 2,
|
||||
@@ -587,7 +601,7 @@ void GcodeSuite::G33() {
|
||||
|
||||
// print report
|
||||
|
||||
if (verbose_level == 3)
|
||||
if (verbose_level == 3 || verbose_level == 0)
|
||||
print_calibration_results(z_at_pt, _tower_results, _opposite_results);
|
||||
|
||||
if (verbose_level != 0) { // !dry run
|
||||
|
||||
@@ -81,11 +81,11 @@ void GcodeSuite::G34() {
|
||||
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
|
||||
const uint32_t previous_current = stepper.motor_current_setting[Z_AXIS];
|
||||
stepper.set_digipot_current(1, target_current);
|
||||
#elif ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#elif HAS_MOTOR_CURRENT_DAC
|
||||
const float target_current = parser.floatval('S', GANTRY_CALIBRATION_CURRENT);
|
||||
const float previous_current = dac_amps(Z_AXIS, target_current);
|
||||
stepper_dac.set_current_value(Z_AXIS, target_current);
|
||||
#elif ENABLED(HAS_MOTOR_CURRENT_I2C)
|
||||
#elif HAS_MOTOR_CURRENT_I2C
|
||||
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
|
||||
previous_current = dac_amps(Z_AXIS);
|
||||
digipot_i2c.set_current(Z_AXIS, target_current)
|
||||
@@ -127,9 +127,9 @@ void GcodeSuite::G34() {
|
||||
stepper.set_digipot_current(Z_AXIS, previous_current);
|
||||
#elif HAS_MOTOR_CURRENT_PWM
|
||||
stepper.set_digipot_current(1, previous_current);
|
||||
#elif ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#elif HAS_MOTOR_CURRENT_DAC
|
||||
stepper_dac.set_current_value(Z_AXIS, previous_current);
|
||||
#elif ENABLED(HAS_MOTOR_CURRENT_I2C)
|
||||
#elif HAS_MOTOR_CURRENT_I2C
|
||||
digipot_i2c.set_current(Z_AXIS, previous_current)
|
||||
#elif HAS_TRINAMIC_CONFIG
|
||||
#if AXIS_IS_TMC(Z)
|
||||
|
||||
@@ -27,30 +27,72 @@
|
||||
#include "../gcode.h"
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
|
||||
#include "../../module/delta.h"
|
||||
#include "../../module/motion.h"
|
||||
#else
|
||||
#include "../../module/endstops.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../../core/debug_out.h"
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../../core/debug_out.h"
|
||||
|
||||
void M666_report(const bool forReplay=true) {
|
||||
if (!forReplay) { SERIAL_ECHOLNPGM("; Endstop adjustment:"); SERIAL_ECHO_START(); }
|
||||
#if ENABLED(DELTA)
|
||||
SERIAL_ECHOLNPAIR_P(
|
||||
PSTR(" M666 X"), LINEAR_UNIT(delta_endstop_adj.a)
|
||||
, SP_Y_STR, LINEAR_UNIT(delta_endstop_adj.b)
|
||||
, SP_Z_STR, LINEAR_UNIT(delta_endstop_adj.c)
|
||||
);
|
||||
#else
|
||||
SERIAL_ECHOPGM(" M666");
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
SERIAL_ECHOLNPAIR_P(SP_X_STR, LINEAR_UNIT(endstops.x2_endstop_adj));
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
SERIAL_ECHOLNPAIR_P(SP_Y_STR, LINEAR_UNIT(endstops.y2_endstop_adj));
|
||||
#endif
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3
|
||||
SERIAL_ECHOPAIR(" S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
|
||||
if (!forReplay) SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPAIR(" M666 S3 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 4
|
||||
if (!forReplay) SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPAIR(" M666 S4 Z", LINEAR_UNIT(endstops.z4_endstop_adj));
|
||||
#endif
|
||||
#else
|
||||
SERIAL_ECHOLNPAIR_P(SP_Z_STR, LINEAR_UNIT(endstops.z2_endstop_adj));
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
|
||||
/**
|
||||
* M666: Set delta endstop adjustment
|
||||
*/
|
||||
void GcodeSuite::M666() {
|
||||
DEBUG_SECTION(log_M666, "M666", DEBUGGING(LEVELING));
|
||||
bool is_err = false, is_set = false;
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
if (parser.seen(AXIS_CHAR(i))) {
|
||||
is_set = true;
|
||||
const float v = parser.value_linear_units();
|
||||
if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v;
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", AS_CHAR(AXIS_CHAR(i)), "] = ", delta_endstop_adj[i]);
|
||||
if (v > 0)
|
||||
is_err = true;
|
||||
else {
|
||||
delta_endstop_adj[i] = v;
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", AS_CHAR(AXIS_CHAR(i)), "] = ", v);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_err) SERIAL_ECHOLNPAIR("?M666 offsets must be <= 0");
|
||||
if (!is_set) M666_report();
|
||||
}
|
||||
|
||||
#elif HAS_EXTRA_ENDSTOPS
|
||||
|
||||
#include "../../module/endstops.h"
|
||||
#else
|
||||
|
||||
/**
|
||||
* M666: Set Dual Endstops offsets for X, Y, and/or Z.
|
||||
@@ -81,21 +123,7 @@
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (!parser.seen("XYZ")) {
|
||||
auto echo_adj = [](PGM_P const label, const_float_t value) { SERIAL_ECHOPAIR_P(label, value); };
|
||||
SERIAL_ECHOPGM("Dual Endstop Adjustment (mm): ");
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
echo_adj(PSTR(" X2:"), endstops.x2_endstop_adj);
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
echo_adj(PSTR(" Y2:"), endstops.y2_endstop_adj);
|
||||
#endif
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
#define _ECHO_ZADJ(N) echo_adj(PSTR(" Z" STRINGIFY(N) ":"), endstops.z##N##_endstop_adj);
|
||||
REPEAT_S(2, INCREMENT(NUM_Z_STEPPER_DRIVERS), _ECHO_ZADJ)
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
}
|
||||
if (!parser.seen("XYZ")) M666_report();
|
||||
}
|
||||
|
||||
#endif // HAS_EXTRA_ENDSTOPS
|
||||
|
||||
@@ -93,7 +93,7 @@ void GcodeSuite::M852() {
|
||||
|
||||
if (!ijk) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM_P(GET_TEXT(MSG_SKEW_FACTOR));
|
||||
SERIAL_ECHOPGM("Skew Factor");
|
||||
SERIAL_ECHOPAIR_F(" XY: ", planner.skew_factor.xy, 6);
|
||||
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
||||
SERIAL_ECHOPAIR_F(" XZ: ", planner.skew_factor.xz, 6);
|
||||
|
||||
@@ -29,25 +29,17 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
#include "../queue.h"
|
||||
#include "../../feature/power.h"
|
||||
#endif
|
||||
|
||||
#if HAS_SUICIDE
|
||||
#include "../../MarlinCore.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#include "../../feature/power.h"
|
||||
#else
|
||||
void restore_stepper_drivers();
|
||||
#endif
|
||||
|
||||
// Could be moved to a feature, but this is all the data
|
||||
bool powersupply_on;
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
#include "../../feature/tmc_util.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M80 : Turn on the Power Supply
|
||||
* M80 S : Report the current state and exit
|
||||
@@ -56,11 +48,11 @@
|
||||
|
||||
// S: Report the current power supply state and exit
|
||||
if (parser.seen('S')) {
|
||||
SERIAL_ECHOPGM_P(powersupply_on ? PSTR("PS:1\n") : PSTR("PS:0\n"));
|
||||
SERIAL_ECHOPGM_P(powerManager.psu_on ? PSTR("PS:1\n") : PSTR("PS:0\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
PSU_ON();
|
||||
powerManager.power_on();
|
||||
|
||||
/**
|
||||
* If you have a switch on suicide pin, this is useful
|
||||
@@ -71,12 +63,6 @@
|
||||
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
|
||||
#endif
|
||||
|
||||
#if DISABLED(AUTO_POWER_CONTROL)
|
||||
safe_delay(PSU_POWERUP_DELAY);
|
||||
restore_stepper_drivers();
|
||||
TERN_(HAS_TRINAMIC_CONFIG, safe_delay(PSU_POWERUP_DELAY));
|
||||
#endif
|
||||
|
||||
TERN_(HAS_LCD_MENU, ui.reset_status());
|
||||
}
|
||||
|
||||
@@ -106,7 +92,7 @@ void GcodeSuite::M81() {
|
||||
#if HAS_SUICIDE
|
||||
suicide();
|
||||
#elif ENABLED(PSU_CONTROL)
|
||||
PSU_OFF_SOON();
|
||||
powerManager.power_off_soon();
|
||||
#endif
|
||||
|
||||
LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF "."));
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/controllerfan.h"
|
||||
|
||||
void M710_report(const bool forReplay) {
|
||||
void M710_report(const bool forReplay=true) {
|
||||
if (!forReplay) { SERIAL_ECHOLNPGM("; Controller Fan"); SERIAL_ECHO_START(); }
|
||||
SERIAL_ECHOLNPAIR(" M710"
|
||||
" S", int(controllerFan.settings.active_speed),
|
||||
@@ -75,7 +75,7 @@ void GcodeSuite::M710() {
|
||||
if (seenD) controllerFan.settings.duration = parser.value_ushort();
|
||||
|
||||
if (!(seenR || seenS || seenI || seenA || seenD))
|
||||
M710_report(false);
|
||||
M710_report();
|
||||
}
|
||||
|
||||
#endif // CONTROLLER_FAN_EDITABLE
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "../../../feature/digipot/digipot.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#if HAS_MOTOR_CURRENT_DAC
|
||||
#include "../../../feature/dac/stepper_dac.h"
|
||||
#endif
|
||||
|
||||
@@ -73,7 +73,7 @@ void GcodeSuite::M907() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#if HAS_MOTOR_CURRENT_DAC
|
||||
if (parser.seenval('S')) {
|
||||
const float dac_percent = parser.value_float();
|
||||
LOOP_LE_N(i, 4) stepper_dac.set_current_percent(i, dac_percent);
|
||||
@@ -92,7 +92,7 @@ void GcodeSuite::M907() {
|
||||
TERN_(HAS_MOTOR_CURRENT_DAC, stepper_dac.set_current_value(parser.byteval('P', -1), parser.ushortval('S', 0)));
|
||||
}
|
||||
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#if HAS_MOTOR_CURRENT_DAC
|
||||
|
||||
void GcodeSuite::M909() { stepper_dac.print_values(); }
|
||||
void GcodeSuite::M910() { stepper_dac.commit_eeprom(); }
|
||||
|
||||
@@ -260,10 +260,10 @@
|
||||
#endif
|
||||
|
||||
case Z_AXIS:
|
||||
TERN_(Z_HAS_STEALTCHOP, if (index < 2) TMC_SET_PWMTHRS(Z,Z));
|
||||
TERN_(Z2_HAS_STEALTCHOP, if (index == 0 || index == 2) TMC_SET_PWMTHRS(Z,Z2));
|
||||
TERN_(Z3_HAS_STEALTCHOP, if (index == 0 || index == 3) TMC_SET_PWMTHRS(Z,Z3));
|
||||
TERN_(Z4_HAS_STEALTCHOP, if (index == 0 || index == 4) TMC_SET_PWMTHRS(Z,Z4));
|
||||
TERN_(Z_HAS_STEALTHCHOP, if (index < 2) TMC_SET_PWMTHRS(Z,Z));
|
||||
TERN_(Z2_HAS_STEALTHCHOP, if (index == 0 || index == 2) TMC_SET_PWMTHRS(Z,Z2));
|
||||
TERN_(Z3_HAS_STEALTHCHOP, if (index == 0 || index == 3) TMC_SET_PWMTHRS(Z,Z3));
|
||||
TERN_(Z4_HAS_STEALTHCHOP, if (index == 0 || index == 4) TMC_SET_PWMTHRS(Z,Z4));
|
||||
break;
|
||||
#if E_STEPPERS
|
||||
case E_AXIS: {
|
||||
|
||||
@@ -292,7 +292,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(FLOWMETER_SAFETY)
|
||||
if (cooler.fault) {
|
||||
if (cooler.flowfault) {
|
||||
SERIAL_ECHO_MSG(STR_FLOWMETER_FAULT);
|
||||
return;
|
||||
}
|
||||
@@ -908,7 +908,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes.
|
||||
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
|
||||
case 908: M908(); break; // M908: Control digital trimpot directly.
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#if HAS_MOTOR_CURRENT_DAC
|
||||
case 909: M909(); break; // M909: Print digipot/DAC current value
|
||||
case 910: M910(); break; // M910: Commit digipot/DAC value to external EEPROM
|
||||
#endif
|
||||
|
||||
+21
-21
@@ -525,7 +525,7 @@ private:
|
||||
static void G38(const int8_t subcode);
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_MESH)
|
||||
#if HAS_MESH
|
||||
static void G42();
|
||||
#endif
|
||||
|
||||
@@ -558,7 +558,7 @@ private:
|
||||
static void G425();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_RESUME_CONTINUE)
|
||||
#if HAS_RESUME_CONTINUE
|
||||
static void M0_M1();
|
||||
#endif
|
||||
|
||||
@@ -613,7 +613,7 @@ private:
|
||||
static void M31();
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#if ENABLED(HAS_MEDIA_SUBCALLS)
|
||||
#if HAS_MEDIA_SUBCALLS
|
||||
static void M32();
|
||||
#endif
|
||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
||||
@@ -744,7 +744,7 @@ private:
|
||||
static void M149();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_COLOR_LEDS)
|
||||
#if HAS_COLOR_LEDS
|
||||
static void M150();
|
||||
#endif
|
||||
|
||||
@@ -778,7 +778,7 @@ private:
|
||||
static void M204();
|
||||
static void M205();
|
||||
|
||||
#if ENABLED(HAS_M206_COMMAND)
|
||||
#if HAS_M206_COMMAND
|
||||
static void M206();
|
||||
#endif
|
||||
|
||||
@@ -792,11 +792,11 @@ private:
|
||||
|
||||
static void M211();
|
||||
|
||||
#if ENABLED(HAS_MULTI_EXTRUDER)
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
static void M217();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_HOTEND_OFFSET)
|
||||
#if HAS_HOTEND_OFFSET
|
||||
static void M218();
|
||||
#endif
|
||||
|
||||
@@ -814,7 +814,7 @@ private:
|
||||
static void M240();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_LCD_CONTRAST)
|
||||
#if HAS_LCD_CONTRAST
|
||||
static void M250();
|
||||
#endif
|
||||
|
||||
@@ -834,7 +834,7 @@ private:
|
||||
static void M290();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_BUZZER)
|
||||
#if HAS_BUZZER
|
||||
static void M300();
|
||||
#endif
|
||||
|
||||
@@ -846,7 +846,7 @@ private:
|
||||
static void M302();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_PID_HEATING)
|
||||
#if HAS_PID_HEATING
|
||||
static void M303();
|
||||
#endif
|
||||
|
||||
@@ -854,7 +854,7 @@ private:
|
||||
static void M304();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_USER_THERMISTORS)
|
||||
#if HAS_USER_THERMISTORS
|
||||
static void M305();
|
||||
#endif
|
||||
|
||||
@@ -895,7 +895,7 @@ private:
|
||||
static void M402();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_PRUSA_MMU2)
|
||||
#if HAS_PRUSA_MMU2
|
||||
static void M403();
|
||||
#endif
|
||||
|
||||
@@ -906,11 +906,11 @@ private:
|
||||
static void M407();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_FILAMENT_SENSOR)
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
static void M412();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_MULTI_LANGUAGE)
|
||||
#if HAS_MULTI_LANGUAGE
|
||||
static void M414();
|
||||
#endif
|
||||
|
||||
@@ -923,11 +923,11 @@ private:
|
||||
static void M425();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_M206_COMMAND)
|
||||
#if HAS_M206_COMMAND
|
||||
static void M428();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_POWER_MONITOR)
|
||||
#if HAS_POWER_MONITOR
|
||||
static void M430();
|
||||
#endif
|
||||
|
||||
@@ -978,11 +978,11 @@ private:
|
||||
static void M603();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_DUPLICATION_MODE)
|
||||
#if HAS_DUPLICATION_MODE
|
||||
static void M605();
|
||||
#endif
|
||||
|
||||
#if ENABLED(IS_KINEMATIC)
|
||||
#if IS_KINEMATIC
|
||||
static void M665();
|
||||
#endif
|
||||
|
||||
@@ -1007,7 +1007,7 @@ private:
|
||||
static void M810_819();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_BED_PROBE)
|
||||
#if HAS_BED_PROBE
|
||||
static void M851();
|
||||
#endif
|
||||
|
||||
@@ -1040,7 +1040,7 @@ private:
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
static void M122();
|
||||
static void M906();
|
||||
#if ENABLED(HAS_STEALTHCHOP)
|
||||
#if HAS_STEALTHCHOP
|
||||
static void M569();
|
||||
#endif
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
@@ -1067,7 +1067,7 @@ private:
|
||||
static void M907();
|
||||
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
|
||||
static void M908();
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#if HAS_MOTOR_CURRENT_DAC
|
||||
static void M909();
|
||||
static void M910();
|
||||
#endif
|
||||
|
||||
@@ -54,6 +54,9 @@ void GcodeSuite::M115() {
|
||||
"PROTOCOL_VERSION:" PROTOCOL_VERSION " "
|
||||
"MACHINE_TYPE:" MACHINE_NAME " "
|
||||
"EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " "
|
||||
#if LINEAR_AXES != XYZ
|
||||
"AXIS_COUNT:" STRINGIFY(LINEAR_AXES) " "
|
||||
#endif
|
||||
#ifdef MACHINE_UUID
|
||||
"UUID:" MACHINE_UUID
|
||||
#endif
|
||||
|
||||
@@ -83,12 +83,13 @@ void plan_arc(
|
||||
#endif
|
||||
|
||||
// Angle of rotation between position and target from the circle center.
|
||||
float angular_travel;
|
||||
float angular_travel, abs_angular_travel;
|
||||
|
||||
// Do a full circle if starting and ending positions are "identical"
|
||||
if (NEAR(current_position[p_axis], cart[p_axis]) && NEAR(current_position[q_axis], cart[q_axis])) {
|
||||
// Preserve direction for circles
|
||||
angular_travel = clockwise ? -RADIANS(360) : RADIANS(360);
|
||||
abs_angular_travel = RADIANS(360);
|
||||
}
|
||||
else {
|
||||
// Calculate the angle
|
||||
@@ -103,8 +104,10 @@ void plan_arc(
|
||||
case 2: angular_travel += RADIANS(360); break; // Negative but CCW? Reverse direction.
|
||||
}
|
||||
|
||||
abs_angular_travel = ABS(angular_travel);
|
||||
|
||||
#ifdef MIN_ARC_SEGMENTS
|
||||
min_segments = CEIL(min_segments * ABS(angular_travel) / RADIANS(360));
|
||||
min_segments = CEIL(min_segments * abs_angular_travel / RADIANS(360));
|
||||
NOLESS(min_segments, 1U);
|
||||
#endif
|
||||
}
|
||||
@@ -117,8 +120,8 @@ void plan_arc(
|
||||
#endif
|
||||
|
||||
// If circling around...
|
||||
if (ENABLED(ARC_P_CIRCLES) && circles) {
|
||||
const float total_angular = angular_travel + circles * RADIANS(360), // Total rotation with all circles and remainder
|
||||
if (TERN0(ARC_P_CIRCLES, circles)) {
|
||||
const float total_angular = abs_angular_travel + circles * RADIANS(360), // Total rotation with all circles and remainder
|
||||
part_per_circle = RADIANS(360) / total_angular; // Each circle's part of the total
|
||||
|
||||
#if HAS_Z_AXIS
|
||||
@@ -138,8 +141,8 @@ void plan_arc(
|
||||
TERN_(HAS_EXTRUDERS, extruder_travel = cart.e - current_position.e);
|
||||
}
|
||||
|
||||
const float flat_mm = radius * angular_travel,
|
||||
mm_of_travel = TERN_(HAS_Z_AXIS, linear_travel ? HYPOT(flat_mm, linear_travel) :) ABS(flat_mm);
|
||||
const float flat_mm = radius * abs_angular_travel,
|
||||
mm_of_travel = TERN_(HAS_Z_AXIS, linear_travel ? HYPOT(flat_mm, linear_travel) :) flat_mm;
|
||||
if (mm_of_travel < 0.001f) return;
|
||||
|
||||
const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
struct CommandLine {
|
||||
char buffer[MAX_CMD_SIZE]; //!< The command buffer
|
||||
bool skip_ok; //!< Skip sending ok when command is processed?
|
||||
#if ENABLED(HAS_MULTI_SERIAL)
|
||||
#if HAS_MULTI_SERIAL
|
||||
serial_index_t port; //!< Serial port the command was received on
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
#define MKS_MINI_12864
|
||||
#endif
|
||||
|
||||
// MKS_MINI_12864_V3 is simply identical to FYSETC_MINI_12864_2_1
|
||||
#if ENABLED(MKS_MINI_12864_V3)
|
||||
#define FYSETC_MINI_12864_2_1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* General Flags that may be set below by specific LCDs
|
||||
*
|
||||
@@ -208,7 +213,7 @@
|
||||
#define LCD_PROGRESS_BAR
|
||||
#endif
|
||||
#if ENABLED(TFTGLCD_PANEL_I2C)
|
||||
#define LCD_I2C_ADDRESS 0x27 // Must be equal to panel's I2C slave addres
|
||||
#define LCD_I2C_ADDRESS 0x33 // Must be 0x33 for STM32 main boards and equal to panel's I2C slave addres
|
||||
#endif
|
||||
#define LCD_USE_I2C_BUZZER // Enable buzzer on LCD, used for both I2C and SPI buses (LiquidTWI2 not required)
|
||||
#define STD_ENCODER_PULSES_PER_STEP 2
|
||||
|
||||
@@ -112,17 +112,419 @@
|
||||
#undef STEALTHCHOP_E
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_BED == 0
|
||||
/**
|
||||
* Temperature Sensors; define what sensor(s) we have.
|
||||
*/
|
||||
|
||||
// Temperature sensor IDs
|
||||
#define HID_REDUNDANT -6
|
||||
#define HID_COOLER -5
|
||||
#define HID_PROBE -4
|
||||
#define HID_BOARD -3
|
||||
#define HID_CHAMBER -2
|
||||
#define HID_BED -1
|
||||
#define HID_E0 0
|
||||
#define HID_E1 1
|
||||
#define HID_E2 2
|
||||
#define HID_E3 3
|
||||
#define HID_E4 4
|
||||
#define HID_E5 5
|
||||
#define HID_E6 6
|
||||
#define HID_E7 7
|
||||
|
||||
#define ANY_TEMP_SENSOR_IS(n) (n == TEMP_SENSOR_0 || n == TEMP_SENSOR_1 || n == TEMP_SENSOR_2 || n == TEMP_SENSOR_3 \
|
||||
|| n == TEMP_SENSOR_4 || n == TEMP_SENSOR_5 || n == TEMP_SENSOR_6 || n == TEMP_SENSOR_7 \
|
||||
|| n == TEMP_SENSOR_BED \
|
||||
|| n == TEMP_SENSOR_PROBE \
|
||||
|| n == TEMP_SENSOR_CHAMBER \
|
||||
|| n == TEMP_SENSOR_COOLER \
|
||||
|| n == TEMP_SENSOR_REDUNDANT )
|
||||
#if ANY_TEMP_SENSOR_IS(1000)
|
||||
#define HAS_USER_THERMISTORS 1
|
||||
#endif
|
||||
#undef ANY_TEMP_SENSOR_IS
|
||||
|
||||
#if TEMP_SENSOR_REDUNDANT
|
||||
#define _HEATER_ID(M) HID_##M
|
||||
#define HEATER_ID(M) _HEATER_ID(M)
|
||||
#define REDUNDANT_TEMP_MATCH(M,N) (HEATER_ID(TEMP_SENSOR_REDUNDANT_##M) == _HEATER_ID(N))
|
||||
#else
|
||||
#define REDUNDANT_TEMP_MATCH(...) 0
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
|
||||
#define TEMP_SENSOR_0_IS_MAX_TC 1
|
||||
#if TEMP_SENSOR_0 == -5
|
||||
#define TEMP_SENSOR_0_IS_MAX31865 1
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
|
||||
#ifndef MAX31865_SENSOR_WIRES_0
|
||||
#define MAX31865_SENSOR_WIRES_0 2
|
||||
#endif
|
||||
#elif TEMP_SENSOR_0 == -3
|
||||
#define TEMP_SENSOR_0_IS_MAX31855 1
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMIN -270
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMAX 1800
|
||||
#elif TEMP_SENSOR_0 == -2
|
||||
#define TEMP_SENSOR_0_IS_MAX6675 1
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
|
||||
#endif
|
||||
#elif TEMP_SENSOR_0 == -4
|
||||
#define TEMP_SENSOR_0_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_0 == -1
|
||||
#define TEMP_SENSOR_0_IS_AD595 1
|
||||
#elif TEMP_SENSOR_0 > 0
|
||||
#define TEMP_SENSOR_0_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_0 == 1000
|
||||
#define TEMP_SENSOR_0_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999
|
||||
#define TEMP_SENSOR_0_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_0_MINTEMP
|
||||
#undef HEATER_0_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
|
||||
#define TEMP_SENSOR_1_IS_MAX_TC 1
|
||||
#if TEMP_SENSOR_1 == -5
|
||||
#define TEMP_SENSOR_1_IS_MAX31865 1
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMAX 1024
|
||||
#ifndef MAX31865_SENSOR_WIRES_1
|
||||
#define MAX31865_SENSOR_WIRES_1 2
|
||||
#endif
|
||||
#elif TEMP_SENSOR_1 == -3
|
||||
#define TEMP_SENSOR_1_IS_MAX31855 1
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMIN -270
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMAX 1800
|
||||
#elif TEMP_SENSOR_1 == -2
|
||||
#define TEMP_SENSOR_1_IS_MAX6675 1
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMAX 1024
|
||||
#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."
|
||||
#elif TEMP_SENSOR_1 == -3
|
||||
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
|
||||
#elif TEMP_SENSOR_1 == -2
|
||||
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
|
||||
#endif
|
||||
#endif
|
||||
#elif TEMP_SENSOR_1 == -4
|
||||
#define TEMP_SENSOR_1_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_1 == -1
|
||||
#define TEMP_SENSOR_1_IS_AD595 1
|
||||
#elif TEMP_SENSOR_1 > 0
|
||||
#define TEMP_SENSOR_1_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_1 == 1000
|
||||
#define TEMP_SENSOR_1_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999
|
||||
#define TEMP_SENSOR_1_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_1_MINTEMP
|
||||
#undef HEATER_1_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
|
||||
|
||||
#if TEMP_SENSOR_REDUNDANT == -5
|
||||
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
|
||||
#error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
||||
#endif
|
||||
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX31865 1
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
|
||||
#elif TEMP_SENSOR_REDUNDANT == -3
|
||||
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
||||
#endif
|
||||
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX31855 1
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800
|
||||
#elif TEMP_SENSOR_REDUNDANT == -2
|
||||
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
||||
#endif
|
||||
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
|
||||
#endif
|
||||
|
||||
// mimic setting up the source TEMP_SENSOR
|
||||
#if REDUNDANT_TEMP_MATCH(SOURCE, E0)
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
|
||||
#ifndef MAX31865_SENSOR_WIRES_0
|
||||
#define MAX31865_SENSOR_WIRES_0 2
|
||||
#endif
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, E1)
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
|
||||
#ifndef MAX31865_SENSOR_WIRES_1
|
||||
#define MAX31865_SENSOR_WIRES_1 2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (TEMP_SENSOR_0_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_1_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1)
|
||||
#if TEMP_SENSOR_REDUNDANT == -5
|
||||
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
|
||||
#elif TEMP_SENSOR_REDUNDANT == -3
|
||||
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
|
||||
#elif TEMP_SENSOR_REDUNDANT == -2
|
||||
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
|
||||
#endif
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT == -4
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_REDUNDANT == -1
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_AD595 1
|
||||
#elif TEMP_SENSOR_REDUNDANT > 0
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_REDUNDANT == 1000
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_REDUNDANT == 998 || TEMP_SENSOR_REDUNDANT == 999
|
||||
#error "Dummy sensors are not supported for TEMP_SENSOR_REDUNDANT."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC || TEMP_SENSOR_REDUNDANT_IS_MAX_TC
|
||||
#define HAS_MAX_TC 1
|
||||
#endif
|
||||
#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
|
||||
#define HAS_MAX6675 1
|
||||
#endif
|
||||
#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
|
||||
#define HAS_MAX31855 1
|
||||
#endif
|
||||
#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
|
||||
#define HAS_MAX31865 1
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_2 == -4
|
||||
#define TEMP_SENSOR_2_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_2 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2."
|
||||
#elif TEMP_SENSOR_2 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2."
|
||||
#elif TEMP_SENSOR_2 == -1
|
||||
#define TEMP_SENSOR_2_IS_AD595 1
|
||||
#elif TEMP_SENSOR_2 > 0
|
||||
#define TEMP_SENSOR_2_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_2 == 1000
|
||||
#define TEMP_SENSOR_2_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999
|
||||
#define TEMP_SENSOR_2_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_2_MINTEMP
|
||||
#undef HEATER_2_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_3 == -4
|
||||
#define TEMP_SENSOR_3_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_3 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
|
||||
#elif TEMP_SENSOR_3 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3."
|
||||
#elif TEMP_SENSOR_3 == -1
|
||||
#define TEMP_SENSOR_3_IS_AD595 1
|
||||
#elif TEMP_SENSOR_3 > 0
|
||||
#define TEMP_SENSOR_3_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_3 == 1000
|
||||
#define TEMP_SENSOR_3_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999
|
||||
#define TEMP_SENSOR_3_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_3_MINTEMP
|
||||
#undef HEATER_3_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_4 == -4
|
||||
#define TEMP_SENSOR_4_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_4 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
|
||||
#elif TEMP_SENSOR_4 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4."
|
||||
#elif TEMP_SENSOR_4 == -1
|
||||
#define TEMP_SENSOR_4_IS_AD595 1
|
||||
#elif TEMP_SENSOR_4 > 0
|
||||
#define TEMP_SENSOR_4_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_4 == 1000
|
||||
#define TEMP_SENSOR_4_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999
|
||||
#define TEMP_SENSOR_4_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_4_MINTEMP
|
||||
#undef HEATER_4_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_5 == -4
|
||||
#define TEMP_SENSOR_5_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_5 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
|
||||
#elif TEMP_SENSOR_5 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5."
|
||||
#elif TEMP_SENSOR_5 == -1
|
||||
#define TEMP_SENSOR_5_IS_AD595 1
|
||||
#elif TEMP_SENSOR_5 > 0
|
||||
#define TEMP_SENSOR_5_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_5 == 1000
|
||||
#define TEMP_SENSOR_5_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999
|
||||
#define TEMP_SENSOR_5_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_5_MINTEMP
|
||||
#undef HEATER_5_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_6 == -4
|
||||
#define TEMP_SENSOR_6_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_6 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
|
||||
#elif TEMP_SENSOR_6 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6."
|
||||
#elif TEMP_SENSOR_6 == -1
|
||||
#define TEMP_SENSOR_6_IS_AD595 1
|
||||
#elif TEMP_SENSOR_6 > 0
|
||||
#define TEMP_SENSOR_6_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_6 == 1000
|
||||
#define TEMP_SENSOR_6_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999
|
||||
#define TEMP_SENSOR_6_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_6_MINTEMP
|
||||
#undef HEATER_6_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_7 == -4
|
||||
#define TEMP_SENSOR_7_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_7 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
|
||||
#elif TEMP_SENSOR_7 == -2
|
||||
#error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7."
|
||||
#elif TEMP_SENSOR_7 == -1
|
||||
#define TEMP_SENSOR_7_IS_AD595 1
|
||||
#elif TEMP_SENSOR_7 > 0
|
||||
#define TEMP_SENSOR_7_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_7 == 1000
|
||||
#define TEMP_SENSOR_7_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999
|
||||
#define TEMP_SENSOR_7_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_7_MINTEMP
|
||||
#undef HEATER_7_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_BED == -4
|
||||
#define TEMP_SENSOR_BED_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_BED == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
|
||||
#elif TEMP_SENSOR_BED == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED."
|
||||
#elif TEMP_SENSOR_BED == -1
|
||||
#define TEMP_SENSOR_BED_IS_AD595 1
|
||||
#elif TEMP_SENSOR_BED > 0
|
||||
#define TEMP_SENSOR_BED_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_BED == 1000
|
||||
#define TEMP_SENSOR_BED_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_BED == 998 || TEMP_SENSOR_BED == 999
|
||||
#define TEMP_SENSOR_BED_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef THERMAL_PROTECTION_BED
|
||||
#undef THERMAL_PROTECTION_BED_PERIOD
|
||||
#undef BED_MINTEMP
|
||||
#undef BED_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_CHAMBER == 0
|
||||
#if TEMP_SENSOR_CHAMBER == -4
|
||||
#define TEMP_SENSOR_CHAMBER_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_CHAMBER == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
|
||||
#elif TEMP_SENSOR_CHAMBER == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER."
|
||||
#elif TEMP_SENSOR_CHAMBER == -1
|
||||
#define TEMP_SENSOR_CHAMBER_IS_AD595 1
|
||||
#elif TEMP_SENSOR_CHAMBER > 0
|
||||
#define TEMP_SENSOR_CHAMBER_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_CHAMBER == 1000
|
||||
#define TEMP_SENSOR_CHAMBER_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_CHAMBER == 998 || TEMP_SENSOR_CHAMBER == 999
|
||||
#define TEMP_SENSOR_CHAMBER_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef THERMAL_PROTECTION_CHAMBER
|
||||
#undef CHAMBER_MINTEMP
|
||||
#undef CHAMBER_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_COOLER == 0
|
||||
#if TEMP_SENSOR_COOLER == -4
|
||||
#define TEMP_SENSOR_COOLER_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_COOLER == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_COOLER."
|
||||
#elif TEMP_SENSOR_COOLER == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_COOLER."
|
||||
#elif TEMP_SENSOR_COOLER == -1
|
||||
#define TEMP_SENSOR_COOLER_IS_AD595 1
|
||||
#elif TEMP_SENSOR_COOLER > 0
|
||||
#define TEMP_SENSOR_COOLER_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_COOLER == 1000
|
||||
#define TEMP_SENSOR_COOLER_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_COOLER == 998 || TEMP_SENSOR_COOLER == 999
|
||||
#define TEMP_SENSOR_COOLER_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef THERMAL_PROTECTION_COOLER
|
||||
#undef COOLER_MINTEMP
|
||||
#undef COOLER_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_PROBE == -4
|
||||
#define TEMP_SENSOR_PROBE_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_PROBE == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
|
||||
#elif TEMP_SENSOR_PROBE == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
|
||||
#elif TEMP_SENSOR_PROBE == -1
|
||||
#define TEMP_SENSOR_PROBE_IS_AD595 1
|
||||
#elif TEMP_SENSOR_PROBE > 0
|
||||
#define TEMP_SENSOR_PROBE_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_PROBE == 1000
|
||||
#define TEMP_SENSOR_PROBE_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_PROBE == 998 || TEMP_SENSOR_PROBE == 999
|
||||
#define TEMP_SENSOR_PROBE_IS_DUMMY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_BOARD == -4
|
||||
#define TEMP_SENSOR_BOARD_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_BOARD == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BOARD."
|
||||
#elif TEMP_SENSOR_BOARD == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BOARD."
|
||||
#elif TEMP_SENSOR_BOARD == -1
|
||||
#define TEMP_SENSOR_BOARD_IS_AD595 1
|
||||
#elif TEMP_SENSOR_BOARD > 0
|
||||
#define TEMP_SENSOR_BOARD_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_BOARD == 1000
|
||||
#define TEMP_SENSOR_BOARD_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_BOARD == 998 || TEMP_SENSOR_BOARD == 999
|
||||
#define TEMP_SENSOR_BOARD_IS_DUMMY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || BOTH(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS))
|
||||
|
||||
@@ -369,6 +369,10 @@
|
||||
#elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
|
||||
#define _LCD_CONTRAST_MIN 120
|
||||
#define _LCD_CONTRAST_INIT 195
|
||||
#elif ENABLED(MKS_MINI_12864_V3)
|
||||
#define _LCD_CONTRAST_MIN 255
|
||||
#define _LCD_CONTRAST_INIT 255
|
||||
#define _LCD_CONTRAST_MAX 255
|
||||
#elif ENABLED(FYSETC_MINI_12864)
|
||||
#define _LCD_CONTRAST_INIT 220
|
||||
#elif ENABLED(ULTI_CONTROLLER)
|
||||
@@ -509,103 +513,90 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Temp Sensor defines
|
||||
* Temp Sensor defines; set up pins as needed.
|
||||
*/
|
||||
|
||||
#define ANY_TEMP_SENSOR_IS(n) ( \
|
||||
n == TEMP_SENSOR_0 || n == TEMP_SENSOR_1 || n == TEMP_SENSOR_2 || n == TEMP_SENSOR_3 \
|
||||
|| n == TEMP_SENSOR_4 || n == TEMP_SENSOR_5 || n == TEMP_SENSOR_6 || n == TEMP_SENSOR_7 \
|
||||
|| n == TEMP_SENSOR_BED \
|
||||
|| n == TEMP_SENSOR_PROBE \
|
||||
|| n == TEMP_SENSOR_CHAMBER \
|
||||
|| n == TEMP_SENSOR_COOLER \
|
||||
|| n == TEMP_SENSOR_REDUNDANT )
|
||||
#if ANY_TEMP_SENSOR_IS(1000)
|
||||
#define HAS_USER_THERMISTORS 1
|
||||
#endif
|
||||
#undef ANY_TEMP_SENSOR_IS
|
||||
|
||||
// Usurp a sensor to do redundant readings
|
||||
#if TEMP_SENSOR_REDUNDANT
|
||||
#ifndef TEMP_SENSOR_REDUNDANT_SOURCE
|
||||
#define TEMP_SENSOR_REDUNDANT_SOURCE 1
|
||||
#define TEMP_SENSOR_REDUNDANT_SOURCE E1
|
||||
#endif
|
||||
#ifndef TEMP_SENSOR_REDUNDANT_TARGET
|
||||
#define TEMP_SENSOR_REDUNDANT_TARGET 0
|
||||
#define TEMP_SENSOR_REDUNDANT_TARGET E0
|
||||
#endif
|
||||
#if !PIN_EXISTS(TEMP_REDUNDANT)
|
||||
#ifndef TEMP_SENSOR_REDUNDANT_MAX_DIFF
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_DIFF 10
|
||||
#endif
|
||||
#if TEMP_SENSOR_REDUNDANT_SOURCE == -5
|
||||
#if REDUNDANT_TEMP_MATCH(SOURCE, COOLER)
|
||||
#if !PIN_EXISTS(TEMP_COOLER)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to COOLER requires TEMP_COOLER_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_COOLER_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -4
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, PROBE)
|
||||
#if !PIN_EXISTS(TEMP_PROBE)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to PROBE requires TEMP_PROBE_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_PROBE_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -2
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, CHAMBER)
|
||||
#if !PIN_EXISTS(TEMP_CHAMBER)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to CHAMBER requires TEMP_CHAMBER_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_CHAMBER_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -1
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, BED)
|
||||
#if !PIN_EXISTS(TEMP_BED)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to BED requires TEMP_BED_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_BED_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 0
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, E0)
|
||||
#if !PIN_EXISTS(TEMP_0)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 0 requires TEMP_0_PIN."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E0 requires TEMP_0_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_0_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 1
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, E1)
|
||||
#if !PIN_EXISTS(TEMP_1)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 1 requires TEMP_1_PIN."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E1 requires TEMP_1_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_1_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 2
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, E2)
|
||||
#if !PIN_EXISTS(TEMP_2)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 2 requires TEMP_2_PIN."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E2 requires TEMP_2_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_2_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 3
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, E3)
|
||||
#if !PIN_EXISTS(TEMP_3)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 3 requires TEMP_3_PIN."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E3 requires TEMP_3_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_3_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 4
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, E4)
|
||||
#if !PIN_EXISTS(TEMP_4)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 4 requires TEMP_4_PIN."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E4 requires TEMP_4_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_4_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 5
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, E5)
|
||||
#if !PIN_EXISTS(TEMP_5)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 5 requires TEMP_5_PIN."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E5 requires TEMP_5_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_5_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 6
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, E6)
|
||||
#if !PIN_EXISTS(TEMP_6)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 6 requires TEMP_6_PIN."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E6 requires TEMP_6_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_6_PIN
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 7
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, E7)
|
||||
#if !PIN_EXISTS(TEMP_7)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 7 requires TEMP_7_PIN."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E7 requires TEMP_7_PIN."
|
||||
#else
|
||||
#define TEMP_REDUNDANT_PIN TEMP_7_PIN
|
||||
#endif
|
||||
@@ -613,170 +604,13 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
|
||||
#define TEMP_SENSOR_0_IS_MAX_TC 1
|
||||
#if TEMP_SENSOR_0 == -5
|
||||
#define TEMP_SENSOR_0_IS_MAX31865 1
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
|
||||
#ifndef MAX31865_SENSOR_WIRES_0
|
||||
#define MAX31865_SENSOR_WIRES_0 2
|
||||
#endif
|
||||
#elif TEMP_SENSOR_0 == -3
|
||||
#define TEMP_SENSOR_0_IS_MAX31855 1
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMIN -270
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMAX 1800
|
||||
#elif TEMP_SENSOR_0 == -2
|
||||
#define TEMP_SENSOR_0_IS_MAX6675 1
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
|
||||
#endif
|
||||
#elif TEMP_SENSOR_0 == -4
|
||||
#define TEMP_SENSOR_0_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_0 == -1
|
||||
#define TEMP_SENSOR_0_IS_AD595 1
|
||||
#elif TEMP_SENSOR_0 > 0
|
||||
#define TEMP_SENSOR_0_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_0 == 1000
|
||||
#define TEMP_SENSOR_0_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999
|
||||
#define TEMP_SENSOR_0_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_0_MINTEMP
|
||||
#undef HEATER_0_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
|
||||
#define TEMP_SENSOR_1_IS_MAX_TC 1
|
||||
#if TEMP_SENSOR_1 == -5
|
||||
#define TEMP_SENSOR_1_IS_MAX31865 1
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMAX 1024
|
||||
#ifndef MAX31865_SENSOR_WIRES_1
|
||||
#define MAX31865_SENSOR_WIRES_1 2
|
||||
#endif
|
||||
#elif TEMP_SENSOR_1 == -3
|
||||
#define TEMP_SENSOR_1_IS_MAX31855 1
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMIN -270
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMAX 1800
|
||||
#elif TEMP_SENSOR_1 == -2
|
||||
#define TEMP_SENSOR_1_IS_MAX6675 1
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMAX 1024
|
||||
#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."
|
||||
#elif TEMP_SENSOR_1 == -3
|
||||
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
|
||||
#elif TEMP_SENSOR_1 == -2
|
||||
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
|
||||
#endif
|
||||
#endif
|
||||
#elif TEMP_SENSOR_1 == -4
|
||||
#define TEMP_SENSOR_1_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_1 == -1
|
||||
#define TEMP_SENSOR_1_IS_AD595 1
|
||||
#elif TEMP_SENSOR_1 > 0
|
||||
#define TEMP_SENSOR_1_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_1 == 1000
|
||||
#define TEMP_SENSOR_1_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999
|
||||
#define TEMP_SENSOR_1_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_1_MINTEMP
|
||||
#undef HEATER_1_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
|
||||
|
||||
#if TEMP_SENSOR_REDUNDANT == -5
|
||||
#if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
|
||||
#error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
||||
#endif
|
||||
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX31865 1
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
|
||||
#elif TEMP_SENSOR_REDUNDANT == -3
|
||||
#if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
||||
#endif
|
||||
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX31855 1
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800
|
||||
#elif TEMP_SENSOR_REDUNDANT == -2
|
||||
#if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
||||
#endif
|
||||
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
|
||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
|
||||
#endif
|
||||
|
||||
// mimic setting up the source TEMP_SENSOR
|
||||
#if TEMP_SENSOR_REDUNDANT_SOURCE == 0
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
|
||||
#define TEMP_SENSOR_0_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
|
||||
#ifndef MAX31865_SENSOR_WIRES_0
|
||||
#define MAX31865_SENSOR_WIRES_0 2
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 1
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
|
||||
#define TEMP_SENSOR_1_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
|
||||
#ifndef MAX31865_SENSOR_WIRES_1
|
||||
#define MAX31865_SENSOR_WIRES_1 2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (TEMP_SENSOR_0_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_1_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1)
|
||||
#if TEMP_SENSOR_REDUNDANT == -5
|
||||
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
|
||||
#elif TEMP_SENSOR_REDUNDANT == -3
|
||||
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
|
||||
#elif TEMP_SENSOR_REDUNDANT == -2
|
||||
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
|
||||
#endif
|
||||
#endif
|
||||
#elif TEMP_SENSOR_REDUNDANT == -4
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_REDUNDANT == -1
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_AD595 1
|
||||
#elif TEMP_SENSOR_REDUNDANT > 0
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_REDUNDANT == 1000
|
||||
#define TEMP_SENSOR_REDUNDANT_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_REDUNDANT == 998 || TEMP_SENSOR_REDUNDANT == 999
|
||||
#error "Dummy sensors are not supported for TEMP_SENSOR_REDUNDANT."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC || TEMP_SENSOR_REDUNDANT_IS_MAX_TC
|
||||
#define HAS_MAX_TC 1
|
||||
#endif
|
||||
#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
|
||||
#define HAS_MAX6675 1
|
||||
#endif
|
||||
#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
|
||||
#define HAS_MAX31855 1
|
||||
#endif
|
||||
#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
|
||||
#define HAS_MAX31865 1
|
||||
#endif
|
||||
|
||||
//
|
||||
// Compatibility layer for MAX (SPI) temp boards
|
||||
//
|
||||
/**
|
||||
* Compatibility layer for MAX (SPI) temp boards
|
||||
*/
|
||||
#if HAS_MAX_TC
|
||||
|
||||
// Translate old _SS, _CS, _SCK, _DO, _DI, _MISO, and _MOSI PIN defines.
|
||||
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
|
||||
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1))
|
||||
|
||||
#if !PIN_EXISTS(TEMP_0_CS) // SS, CS
|
||||
#if PIN_EXISTS(MAX6675_SS)
|
||||
@@ -845,7 +679,7 @@
|
||||
|
||||
#endif // TEMP_SENSOR_0_IS_MAX_TC
|
||||
|
||||
#if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
|
||||
#if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1))
|
||||
|
||||
#if !PIN_EXISTS(TEMP_1_CS) // SS2, CS2
|
||||
#if PIN_EXISTS(MAX6675_SS2)
|
||||
@@ -934,203 +768,6 @@
|
||||
|
||||
#endif //HAS_MAX_TC
|
||||
|
||||
#if TEMP_SENSOR_2 == -4
|
||||
#define TEMP_SENSOR_2_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_2 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2."
|
||||
#elif TEMP_SENSOR_2 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2."
|
||||
#elif TEMP_SENSOR_2 == -1
|
||||
#define TEMP_SENSOR_2_IS_AD595 1
|
||||
#elif TEMP_SENSOR_2 > 0
|
||||
#define TEMP_SENSOR_2_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_2 == 1000
|
||||
#define TEMP_SENSOR_2_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999
|
||||
#define TEMP_SENSOR_2_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_2_MINTEMP
|
||||
#undef HEATER_2_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_3 == -4
|
||||
#define TEMP_SENSOR_3_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_3 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
|
||||
#elif TEMP_SENSOR_3 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3."
|
||||
#elif TEMP_SENSOR_3 == -1
|
||||
#define TEMP_SENSOR_3_IS_AD595 1
|
||||
#elif TEMP_SENSOR_3 > 0
|
||||
#define TEMP_SENSOR_3_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_3 == 1000
|
||||
#define TEMP_SENSOR_3_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999
|
||||
#define TEMP_SENSOR_3_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_3_MINTEMP
|
||||
#undef HEATER_3_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_4 == -4
|
||||
#define TEMP_SENSOR_4_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_4 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
|
||||
#elif TEMP_SENSOR_4 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4."
|
||||
#elif TEMP_SENSOR_4 == -1
|
||||
#define TEMP_SENSOR_4_IS_AD595 1
|
||||
#elif TEMP_SENSOR_4 > 0
|
||||
#define TEMP_SENSOR_4_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_4 == 1000
|
||||
#define TEMP_SENSOR_4_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999
|
||||
#define TEMP_SENSOR_4_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_4_MINTEMP
|
||||
#undef HEATER_4_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_5 == -4
|
||||
#define TEMP_SENSOR_5_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_5 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
|
||||
#elif TEMP_SENSOR_5 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5."
|
||||
#elif TEMP_SENSOR_5 == -1
|
||||
#define TEMP_SENSOR_5_IS_AD595 1
|
||||
#elif TEMP_SENSOR_5 > 0
|
||||
#define TEMP_SENSOR_5_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_5 == 1000
|
||||
#define TEMP_SENSOR_5_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999
|
||||
#define TEMP_SENSOR_5_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_5_MINTEMP
|
||||
#undef HEATER_5_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_6 == -4
|
||||
#define TEMP_SENSOR_6_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_6 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
|
||||
#elif TEMP_SENSOR_6 == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6."
|
||||
#elif TEMP_SENSOR_6 == -1
|
||||
#define TEMP_SENSOR_6_IS_AD595 1
|
||||
#elif TEMP_SENSOR_6 > 0
|
||||
#define TEMP_SENSOR_6_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_6 == 1000
|
||||
#define TEMP_SENSOR_6_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999
|
||||
#define TEMP_SENSOR_6_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_6_MINTEMP
|
||||
#undef HEATER_6_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_7 == -4
|
||||
#define TEMP_SENSOR_7_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_7 == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
|
||||
#elif TEMP_SENSOR_7 == -2
|
||||
#error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7."
|
||||
#elif TEMP_SENSOR_7 == -1
|
||||
#define TEMP_SENSOR_7_IS_AD595 1
|
||||
#elif TEMP_SENSOR_7 > 0
|
||||
#define TEMP_SENSOR_7_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_7 == 1000
|
||||
#define TEMP_SENSOR_7_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999
|
||||
#define TEMP_SENSOR_7_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef HEATER_7_MINTEMP
|
||||
#undef HEATER_7_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_BED == -4
|
||||
#define TEMP_SENSOR_BED_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_BED == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
|
||||
#elif TEMP_SENSOR_BED == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED."
|
||||
#elif TEMP_SENSOR_BED == -1
|
||||
#define TEMP_SENSOR_BED_IS_AD595 1
|
||||
#elif TEMP_SENSOR_BED > 0
|
||||
#define TEMP_SENSOR_BED_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_BED == 1000
|
||||
#define TEMP_SENSOR_BED_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_BED == 998 || TEMP_SENSOR_BED == 999
|
||||
#define TEMP_SENSOR_BED_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef BED_MINTEMP
|
||||
#undef BED_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_CHAMBER == -4
|
||||
#define TEMP_SENSOR_CHAMBER_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_CHAMBER == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
|
||||
#elif TEMP_SENSOR_CHAMBER == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER."
|
||||
#elif TEMP_SENSOR_CHAMBER == -1
|
||||
#define TEMP_SENSOR_CHAMBER_IS_AD595 1
|
||||
#elif TEMP_SENSOR_CHAMBER > 0
|
||||
#define TEMP_SENSOR_CHAMBER_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_CHAMBER == 1000
|
||||
#define TEMP_SENSOR_CHAMBER_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_CHAMBER == 998 || TEMP_SENSOR_CHAMBER == 999
|
||||
#define TEMP_SENSOR_CHAMBER_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef CHAMBER_MINTEMP
|
||||
#undef CHAMBER_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_COOLER == -4
|
||||
#define TEMP_SENSOR_COOLER_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_COOLER == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_COOLER."
|
||||
#elif TEMP_SENSOR_COOLER == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_COOLER."
|
||||
#elif TEMP_SENSOR_COOLER == -1
|
||||
#define TEMP_SENSOR_COOLER_IS_AD595 1
|
||||
#elif TEMP_SENSOR_COOLER > 0
|
||||
#define TEMP_SENSOR_COOLER_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_COOLER == 1000
|
||||
#define TEMP_SENSOR_COOLER_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_COOLER == 998 || TEMP_SENSOR_COOLER == 999
|
||||
#define TEMP_SENSOR_COOLER_IS_DUMMY 1
|
||||
#endif
|
||||
#else
|
||||
#undef COOLER_MINTEMP
|
||||
#undef COOLER_MAXTEMP
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_PROBE == -4
|
||||
#define TEMP_SENSOR_PROBE_IS_AD8495 1
|
||||
#elif TEMP_SENSOR_PROBE == -3
|
||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
|
||||
#elif TEMP_SENSOR_PROBE == -2
|
||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
|
||||
#elif TEMP_SENSOR_PROBE == -1
|
||||
#define TEMP_SENSOR_PROBE_IS_AD595 1
|
||||
#elif TEMP_SENSOR_PROBE > 0
|
||||
#define TEMP_SENSOR_PROBE_IS_THERMISTOR 1
|
||||
#if TEMP_SENSOR_PROBE == 1000
|
||||
#define TEMP_SENSOR_PROBE_IS_CUSTOM 1
|
||||
#elif TEMP_SENSOR_PROBE == 998 || TEMP_SENSOR_PROBE == 999
|
||||
#define TEMP_SENSOR_PROBE_IS_DUMMY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X_DUAL_ENDSTOPS endstop reassignment
|
||||
*/
|
||||
@@ -2580,6 +2217,9 @@
|
||||
#if HAS_ADC_TEST(COOLER)
|
||||
#define HAS_TEMP_ADC_COOLER 1
|
||||
#endif
|
||||
#if HAS_ADC_TEST(BOARD)
|
||||
#define HAS_TEMP_ADC_BOARD 1
|
||||
#endif
|
||||
#if HAS_ADC_TEST(REDUNDANT)
|
||||
#define HAS_TEMP_ADC_REDUNDANT 1
|
||||
#endif
|
||||
@@ -2600,6 +2240,9 @@
|
||||
#if HAS_TEMP(COOLER)
|
||||
#define HAS_TEMP_COOLER 1
|
||||
#endif
|
||||
#if HAS_TEMP(BOARD)
|
||||
#define HAS_TEMP_BOARD 1
|
||||
#endif
|
||||
#if HAS_TEMP(REDUNDANT)
|
||||
#define HAS_TEMP_REDUNDANT 1
|
||||
#endif
|
||||
@@ -2671,7 +2314,8 @@
|
||||
#if HAS_HEATED_BED || HAS_TEMP_CHAMBER
|
||||
#define BED_OR_CHAMBER 1
|
||||
#endif
|
||||
#if HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER
|
||||
|
||||
#if HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER || HAS_TEMP_BOARD
|
||||
#define HAS_TEMP_SENSOR 1
|
||||
#endif
|
||||
|
||||
@@ -2809,9 +2453,6 @@
|
||||
#endif
|
||||
#undef _NOT_E_AUTO
|
||||
#undef _HAS_FAN
|
||||
#if PIN_EXISTS(CONTROLLER_FAN)
|
||||
#define HAS_CONTROLLER_FAN 1
|
||||
#endif
|
||||
|
||||
#if BED_OR_CHAMBER || HAS_FAN0
|
||||
#define BED_OR_CHAMBER_OR_FAN 1
|
||||
@@ -2888,6 +2529,27 @@
|
||||
#define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1)) // Fan frequency default
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Controller Fan Settings
|
||||
*/
|
||||
#if PIN_EXISTS(CONTROLLER_FAN)
|
||||
#define HAS_CONTROLLER_FAN 1
|
||||
#if CONTROLLER_FAN_MIN_BOARD_TEMP
|
||||
#define HAS_CONTROLLER_FAN_MIN_BOARD_TEMP 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_CONTROLLER_FAN
|
||||
#if ENABLED(CONTROLLER_FAN_USE_BOARD_TEMP)
|
||||
#define HAS_CONTROLLER_FAN_BOARD_TEMP_TRIGGER 1
|
||||
#ifndef CONTROLLER_FAN_TRIGGER_TEMP
|
||||
#define CONTROLLER_FAN_TRIGGER_TEMP 30
|
||||
#endif
|
||||
#else
|
||||
#undef CONTROLLER_FAN_TRIGGER_TEMP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Servos
|
||||
#if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0
|
||||
#define HAS_SERVO_0 1
|
||||
@@ -3262,7 +2924,7 @@
|
||||
* Advanced Pause - Filament Change
|
||||
*/
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
#if HAS_LCD_MENU || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) || ENABLED(EXTENSIBLE_UI)
|
||||
#if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
|
||||
#define M600_PURGE_MORE_RESUMABLE 1
|
||||
#endif
|
||||
#ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH
|
||||
|
||||
@@ -583,6 +583,10 @@
|
||||
#error "TEMP_SENSOR_1_AS_REDUNDANT is now TEMP_SENSOR_REDUNDANT, with associated TEMP_SENSOR_REDUNDANT_* config."
|
||||
#elif defined(MAX_REDUNDANT_TEMP_SENSOR_DIFF)
|
||||
#error "MAX_REDUNDANT_TEMP_SENSOR_DIFF is now TEMP_SENSOR_REDUNDANT_MAX_DIFF"
|
||||
#elif MOTHERBOARD == BOARD_DUE3DOM_MINI && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
|
||||
#warning "Onboard temperature sensor for BOARD_DUE3DOM_MINI has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
|
||||
#elif MOTHERBOARD == BOARD_BTT_SKR_E3_TURBO && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
|
||||
#warning "Onboard temperature sensor for BOARD_BTT_SKR_E3_TURBO has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
|
||||
#endif
|
||||
|
||||
constexpr float arm[] = AXIS_RELATIVE_MODES;
|
||||
@@ -619,7 +623,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
||||
static_assert(_test_btc_sample_start != 12.3f, "BTC_SAMPLE_START must be a whole number.");
|
||||
#endif
|
||||
#ifdef BTC_SAMPLE_RES
|
||||
constexpr _btc_sample_res = BTC_SAMPLE_RES;
|
||||
constexpr auto _btc_sample_res = BTC_SAMPLE_RES;
|
||||
constexpr decltype(_btc_sample_res) _test_btc_sample_res = 12.3f;
|
||||
static_assert(_test_btc_sample_res != 12.3f, "BTC_SAMPLE_RES must be a whole number.");
|
||||
#endif
|
||||
@@ -1959,6 +1963,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "TEMP_SENSOR_CHAMBER 1000 requires CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS and CHAMBER_BETA in Configuration_adv.h."
|
||||
#elif TEMP_SENSOR_PROBE_IS_CUSTOM && !(defined(PROBE_PULLUP_RESISTOR_OHMS) && defined(PROBE_RESISTANCE_25C_OHMS) && defined(PROBE_BETA))
|
||||
#error "TEMP_SENSOR_PROBE 1000 requires PROBE_PULLUP_RESISTOR_OHMS, PROBE_RESISTANCE_25C_OHMS and PROBE_BETA in Configuration_adv.h."
|
||||
#elif TEMP_SENSOR_BOARD_IS_CUSTOM && !(defined(BOARD_PULLUP_RESISTOR_OHMS) && defined(BOARD_RESISTANCE_25C_OHMS) && defined(BOARD_BETA))
|
||||
#error "TEMP_SENSOR_BOARD 1000 requires BOARD_PULLUP_RESISTOR_OHMS, BOARD_RESISTANCE_25C_OHMS and BOARD_BETA in Configuration_adv.h."
|
||||
#elif TEMP_SENSOR_REDUNDANT_IS_CUSTOM && !(defined(REDUNDANT_PULLUP_RESISTOR_OHMS) && defined(REDUNDANT_RESISTANCE_25C_OHMS) && defined(REDUNDANT_BETA))
|
||||
#error "TEMP_SENSOR_REDUNDANT 1000 requires REDUNDANT_PULLUP_RESISTOR_OHMS, REDUNDANT_RESISTANCE_25C_OHMS and REDUNDANT_BETA in Configuration_adv.h."
|
||||
#endif
|
||||
@@ -1966,14 +1972,14 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
/**
|
||||
* Required MAX31865 settings
|
||||
*/
|
||||
#if TEMP_SENSOR_0_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && TEMP_SENSOR_REDUNDANT_SOURCE == 0)
|
||||
#if TEMP_SENSOR_0_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && REDUNDANT_TEMP_MATCH(SOURCE, E0))
|
||||
#if !defined(MAX31865_SENSOR_WIRES_0) || !WITHIN(MAX31865_SENSOR_WIRES_0, 2, 4)
|
||||
#error "MAX31865_SENSOR_WIRES_0 must be defined as an integer between 2 and 4."
|
||||
#elif !defined(MAX31865_SENSOR_OHMS_0) || !defined(MAX31865_CALIBRATION_OHMS_0)
|
||||
#error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set if TEMP_SENSOR_0/TEMP_SENSOR_REDUNDANT is MAX31865."
|
||||
#endif
|
||||
#endif
|
||||
#if TEMP_SENSOR_1_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
|
||||
#if TEMP_SENSOR_1_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && REDUNDANT_TEMP_MATCH(SOURCE, E1))
|
||||
#if !defined(MAX31865_SENSOR_WIRES_1) || !WITHIN(MAX31865_SENSOR_WIRES_1, 2, 4)
|
||||
#error "MAX31865_SENSOR_WIRES_1 must be defined as an integer between 2 and 4."
|
||||
#elif !defined(MAX31865_SENSOR_OHMS_1) || !defined(MAX31865_CALIBRATION_OHMS_1)
|
||||
@@ -1989,62 +1995,58 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "TEMP_SENSOR_REDUNDANT requires TEMP_SENSOR_REDUNDANT_SOURCE."
|
||||
#elif !defined(TEMP_SENSOR_REDUNDANT_TARGET)
|
||||
#error "TEMP_SENSOR_REDUNDANT requires TEMP_SENSOR_REDUNDANT_TARGET."
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == TEMP_SENSOR_REDUNDANT_TARGET
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, TEMP_SENSOR_REDUNDANT_TARGET)
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be the same as TEMP_SENSOR_REDUNDANT_TARGET."
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE < -5 || TEMP_SENSOR_REDUNDANT_SOURCE > 7
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE must be between -5 and 7."
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET < -5 || TEMP_SENSOR_REDUNDANT_TARGET > 7
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET must be between -5 and 7."
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -3
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be -3 (not used)."
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == -3
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be -3 (not used)."
|
||||
#elif HAS_MULTI_HOTEND && TEMP_SENSOR_REDUNDANT_SOURCE < HOTENDS
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE must be after the last TEMP_SENSOR used with a hotend; you can't use a sensor in the middle of two hotends."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE must be after the last used hotend TEMP_SENSOR."
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_REDUNDANT_SOURCE == 0 && HAS_HOTEND
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can not be 0 if a hotend is used. E0 always uses TEMP_SENSOR_0."
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -5 && HAS_TEMP_COOLER
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Cooler (-5): TEMP_SENSOR_COOLER has already defined the sensor."
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -4 && HAS_TEMP_PROBE
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Probe (-4): TEMP_SENSOR_PROBE has already defined the sensor."
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -2 && HAS_TEMP_CHAMBER
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Chamber (-2): TEMP_SENSOR_CHAMBER has already defined the sensor."
|
||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -1 && HAS_TEMP_BED
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Bed (-1): TEMP_SENSOR_BED has already defined the sensor."
|
||||
#if REDUNDANT_TEMP_MATCH(SOURCE, E0) && HAS_HOTEND
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be 0 if a hotend is used. E0 always uses TEMP_SENSOR_0."
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, COOLER) && HAS_TEMP_COOLER
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be COOLER. TEMP_SENSOR_COOLER is in use."
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, PROBE) && HAS_TEMP_PROBE
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be PROBE. TEMP_SENSOR_PROBE is in use."
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, BOARD) && HAS_TEMP_BOARD
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be BOARD. TEMP_SENSOR_BOARD is in use."
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, CHAMBER) && HAS_TEMP_CHAMBER
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be CHAMBER. TEMP_SENSOR_CHAMBER is in use."
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, BED) && HAS_TEMP_BED
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be BED. TEMP_SENSOR_BED is in use."
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_REDUNDANT_TARGET == 0 && !PIN_EXISTS(TEMP_0)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E0 (0): requires TEMP_0_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == 1 && !PIN_EXISTS(TEMP_1)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E1 (1): requires TEMP_1_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == 2 && !PIN_EXISTS(TEMP_2)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E2 (2): requires TEMP_2_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == 3 && !PIN_EXISTS(TEMP_3)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E3 (3): requires TEMP_3_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == 4 && !PIN_EXISTS(TEMP_4)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E4 (4): requires TEMP_4_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == 5 && !PIN_EXISTS(TEMP_5)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E5 (5): requires TEMP_5_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == 6 && !PIN_EXISTS(TEMP_6)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E6 (6): requires TEMP_6_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == 7 && !PIN_EXISTS(TEMP_7)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E7 (7): requires TEMP_7_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == -1 && !PIN_EXISTS(TEMP_BED)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Bed (-1): requires TEMP_BED_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == -2 && !PIN_EXISTS(TEMP_CHAMBER)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Chamber (-2): requires TEMP_CHAMBER_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == -4 && !PIN_EXISTS(TEMP_PROBE)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Probe (-4): requires TEMP_PROBE_PIN"
|
||||
#elif TEMP_SENSOR_REDUNDANT_TARGET == -5 && !PIN_EXISTS(TEMP_COOLER)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Cooler (-5): requires TEMP_COOLER_PIN"
|
||||
#if REDUNDANT_TEMP_MATCH(TARGET, E0) && !PIN_EXISTS(TEMP_0)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E0 without TEMP_0_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, E1) && !PIN_EXISTS(TEMP_1)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E1 without TEMP_1_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, E2) && !PIN_EXISTS(TEMP_2)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E2 without TEMP_2_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, E3) && !PIN_EXISTS(TEMP_3)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E3 without TEMP_3_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, E4) && !PIN_EXISTS(TEMP_4)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E4 without TEMP_4_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, E5) && !PIN_EXISTS(TEMP_5)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E5 without TEMP_5_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, E6) && !PIN_EXISTS(TEMP_6)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E6 without TEMP_6_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, E7) && !PIN_EXISTS(TEMP_7)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E7 without TEMP_7_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, BED) && !PIN_EXISTS(TEMP_BED)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be BED without TEMP_BED_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, CHAMBER) && !PIN_EXISTS(TEMP_CHAMBER)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be CHAMBER without TEMP_CHAMBER_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, BOARD) && !PIN_EXISTS(TEMP_BOARD)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be BOARD without TEMP_BOARD_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, PROBE) && !PIN_EXISTS(TEMP_PROBE)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be PROBE without TEMP_PROBE_PIN defined."
|
||||
#elif REDUNDANT_TEMP_MATCH(TARGET, COOLER) && !PIN_EXISTS(TEMP_COOLER)
|
||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be COOLER without TEMP_COOLER_PIN defined."
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0 && !PIN_EXISTS(TEMP_0_CS)
|
||||
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 0 requires TEMP_0_CS_PIN."
|
||||
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1 && !PIN_EXISTS(TEMP_1_CS)
|
||||
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 1 requires TEMP_1_CS_PIN."
|
||||
#if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E0) && !PIN_EXISTS(TEMP_0_CS)
|
||||
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE E0 requires TEMP_0_CS_PIN."
|
||||
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1) && !PIN_EXISTS(TEMP_1_CS)
|
||||
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE E1 requires TEMP_1_CS_PIN."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -2209,6 +2211,28 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_PROBE
|
||||
#if !PIN_EXISTS(TEMP_PROBE)
|
||||
#error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN."
|
||||
#elif !HAS_TEMP_ADC_PROBE
|
||||
#error "TEMP_PROBE_PIN must be an ADC pin."
|
||||
#elif DISABLED(FIX_MOUNTED_PROBE)
|
||||
#error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_BOARD
|
||||
#if !PIN_EXISTS(TEMP_BOARD)
|
||||
#error "TEMP_SENSOR_BOARD requires TEMP_BOARD_PIN."
|
||||
#elif !HAS_TEMP_ADC_BOARD
|
||||
#error "TEMP_BOARD_PIN must be an ADC pin."
|
||||
#elif ENABLED(THERMAL_PROTECTION_BOARD) && (!defined(BOARD_MINTEMP) || !defined(BOARD_MAXTEMP))
|
||||
#error "THERMAL_PROTECTION_BOARD requires BOARD_MINTEMP and BOARD_MAXTEMP."
|
||||
#endif
|
||||
#elif CONTROLLER_FAN_MIN_BOARD_TEMP
|
||||
#error "CONTROLLER_FAN_MIN_BOARD_TEMP requires TEMP_SENSOR_BOARD."
|
||||
#endif
|
||||
|
||||
#if ENABLED(LASER_COOLANT_FLOW_METER) && !(PIN_EXISTS(FLOWMETER) && ENABLED(LASER_FEATURE))
|
||||
#error "LASER_COOLANT_FLOW_METER requires FLOWMETER_PIN and LASER_FEATURE."
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
* version was tagged.
|
||||
*/
|
||||
#ifndef STRING_DISTRIBUTION_DATE
|
||||
#define STRING_DISTRIBUTION_DATE "2021-07-07"
|
||||
#define STRING_DISTRIBUTION_DATE "2021-07-21"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,6 +57,18 @@
|
||||
#include "../../gcode/parser.h"
|
||||
#endif
|
||||
|
||||
#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
|
||||
#include "../../feature/cooler.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(I2C_AMMETER)
|
||||
#include "../../feature/ammeter.h"
|
||||
#endif
|
||||
|
||||
#if HAS_CUTTER
|
||||
#include "../../feature/spindle_laser.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
#endif
|
||||
@@ -64,12 +76,12 @@
|
||||
TFTGLCD lcd;
|
||||
|
||||
#define ICON_LOGO B00000001
|
||||
#define ICON_TEMP1 B00000010 //hotend 1
|
||||
#define ICON_TEMP2 B00000100 //hotend 2
|
||||
#define ICON_TEMP3 B00001000 //hotend 3
|
||||
#define ICON_TEMP1 B00000010 // Hotend 1
|
||||
#define ICON_TEMP2 B00000100 // Hotend 2
|
||||
#define ICON_TEMP3 B00001000 // Hotend 3
|
||||
#define ICON_BED B00010000
|
||||
#define ICON_FAN B00100000
|
||||
#define ICON_HOT B01000000 //when any T > 50deg
|
||||
#define ICON_HOT B01000000 // When any T > 50deg
|
||||
#define PIC_MASK 0x7F
|
||||
|
||||
// LEDs not used, for compatibility with Smoothieware
|
||||
@@ -433,69 +445,161 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
|
||||
FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *prefix, const bool blink) {
|
||||
uint8_t pic_hot_bits;
|
||||
#if HAS_HEATED_BED
|
||||
const bool isBed = heater_id < 0;
|
||||
const celsius_t t1 = (isBed ? thermalManager.wholeDegBed() : thermalManager.wholeDegHotend(heater_id)),
|
||||
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
|
||||
#else
|
||||
const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
|
||||
#endif
|
||||
#if HAS_HOTEND || HAS_HEATED_BED
|
||||
|
||||
#if HOTENDS < 2
|
||||
if (heater_id == H_E0) {
|
||||
lcd.setCursor(2, 5); lcd.print(prefix); //HE
|
||||
lcd.setCursor(1, 6); lcd.print(i16tostr3rj(t1));
|
||||
lcd.setCursor(1, 7);
|
||||
}
|
||||
else {
|
||||
lcd.setCursor(6, 5); lcd.print(prefix); //BED
|
||||
lcd.setCursor(6, 6); lcd.print(i16tostr3rj(t1));
|
||||
lcd.setCursor(6, 7);
|
||||
}
|
||||
#else
|
||||
if (heater_id > H_BED) {
|
||||
lcd.setCursor(heater_id * 4, 5); lcd.print(prefix); // HE1 or HE2 or HE3
|
||||
lcd.setCursor(heater_id * 4, 6); lcd.print(i16tostr3rj(t1));
|
||||
lcd.setCursor(heater_id * 4, 7);
|
||||
}
|
||||
else {
|
||||
lcd.setCursor(13, 5); lcd.print(prefix); //BED
|
||||
lcd.setCursor(13, 6); lcd.print(i16tostr3rj(t1));
|
||||
lcd.setCursor(13, 7);
|
||||
}
|
||||
#endif // HOTENDS <= 1
|
||||
FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *prefix, const bool blink) {
|
||||
uint8_t pic_hot_bits;
|
||||
#if HAS_HEATED_BED
|
||||
const bool isBed = heater_id < 0;
|
||||
const celsius_t t1 = (isBed ? thermalManager.wholeDegBed() : thermalManager.wholeDegHotend(heater_id)),
|
||||
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
|
||||
#else
|
||||
const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
|
||||
#endif
|
||||
|
||||
#if !HEATER_IDLE_HANDLER
|
||||
UNUSED(blink);
|
||||
#else
|
||||
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
||||
lcd.write(' ');
|
||||
if (t2 >= 10) lcd.write(' ');
|
||||
if (t2 >= 100) lcd.write(' ');
|
||||
}
|
||||
else
|
||||
#endif // !HEATER_IDLE_HANDLER
|
||||
lcd.print(i16tostr3rj(t2));
|
||||
#if HOTENDS < 2
|
||||
if (heater_id == H_E0) {
|
||||
lcd.setCursor(2, 5); lcd.print(prefix); //HE
|
||||
lcd.setCursor(1, 6); lcd.print(i16tostr3rj(t1));
|
||||
lcd.setCursor(1, 7);
|
||||
}
|
||||
else {
|
||||
lcd.setCursor(6, 5); lcd.print(prefix); //BED
|
||||
lcd.setCursor(6, 6); lcd.print(i16tostr3rj(t1));
|
||||
lcd.setCursor(6, 7);
|
||||
}
|
||||
#else
|
||||
if (heater_id > H_BED) {
|
||||
lcd.setCursor(heater_id * 4, 5); lcd.print(prefix); // HE1 or HE2 or HE3
|
||||
lcd.setCursor(heater_id * 4, 6); lcd.print(i16tostr3rj(t1));
|
||||
lcd.setCursor(heater_id * 4, 7);
|
||||
}
|
||||
else {
|
||||
lcd.setCursor(13, 5); lcd.print(prefix); //BED
|
||||
lcd.setCursor(13, 6); lcd.print(i16tostr3rj(t1));
|
||||
lcd.setCursor(13, 7);
|
||||
}
|
||||
#endif // HOTENDS <= 1
|
||||
|
||||
switch (heater_id) {
|
||||
case H_BED: pic_hot_bits = ICON_BED; break;
|
||||
case H_E0: pic_hot_bits = ICON_TEMP1; break;
|
||||
case H_E1: pic_hot_bits = ICON_TEMP2; break;
|
||||
case H_E2: pic_hot_bits = ICON_TEMP3;
|
||||
default: break;
|
||||
#if !HEATER_IDLE_HANDLER
|
||||
UNUSED(blink);
|
||||
#else
|
||||
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
||||
lcd.write(' ');
|
||||
if (t2 >= 10) lcd.write(' ');
|
||||
if (t2 >= 100) lcd.write(' ');
|
||||
}
|
||||
else
|
||||
#endif // !HEATER_IDLE_HANDLER
|
||||
lcd.print(i16tostr3rj(t2));
|
||||
|
||||
switch (heater_id) {
|
||||
case H_BED: pic_hot_bits = ICON_BED; break;
|
||||
case H_E0: pic_hot_bits = ICON_TEMP1; break;
|
||||
case H_E1: pic_hot_bits = ICON_TEMP2; break;
|
||||
case H_E2: pic_hot_bits = ICON_TEMP3;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (t2) picBits |= pic_hot_bits;
|
||||
else picBits &= ~pic_hot_bits;
|
||||
|
||||
if (t1 > 50) hotBits |= pic_hot_bits;
|
||||
else hotBits &= ~pic_hot_bits;
|
||||
|
||||
if (hotBits) picBits |= ICON_HOT;
|
||||
else picBits &= ~ICON_HOT;
|
||||
}
|
||||
|
||||
if (t2) picBits |= pic_hot_bits;
|
||||
else picBits &= ~pic_hot_bits;
|
||||
#endif // HAS_HOTEND || HAS_HEATED_BED
|
||||
|
||||
if (t1 > 50) hotBits |= pic_hot_bits;
|
||||
else hotBits &= ~pic_hot_bits;
|
||||
#if HAS_COOLER
|
||||
|
||||
if (hotBits) picBits |= ICON_HOT;
|
||||
else picBits &= ~ICON_HOT;
|
||||
}
|
||||
FORCE_INLINE void _draw_cooler_status(const bool blink) {
|
||||
const celsius_t t2 = thermalManager.degTargetCooler();
|
||||
|
||||
lcd.setCursor(0, 5); lcd_put_u8str_P(PSTR("COOL"));
|
||||
lcd.setCursor(1, 6); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
|
||||
lcd.setCursor(1, 7);
|
||||
|
||||
#if !HEATER_IDLE_HANDLER
|
||||
UNUSED(blink);
|
||||
#else
|
||||
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
||||
lcd_put_wchar(' ');
|
||||
if (t2 >= 10) lcd_put_wchar(' ');
|
||||
if (t2 >= 100) lcd_put_wchar(' ');
|
||||
}
|
||||
else
|
||||
#endif
|
||||
lcd_put_u8str(i16tostr3left(t2));
|
||||
|
||||
lcd_put_wchar(' ');
|
||||
if (t2 < 10) lcd_put_wchar(' ');
|
||||
|
||||
if (t2) picBits |= ICON_TEMP1;
|
||||
else picBits &= ~ICON_TEMP1;
|
||||
}
|
||||
|
||||
#endif // HAS_COOLER
|
||||
|
||||
#if ENABLED(LASER_COOLANT_FLOW_METER)
|
||||
|
||||
FORCE_INLINE void _draw_flowmeter_status() {
|
||||
lcd.setCursor(5, 5); lcd_put_u8str_P(PSTR("FLOW"));
|
||||
lcd.setCursor(7, 6); lcd_put_wchar('L');
|
||||
lcd.setCursor(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate));
|
||||
|
||||
if (cooler.flowrate) picBits |= ICON_FAN;
|
||||
else picBits &= ~ICON_FAN;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(I2C_AMMETER)
|
||||
|
||||
FORCE_INLINE void _draw_ammeter_status() {
|
||||
lcd.setCursor(10, 5); lcd_put_u8str_P(PSTR("ILAZ"));
|
||||
ammeter.read();
|
||||
lcd.setCursor(11, 6);
|
||||
if (ammeter.current <= 0.999f)
|
||||
{
|
||||
lcd_put_u8str("mA");
|
||||
lcd.setCursor(10, 7);
|
||||
lcd_put_wchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f)));
|
||||
}
|
||||
else {
|
||||
lcd_put_u8str(" A");
|
||||
lcd.setCursor(10, 7);
|
||||
lcd_put_u8str(ftostr12ns(ammeter.current));
|
||||
}
|
||||
|
||||
if (ammeter.current) picBits |= ICON_BED;
|
||||
else picBits &= ~ICON_BED;
|
||||
}
|
||||
|
||||
#endif // I2C_AMMETER
|
||||
|
||||
#if HAS_CUTTER
|
||||
|
||||
FORCE_INLINE void _draw_cutter_status() {
|
||||
lcd.setCursor(15, 5); lcd_put_u8str_P(PSTR("CUTT"));
|
||||
#if CUTTER_UNIT_IS(RPM)
|
||||
lcd.setCursor(16, 6); lcd_put_u8str_P(PSTR("RPM"));
|
||||
lcd.setCursor(15, 7); lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000));
|
||||
lcd_put_wchar('K');
|
||||
#elif CUTTER_UNIT_IS(PERCENT)
|
||||
lcd.setCursor(17, 6); lcd_put_wchar('%');
|
||||
lcd.setCursor(18, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower));
|
||||
#else
|
||||
lcd.setCursor(17, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower));
|
||||
#endif
|
||||
|
||||
if (cutter.unitPower) picBits |= ICON_HOT;
|
||||
else picBits &= ~ICON_HOT;
|
||||
}
|
||||
|
||||
#endif // HAS_CUTTER
|
||||
|
||||
#if HAS_PRINT_PROGRESS
|
||||
|
||||
@@ -533,7 +637,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *p
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // LCD_PROGRESS_BAR
|
||||
|
||||
void MarlinUI::draw_status_message(const bool blink) {
|
||||
if (!PanelDetected) return;
|
||||
@@ -648,6 +752,19 @@ or
|
||||
|
||||
or
|
||||
|
||||
|X 000 Y 000 Z 000.00|
|
||||
|FR100% SD100% C--:--|
|
||||
| Progress bar line |
|
||||
|Status message |
|
||||
| |
|
||||
|COOL FLOW ILAZ CUTT |
|
||||
| ttc L mA RPM |
|
||||
| tts f.f aaa rr.rK|
|
||||
| ICO ICO ICO ICO |
|
||||
| ICO ICO ICO ICO |
|
||||
|
||||
or
|
||||
|
||||
Equal to 24x10 text LCD
|
||||
|
||||
|X 000 Y 000 Z 000.00 |
|
||||
@@ -745,50 +862,61 @@ void MarlinUI::draw_status_screen() {
|
||||
#endif
|
||||
|
||||
//
|
||||
// Line 6..8 Temperatures, FAN
|
||||
// Line 6..8 Temperatures, FAN for printer or Cooler, Flowmetter, Ampermeter, Cutter for laser/spindle
|
||||
//
|
||||
|
||||
#if HOTENDS < 2
|
||||
_draw_heater_status(H_E0, "HE", blink); // Hotend Temperature
|
||||
#else
|
||||
_draw_heater_status(H_E0, "HE1", blink); // Hotend 1 Temperature
|
||||
_draw_heater_status(H_E1, "HE2", blink); // Hotend 2 Temperature
|
||||
#if HOTENDS > 2
|
||||
_draw_heater_status(H_E2, "HE3", blink); // Hotend 3 Temperature
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
#if HAS_LEVELING
|
||||
_draw_heater_status(H_BED, (planner.leveling_active && blink ? "___" : "BED"), blink);
|
||||
#else
|
||||
_draw_heater_status(H_BED, "BED", blink);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_FAN
|
||||
uint16_t spd = thermalManager.fan_speed[0];
|
||||
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
||||
if (!blink) spd = thermalManager.scaledFanSpeed(0, spd);
|
||||
#endif
|
||||
uint16_t per = thermalManager.pwmToPercent(spd);
|
||||
#if HAS_HOTEND
|
||||
|
||||
#if HOTENDS < 2
|
||||
#define FANX 11
|
||||
_draw_heater_status(H_E0, "HE", blink); // Hotend Temperature
|
||||
#else
|
||||
#define FANX 17
|
||||
_draw_heater_status(H_E0, "HE1", blink); // Hotend 1 Temperature
|
||||
_draw_heater_status(H_E1, "HE2", blink); // Hotend 2 Temperature
|
||||
#if HOTENDS > 2
|
||||
_draw_heater_status(H_E2, "HE3", blink); // Hotend 3 Temperature
|
||||
#endif
|
||||
#endif
|
||||
lcd.setCursor(FANX, 5); lcd_put_u8str_P(PSTR("FAN"));
|
||||
lcd.setCursor(FANX + 1, 6); lcd.write('%');
|
||||
lcd.setCursor(FANX, 7);
|
||||
lcd.print(i16tostr3rj(per));
|
||||
|
||||
if (TERN0(HAS_FAN0, thermalManager.fan_speed[0]) || TERN0(HAS_FAN1, thermalManager.fan_speed[1]) || TERN0(HAS_FAN2, thermalManager.fan_speed[2]))
|
||||
picBits |= ICON_FAN;
|
||||
else
|
||||
picBits &= ~ICON_FAN;
|
||||
#if HAS_HEATED_BED
|
||||
#if HAS_LEVELING
|
||||
_draw_heater_status(H_BED, (planner.leveling_active && blink ? "___" : "BED"), blink);
|
||||
#else
|
||||
_draw_heater_status(H_BED, "BED", blink);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // HAS_FAN
|
||||
#if HAS_FAN
|
||||
uint16_t spd = thermalManager.fan_speed[0];
|
||||
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
||||
if (!blink) spd = thermalManager.scaledFanSpeed(0, spd);
|
||||
#endif
|
||||
uint16_t per = thermalManager.pwmToPercent(spd);
|
||||
|
||||
#if HOTENDS < 2
|
||||
#define FANX 11
|
||||
#else
|
||||
#define FANX 17
|
||||
#endif
|
||||
lcd.setCursor(FANX, 5); lcd_put_u8str_P(PSTR("FAN"));
|
||||
lcd.setCursor(FANX + 1, 6); lcd.write('%');
|
||||
lcd.setCursor(FANX, 7);
|
||||
lcd.print(i16tostr3rj(per));
|
||||
|
||||
if (TERN0(HAS_FAN0, thermalManager.fan_speed[0]) || TERN0(HAS_FAN1, thermalManager.fan_speed[1]) || TERN0(HAS_FAN2, thermalManager.fan_speed[2]))
|
||||
picBits |= ICON_FAN;
|
||||
else
|
||||
picBits &= ~ICON_FAN;
|
||||
|
||||
#endif // HAS_FAN
|
||||
|
||||
#else
|
||||
|
||||
TERN_(HAS_COOLER, _draw_cooler_status(blink));
|
||||
TERN_(LASER_COOLANT_FLOW_METER, _draw_flowmeter_status());
|
||||
TERN_(I2C_AMMETER, _draw_ammeter_status());
|
||||
TERN_(HAS_CUTTER, _draw_cutter_status());
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Line 9, 10 - icons
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
// Use this file to select the com driver for device drivers that are NOT in the U8G library
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#ifndef U8G_HAL_LINKS // Defined by LPC1768/9 environments in platform.ini
|
||||
|
||||
|
||||
@@ -624,7 +624,7 @@
|
||||
#define STATUS_AMMETER_X (LCD_PIXEL_WIDTH - (STATUS_AMMETER_BYTEWIDTH + STATUS_FLOWMETER_BYTEWIDTH + STATUS_FAN_BYTEWIDTH + STATUS_CUTTER_BYTEWIDTH + STATUS_COOLER_BYTEWIDTH) * 8)
|
||||
#endif
|
||||
#ifndef STATUS_AMMETER_HEIGHT
|
||||
#define STATUS_AMMETER_HEIGHT(S) (sizeof(status_ammeter_bmp1) / (STATUS_AMMETER_BYTEWIDTH))
|
||||
#define STATUS_AMMETER_HEIGHT(S) (sizeof(status_ammeter_bmp_mA) / (STATUS_AMMETER_BYTEWIDTH))
|
||||
#endif
|
||||
#ifndef STATUS_AMMETER_Y
|
||||
#define STATUS_AMMETER_Y(S) (18 - STATUS_AMMETER_HEIGHT(S))
|
||||
@@ -633,8 +633,8 @@
|
||||
#define STATUS_AMMETER_TEXT_X (STATUS_AMMETER_X + 7)
|
||||
#endif
|
||||
static_assert(
|
||||
sizeof(status_ammeter_bmp1) == (STATUS_AMMETER_BYTEWIDTH) * STATUS_AMMETER_HEIGHT(0),
|
||||
"Status ammeter bitmap (status_ammeter_bmp1) dimensions don't match data."
|
||||
sizeof(status_ammeter_bmp_mA) == (STATUS_AMMETER_BYTEWIDTH) * STATUS_AMMETER_HEIGHT(0),
|
||||
"Status ammeter bitmap (status_ammeter_bmp_mA) dimensions don't match data."
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
X Font ascent = 6 descent=-2
|
||||
Max Font ascent = 7 descent=-2
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
const u8g_fntpgm_uint8_t u8g_font_6x9[2434] U8G_FONT_SECTION(".progmem.u8g_font_6x9") = {
|
||||
0x00,0x06,0x09,0x00,0xFE,0x06,0x02,0x0F,0x03,0x84,0x01,0xFF,0xFE,0x07,0xFE,0x06,
|
||||
0xFE,0x05,0x07,0x07,0x00,0x00,0x00,0x40,0xF0,0xC8,0x88,0x98,0x78,0x10,0x05,0x07,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#if defined(__AVR__) && ENABLED(NOT_EXTENDED_ISO10646_1_5X7)
|
||||
// reduced font (only symbols 1 - 127) - saves about 1278 bytes of FLASH
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
@@ -3,7 +3,8 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {};
|
||||
#include "langdata.h"
|
||||
|
||||
static const uxg_fontinfo_t g_fontinfo_an[] PROGMEM = {};
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#include "langdata.h"
|
||||
|
||||
const u8g_fntpgm_uint8_t fontpage_8_144_149[96] U8G_FONT_SECTION("fontpage_8_144_149") = {
|
||||
0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x90,0x95,0x00,0x07,0xFF,0x00,
|
||||
@@ -64,14 +66,13 @@ const u8g_fntpgm_uint8_t fontpage_8_206_207[39] U8G_FONT_SECTION("fontpage_8_206
|
||||
0x00,0x05,0x05,0x05,0x06,0x00,0x00,0x90,0xA8,0xE8,0xA8,0x90,0x04,0x05,0x05,0x06,
|
||||
0x01,0x00,0x70,0x90,0x70,0x50,0x90};
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {
|
||||
FONTDATA_ITEM(8, 144, 149, fontpage_8_144_149), // 'А' -- 'Е'
|
||||
FONTDATA_ITEM(8, 151, 152, fontpage_8_151_152), // 'З' -- 'И'
|
||||
FONTDATA_ITEM(8, 154, 164, fontpage_8_154_164), // 'К' -- 'Ф'
|
||||
FONTDATA_ITEM(8, 166, 166, fontpage_8_166_166), // 'Ц' -- 'Ц'
|
||||
FONTDATA_ITEM(8, 175, 195, fontpage_8_175_195), // 'Я' -- 'у'
|
||||
FONTDATA_ITEM(8, 197, 200, fontpage_8_197_200), // 'х' -- 'ш'
|
||||
FONTDATA_ITEM(8, 202, 202, fontpage_8_202_202), // 'ъ' -- 'ъ'
|
||||
FONTDATA_ITEM(8, 206, 207, fontpage_8_206_207), // 'ю' -- 'я'
|
||||
static const uxg_fontinfo_t g_fontinfo_bg[] PROGMEM = {
|
||||
FONTDATA_ITEM(8, 144, 149, fontpage_8_144_149), // 'А' -- 'Е'
|
||||
FONTDATA_ITEM(8, 151, 152, fontpage_8_151_152), // 'З' -- 'И'
|
||||
FONTDATA_ITEM(8, 154, 164, fontpage_8_154_164), // 'К' -- 'Ф'
|
||||
FONTDATA_ITEM(8, 166, 166, fontpage_8_166_166), // 'Ц' -- 'Ц'
|
||||
FONTDATA_ITEM(8, 175, 195, fontpage_8_175_195), // 'Я' -- 'у'
|
||||
FONTDATA_ITEM(8, 197, 200, fontpage_8_197_200), // 'х' -- 'ш'
|
||||
FONTDATA_ITEM(8, 202, 202, fontpage_8_202_202), // 'ъ' -- 'ъ'
|
||||
FONTDATA_ITEM(8, 206, 207, fontpage_8_206_207), // 'ю' -- 'я'
|
||||
};
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {};
|
||||
#include "langdata.h"
|
||||
|
||||
static const uxg_fontinfo_t g_fontinfo_ca[] PROGMEM = {};
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#include "langdata.h"
|
||||
|
||||
const u8g_fntpgm_uint8_t fontpage_2_140_141[47] U8G_FONT_SECTION("fontpage_2_140_141") = {
|
||||
0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x8C,0x8D,0x00,0x0A,0x00,0x00,
|
||||
@@ -40,15 +42,14 @@ const u8g_fntpgm_uint8_t fontpage_2_253_254[47] U8G_FONT_SECTION("fontpage_2_253
|
||||
0x00,0x05,0x0A,0x0A,0x06,0x00,0x00,0x50,0x20,0x00,0xF8,0x08,0x10,0x20,0x40,0x80,
|
||||
0xF8,0x05,0x08,0x08,0x06,0x00,0x00,0x50,0x20,0x00,0xF8,0x10,0x20,0x40,0xF8};
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {
|
||||
FONTDATA_ITEM(2, 140, 141, fontpage_2_140_141), // 'Č' -- 'č'
|
||||
FONTDATA_ITEM(2, 143, 143, fontpage_2_143_143), // 'ď' -- 'ď'
|
||||
FONTDATA_ITEM(2, 154, 155, fontpage_2_154_155), // 'Ě' -- 'ě'
|
||||
FONTDATA_ITEM(2, 200, 200, fontpage_2_200_200), // 'ň' -- 'ň'
|
||||
FONTDATA_ITEM(2, 216, 217, fontpage_2_216_217), // 'Ř' -- 'ř'
|
||||
FONTDATA_ITEM(2, 224, 225, fontpage_2_224_225), // 'Š' -- 'š'
|
||||
FONTDATA_ITEM(2, 229, 229, fontpage_2_229_229), // 'ť' -- 'ť'
|
||||
FONTDATA_ITEM(2, 239, 239, fontpage_2_239_239), // 'ů' -- 'ů'
|
||||
FONTDATA_ITEM(2, 253, 254, fontpage_2_253_254), // 'Ž' -- 'ž'
|
||||
static const uxg_fontinfo_t g_fontinfo_cz[] PROGMEM = {
|
||||
FONTDATA_ITEM(2, 140, 141, fontpage_2_140_141), // 'Č' -- 'č'
|
||||
FONTDATA_ITEM(2, 143, 143, fontpage_2_143_143), // 'ď' -- 'ď'
|
||||
FONTDATA_ITEM(2, 154, 155, fontpage_2_154_155), // 'Ě' -- 'ě'
|
||||
FONTDATA_ITEM(2, 200, 200, fontpage_2_200_200), // 'ň' -- 'ň'
|
||||
FONTDATA_ITEM(2, 216, 217, fontpage_2_216_217), // 'Ř' -- 'ř'
|
||||
FONTDATA_ITEM(2, 224, 225, fontpage_2_224_225), // 'Š' -- 'š'
|
||||
FONTDATA_ITEM(2, 229, 229, fontpage_2_229_229), // 'ť' -- 'ť'
|
||||
FONTDATA_ITEM(2, 239, 239, fontpage_2_239_239), // 'ů' -- 'ů'
|
||||
FONTDATA_ITEM(2, 253, 254, fontpage_2_253_254), // 'Ž' -- 'ž'
|
||||
};
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {};
|
||||
#include "langdata.h"
|
||||
|
||||
static const uxg_fontinfo_t g_fontinfo_da[] PROGMEM = {};
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {};
|
||||
#include "langdata.h"
|
||||
|
||||
static const uxg_fontinfo_t g_fontinfo_de[] PROGMEM = {};
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#include "langdata.h"
|
||||
|
||||
const u8g_fntpgm_uint8_t fontpage_7_136_136[33] U8G_FONT_SECTION("fontpage_7_136_136") = {
|
||||
0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x0A,0x00,0x00,
|
||||
@@ -75,16 +77,15 @@ const u8g_fntpgm_uint8_t fontpage_64_166_166[24] U8G_FONT_SECTION("fontpage_64_1
|
||||
0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xA6,0xA6,0x00,0x01,0x00,0x00,
|
||||
0x00,0x05,0x01,0x01,0x06,0x00,0x00,0xA8};
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {
|
||||
FONTDATA_ITEM(7, 136, 136, fontpage_7_136_136), // 'Έ' -- 'Έ'
|
||||
FONTDATA_ITEM(7, 145, 157, fontpage_7_145_157), // 'Α' -- 'Ν'
|
||||
FONTDATA_ITEM(7, 159, 161, fontpage_7_159_161), // 'Ο' -- 'Ρ'
|
||||
FONTDATA_ITEM(7, 163, 167, fontpage_7_163_167), // 'Σ' -- 'Χ'
|
||||
FONTDATA_ITEM(7, 172, 175, fontpage_7_172_175), // 'ά' -- 'ί'
|
||||
FONTDATA_ITEM(7, 177, 181, fontpage_7_177_181), // 'α' -- 'ε'
|
||||
FONTDATA_ITEM(7, 183, 199, fontpage_7_183_199), // 'η' -- 'χ'
|
||||
FONTDATA_ITEM(7, 201, 201, fontpage_7_201_201), // 'ω' -- 'ω'
|
||||
FONTDATA_ITEM(7, 204, 206, fontpage_7_204_206), // 'ό' -- 'ώ'
|
||||
FONTDATA_ITEM(64, 166, 166, fontpage_64_166_166), // '…' -- '…'
|
||||
static const uxg_fontinfo_t g_fontinfo_el[] PROGMEM = {
|
||||
FONTDATA_ITEM(7, 136, 136, fontpage_7_136_136), // 'Έ' -- 'Έ'
|
||||
FONTDATA_ITEM(7, 145, 157, fontpage_7_145_157), // 'Α' -- 'Ν'
|
||||
FONTDATA_ITEM(7, 159, 161, fontpage_7_159_161), // 'Ο' -- 'Ρ'
|
||||
FONTDATA_ITEM(7, 163, 167, fontpage_7_163_167), // 'Σ' -- 'Χ'
|
||||
FONTDATA_ITEM(7, 172, 175, fontpage_7_172_175), // 'ά' -- 'ί'
|
||||
FONTDATA_ITEM(7, 177, 181, fontpage_7_177_181), // 'α' -- 'ε'
|
||||
FONTDATA_ITEM(7, 183, 199, fontpage_7_183_199), // 'η' -- 'χ'
|
||||
FONTDATA_ITEM(7, 201, 201, fontpage_7_201_201), // 'ω' -- 'ω'
|
||||
FONTDATA_ITEM(7, 204, 206, fontpage_7_204_206), // 'ό' -- 'ώ'
|
||||
FONTDATA_ITEM(64, 166, 166, fontpage_64_166_166), // '…' -- '…'
|
||||
};
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#include "langdata.h"
|
||||
|
||||
const u8g_fntpgm_uint8_t fontpage_7_136_136[33] U8G_FONT_SECTION("fontpage_7_136_136") = {
|
||||
0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x0A,0x00,0x00,
|
||||
@@ -75,16 +77,15 @@ const u8g_fntpgm_uint8_t fontpage_64_166_166[24] U8G_FONT_SECTION("fontpage_64_1
|
||||
0x00,0x0C,0x0F,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xA6,0xA6,0x00,0x01,0x00,0x00,
|
||||
0x00,0x05,0x01,0x01,0x06,0x00,0x00,0xA8};
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {
|
||||
FONTDATA_ITEM(7, 136, 136, fontpage_7_136_136), // 'Έ' -- 'Έ'
|
||||
FONTDATA_ITEM(7, 145, 157, fontpage_7_145_157), // 'Α' -- 'Ν'
|
||||
FONTDATA_ITEM(7, 159, 161, fontpage_7_159_161), // 'Ο' -- 'Ρ'
|
||||
FONTDATA_ITEM(7, 163, 167, fontpage_7_163_167), // 'Σ' -- 'Χ'
|
||||
FONTDATA_ITEM(7, 172, 175, fontpage_7_172_175), // 'ά' -- 'ί'
|
||||
FONTDATA_ITEM(7, 177, 181, fontpage_7_177_181), // 'α' -- 'ε'
|
||||
FONTDATA_ITEM(7, 183, 199, fontpage_7_183_199), // 'η' -- 'χ'
|
||||
FONTDATA_ITEM(7, 201, 201, fontpage_7_201_201), // 'ω' -- 'ω'
|
||||
FONTDATA_ITEM(7, 204, 206, fontpage_7_204_206), // 'ό' -- 'ώ'
|
||||
FONTDATA_ITEM(64, 166, 166, fontpage_64_166_166), // '…' -- '…'
|
||||
static const uxg_fontinfo_t g_fontinfo_el_gr[] PROGMEM = {
|
||||
FONTDATA_ITEM(7, 136, 136, fontpage_7_136_136), // 'Έ' -- 'Έ'
|
||||
FONTDATA_ITEM(7, 145, 157, fontpage_7_145_157), // 'Α' -- 'Ν'
|
||||
FONTDATA_ITEM(7, 159, 161, fontpage_7_159_161), // 'Ο' -- 'Ρ'
|
||||
FONTDATA_ITEM(7, 163, 167, fontpage_7_163_167), // 'Σ' -- 'Χ'
|
||||
FONTDATA_ITEM(7, 172, 175, fontpage_7_172_175), // 'ά' -- 'ί'
|
||||
FONTDATA_ITEM(7, 177, 181, fontpage_7_177_181), // 'α' -- 'ε'
|
||||
FONTDATA_ITEM(7, 183, 199, fontpage_7_183_199), // 'η' -- 'χ'
|
||||
FONTDATA_ITEM(7, 201, 201, fontpage_7_201_201), // 'ω' -- 'ω'
|
||||
FONTDATA_ITEM(7, 204, 206, fontpage_7_204_206), // 'ό' -- 'ώ'
|
||||
FONTDATA_ITEM(64, 166, 166, fontpage_64_166_166), // '…' -- '…'
|
||||
};
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {};
|
||||
#include "langdata.h"
|
||||
|
||||
static const uxg_fontinfo_t g_fontinfo_en[] PROGMEM = {};
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {};
|
||||
#include "langdata.h"
|
||||
|
||||
static const uxg_fontinfo_t g_fontinfo_es[] PROGMEM = {};
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {};
|
||||
#include "langdata.h"
|
||||
|
||||
static const uxg_fontinfo_t g_fontinfo_eu[] PROGMEM = {};
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Contents will be REPLACED by future processing!
|
||||
* Use genallfont.sh to generate font data for updated languages.
|
||||
*/
|
||||
#include <U8glib.h>
|
||||
#pragma once
|
||||
|
||||
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
|
||||
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {};
|
||||
#include "langdata.h"
|
||||
|
||||
static const uxg_fontinfo_t g_fontinfo_fi[] PROGMEM = {};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user