Merge branch 'bugfix-2.0.x' into CrealityDwin2.0_Bleeding
This commit is contained in:
+31
-16
@@ -1473,6 +1473,13 @@
|
||||
// Enable for a belt style printer with endless "Z" motion
|
||||
//#define BELTPRINTER
|
||||
|
||||
// Enable for Polargraph Kinematics
|
||||
//#define POLARGRAPH
|
||||
#if ENABLED(POLARGRAPH)
|
||||
#define POLARGRAPH_MAX_BELT_LEN 1035.0
|
||||
#define POLAR_SEGMENTS_PER_SECOND 5
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
//============================== Endstop Settings ===========================
|
||||
//===========================================================================
|
||||
@@ -1505,18 +1512,18 @@
|
||||
#define ENDSTOPPULLUPS
|
||||
#if DISABLED(ENDSTOPPULLUPS)
|
||||
// Disable ENDSTOPPULLUPS to set pullups individually
|
||||
//#define ENDSTOPPULLUP_XMAX
|
||||
//#define ENDSTOPPULLUP_YMAX
|
||||
//#define ENDSTOPPULLUP_ZMAX
|
||||
//#define ENDSTOPPULLUP_IMAX
|
||||
//#define ENDSTOPPULLUP_JMAX
|
||||
//#define ENDSTOPPULLUP_KMAX
|
||||
//#define ENDSTOPPULLUP_XMIN
|
||||
//#define ENDSTOPPULLUP_YMIN
|
||||
//#define ENDSTOPPULLUP_ZMIN
|
||||
//#define ENDSTOPPULLUP_IMIN
|
||||
//#define ENDSTOPPULLUP_JMIN
|
||||
//#define ENDSTOPPULLUP_KMIN
|
||||
//#define ENDSTOPPULLUP_XMAX
|
||||
//#define ENDSTOPPULLUP_YMAX
|
||||
//#define ENDSTOPPULLUP_ZMAX
|
||||
//#define ENDSTOPPULLUP_IMAX
|
||||
//#define ENDSTOPPULLUP_JMAX
|
||||
//#define ENDSTOPPULLUP_KMAX
|
||||
//#define ENDSTOPPULLUP_ZMIN_PROBE
|
||||
#endif
|
||||
|
||||
@@ -1524,18 +1531,18 @@
|
||||
//#define ENDSTOPPULLDOWNS
|
||||
#if DISABLED(ENDSTOPPULLDOWNS)
|
||||
// Disable ENDSTOPPULLDOWNS to set pulldowns individually
|
||||
//#define ENDSTOPPULLDOWN_XMAX
|
||||
//#define ENDSTOPPULLDOWN_YMAX
|
||||
//#define ENDSTOPPULLDOWN_ZMAX
|
||||
//#define ENDSTOPPULLDOWN_IMAX
|
||||
//#define ENDSTOPPULLDOWN_JMAX
|
||||
//#define ENDSTOPPULLDOWN_KMAX
|
||||
//#define ENDSTOPPULLDOWN_XMIN
|
||||
//#define ENDSTOPPULLDOWN_YMIN
|
||||
//#define ENDSTOPPULLDOWN_ZMIN
|
||||
//#define ENDSTOPPULLDOWN_IMIN
|
||||
//#define ENDSTOPPULLDOWN_JMIN
|
||||
//#define ENDSTOPPULLDOWN_KMIN
|
||||
//#define ENDSTOPPULLDOWN_XMAX
|
||||
//#define ENDSTOPPULLDOWN_YMAX
|
||||
//#define ENDSTOPPULLDOWN_ZMAX
|
||||
//#define ENDSTOPPULLDOWN_IMAX
|
||||
//#define ENDSTOPPULLDOWN_JMAX
|
||||
//#define ENDSTOPPULLDOWN_KMAX
|
||||
//#define ENDSTOPPULLDOWN_ZMIN_PROBE
|
||||
#endif
|
||||
|
||||
@@ -3373,10 +3380,10 @@
|
||||
*
|
||||
* Select the language to display on the LCD. These languages are available:
|
||||
*
|
||||
* en, an, bg, ca, cz, da, de, el, el_gr, es, eu, fi, fr, gl, hr, hu, it,
|
||||
* en, an, bg, ca, cz, da, de, el, el_CY, es, eu, fi, fr, gl, hr, hu, it,
|
||||
* jp_kana, ko_KR, nl, pl, pt, pt_br, ro, ru, sk, sv, tr, uk, vi, zh_CN, zh_TW
|
||||
*
|
||||
* :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el_gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'hu':'Hungarian', 'it':'Italian', 'jp_kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt_br':'Portuguese (Brazilian)', 'ro':'Romanian', 'ru':'Russian', 'sk':'Slovak', 'sv':'Swedish', 'tr':'Turkish', 'uk':'Ukrainian', 'vi':'Vietnamese', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)' }
|
||||
* :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek (Greece)', 'el_CY':'Greek (Cyprus)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'hu':'Hungarian', 'it':'Italian', 'jp_kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt_br':'Portuguese (Brazilian)', 'ro':'Romanian', 'ru':'Russian', 'sk':'Slovak', 'sv':'Swedish', 'tr':'Turkish', 'uk':'Ukrainian', 'vi':'Vietnamese', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)' }
|
||||
*/
|
||||
#define LCD_LANGUAGE en
|
||||
|
||||
@@ -3718,6 +3725,11 @@
|
||||
//#define VIKI2
|
||||
//#define miniVIKI
|
||||
|
||||
//
|
||||
// Alfawise Ex8 printer LCD marked as WYH L12864 COG
|
||||
//
|
||||
//#define WYH_L12864
|
||||
|
||||
//
|
||||
// MakerLab Mini Panel with graphic
|
||||
// controller and SD support - https://reprap.org/wiki/Mini_panel
|
||||
@@ -4297,9 +4309,9 @@
|
||||
* Set this manually if there are extra servos needing manual control.
|
||||
* Set to 0 to turn off servo support.
|
||||
*/
|
||||
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
|
||||
//#define NUM_SERVOS 3 // Note: Servo index starts with 0 for M280-M282 commands
|
||||
|
||||
// (ms) Delay before the next move will start, to give the servo time to reach its target angle.
|
||||
// (ms) Delay before the next move will start, to give the servo time to reach its target angle.
|
||||
// 300ms is a good value but you can try less delay.
|
||||
// If the servo can't reach the requested position, increase it.
|
||||
#define SERVO_DELAY { 300 }
|
||||
@@ -4309,3 +4321,6 @@
|
||||
|
||||
// Edit servo angles with M281 and save to EEPROM with M500
|
||||
//#define EDITABLE_SERVO_ANGLES
|
||||
|
||||
// Disable servo with M282 to reduce power consumption, noise, and heat when not in use
|
||||
//#define SERVO_DETACH_GCODE
|
||||
|
||||
@@ -1680,7 +1680,7 @@
|
||||
* Set STATUS_EXPIRE_SECONDS to zero to never clear the status.
|
||||
* This will prevent position updates from being displayed.
|
||||
*/
|
||||
#if ENABLED(U8GLIB_ST7920)
|
||||
#if IS_U8GLIB_ST7920
|
||||
// Enable this option and reduce the value to optimize screen updates.
|
||||
// The normal delay is 10µs. Use the lowest value that still gives a reliable display.
|
||||
//#define DOGM_SPI_DELAY_US 5
|
||||
@@ -2558,8 +2558,8 @@
|
||||
#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
|
||||
#define FILAMENT_CHANGE_ALERT_BEEPS 2 // Number of alert beeps to play when a response is needed.
|
||||
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.
|
||||
#define FILAMENT_CHANGE_RESUME_ON_INSERT // Automatically continue / load filament when runout sensor is made again
|
||||
#define FILAMENT_CHANGE_FAST_RESUME // Reduce number of waits by not prompting again post timeout before continuing
|
||||
#define FILAMENT_CHANGE_RESUME_ON_INSERT // Automatically continue / load filament when runout sensor is made again
|
||||
#define PAUSE_REHEAT_FAST_RESUME // Reduce number of waits by not prompting again post timeout before continuing
|
||||
|
||||
#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
|
||||
//#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
#define STRING_DISTRIBUTION_DATE "2021-09-14"
|
||||
#define STRING_DISTRIBUTION_DATE "2021-10-09"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
void spiBegin() {
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#if PIN_EXISTS(SD_SS)
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
SET_OUTPUT(SD_SCK_PIN);
|
||||
SET_INPUT(SD_MISO_PIN);
|
||||
SET_OUTPUT(SD_MOSI_PIN);
|
||||
@@ -74,7 +76,8 @@ void spiBegin() {
|
||||
#elif defined(PRR0)
|
||||
PRR0
|
||||
#endif
|
||||
, PRSPI);
|
||||
, PRSPI
|
||||
);
|
||||
|
||||
SPCR = _BV(SPE) | _BV(MSTR) | (spiRate >> 1);
|
||||
SPSR = spiRate & 1 || spiRate == 6 ? 0 : _BV(SPI2X);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 <SPI.h>
|
||||
|
||||
using MarlinSPI = SPIClass;
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
uint8_t u8g_bitData, u8g_bitNotData, u8g_bitClock, u8g_bitNotClock;
|
||||
volatile uint8_t *u8g_outData, *u8g_outClock;
|
||||
static uint8_t u8g_bitData, u8g_bitNotData, u8g_bitClock, u8g_bitNotClock;
|
||||
static volatile uint8_t *u8g_outData, *u8g_outClock;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin) {
|
||||
u8g_outData = portOutputRegister(digitalPinToPort(dataPin));
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 <SPI.h>
|
||||
|
||||
using MarlinSPI = SPIClass;
|
||||
@@ -20,7 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Based on u8g_com_msp430_hw_spi.c
|
||||
*
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(U8GLIB_ST7920)
|
||||
#if IS_U8GLIB_ST7920
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
#include "../../shared/Delay.h"
|
||||
@@ -182,5 +182,5 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
|
||||
}
|
||||
#endif // LIGHTWEIGHT_UI
|
||||
|
||||
#endif // U8GLIB_ST7920
|
||||
#endif // IS_U8GLIB_ST7920
|
||||
#endif // ARDUINO_ARCH_SAM
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB && DISABLED(U8GLIB_ST7920)
|
||||
#if HAS_MARLINUI_U8GLIB && !IS_U8GLIB_ST7920
|
||||
|
||||
#include "u8g_com_HAL_DUE_sw_spi_shared.h"
|
||||
|
||||
@@ -141,5 +141,5 @@ uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // HAS_MARLINUI_U8GLIB && !U8GLIB_ST7920
|
||||
#endif // HAS_MARLINUI_U8GLIB && !IS_U8GLIB_ST7920
|
||||
#endif // ARDUINO_ARCH_SAM
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
#include <esp_adc_cal.h>
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#if ENABLED(USE_ESP32_TASK_WDT)
|
||||
#include <esp_task_wdt.h>
|
||||
#endif
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include "wifi.h"
|
||||
@@ -90,8 +94,24 @@ volatile int numPWMUsed = 0,
|
||||
|
||||
#endif
|
||||
|
||||
void HAL_init_board() {
|
||||
#if ENABLED(USE_ESP32_EXIO)
|
||||
HardwareSerial YSerial2(2);
|
||||
|
||||
void Write_EXIO(uint8_t IO, uint8_t v) {
|
||||
if (ISRS_ENABLED()) {
|
||||
DISABLE_ISRS();
|
||||
YSerial2.write(0x80 | (((char)v) << 5) | (IO - 100));
|
||||
ENABLE_ISRS();
|
||||
}
|
||||
else
|
||||
YSerial2.write(0x80 | (((char)v) << 5) | (IO - 100));
|
||||
}
|
||||
#endif
|
||||
|
||||
void HAL_init_board() {
|
||||
#if ENABLED(USE_ESP32_TASK_WDT)
|
||||
esp_task_wdt_init(10, true);
|
||||
#endif
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
esp3dlib.init();
|
||||
#elif ENABLED(WIFISUPPORT)
|
||||
@@ -127,7 +147,11 @@ void HAL_init_board() {
|
||||
// Initialize the i2s peripheral only if the I2S stepper stream is enabled.
|
||||
// The following initialization is performed after Serial1 and Serial2 are defined as
|
||||
// their native pins might conflict with the i2s stream even when they are remapped.
|
||||
TERN_(I2S_STEPPER_STREAM, i2s_init());
|
||||
#if ENABLED(USE_ESP32_EXIO)
|
||||
YSerial2.begin(460800 * 3, SERIAL_8N1, 16, 17);
|
||||
#elif ENABLED(I2S_STEPPER_STREAM)
|
||||
i2s_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void HAL_idletask() {
|
||||
|
||||
@@ -142,6 +142,10 @@ void HAL_idletask();
|
||||
inline void HAL_init() {}
|
||||
void HAL_init_board();
|
||||
|
||||
#if ENABLED(USE_ESP32_EXIO)
|
||||
void Write_EXIO(uint8_t IO, uint8_t v);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Delay in cycles (used by DELAY_NS / DELAY_US)
|
||||
//
|
||||
|
||||
@@ -53,11 +53,9 @@ static SPISettings spiConfig;
|
||||
// ------------------------
|
||||
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SD_SS)
|
||||
#error "SD_SS_PIN not defined!"
|
||||
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_SS)
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
void spiInit(uint8_t spiRate) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 <SPI.h>
|
||||
|
||||
using MarlinSPI = SPIClass;
|
||||
@@ -0,0 +1,6 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 0x9000, 0x5000,
|
||||
otadata, data, ota, 0xe000, 0x2000,
|
||||
app0, app, ota_0, 0x10000, 0x180000,
|
||||
app1, app, ota_1, 0x190000, 0x180000,
|
||||
spiffs, data, spiffs, 0x310000, 0xF0000,
|
||||
|
@@ -40,13 +40,19 @@
|
||||
// Set pin as input with pullup mode
|
||||
#define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT)
|
||||
|
||||
// Read a pin wrapper
|
||||
#define READ(IO) (IS_I2S_EXPANDER_PIN(IO) ? i2s_state(I2S_EXPANDER_PIN_INDEX(IO)) : digitalRead(IO))
|
||||
#if ENABLED(USE_ESP32_EXIO)
|
||||
// Read a pin wrapper
|
||||
#define READ(IO) digitalRead(IO)
|
||||
// Write to a pin wrapper
|
||||
#define WRITE(IO, v) (IO >= 100 ? Write_EXIO(IO, v) : digitalWrite(IO, v))
|
||||
#else
|
||||
// Read a pin wrapper
|
||||
#define READ(IO) (IS_I2S_EXPANDER_PIN(IO) ? i2s_state(I2S_EXPANDER_PIN_INDEX(IO)) : digitalRead(IO))
|
||||
// Write to a pin wrapper
|
||||
#define WRITE(IO, v) (IS_I2S_EXPANDER_PIN(IO) ? i2s_write(I2S_EXPANDER_PIN_INDEX(IO), v) : digitalWrite(IO, v))
|
||||
#endif
|
||||
|
||||
// Write to a pin wrapper
|
||||
#define WRITE(IO, v) (IS_I2S_EXPANDER_PIN(IO) ? i2s_write(I2S_EXPANDER_PIN_INDEX(IO), v) : digitalWrite(IO, v))
|
||||
|
||||
// Set pin as input wrapper
|
||||
// Set pin as input wrapper (0x80 | (v << 5) | (IO - 100))
|
||||
#define SET_INPUT(IO) _SET_INPUT(IO)
|
||||
|
||||
// Set pin as input with pullup wrapper
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if DISABLED(USE_ESP32_EXIO)
|
||||
|
||||
#include "i2s.h"
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
@@ -340,4 +342,5 @@ void i2s_push_sample() {
|
||||
dma.current[dma.rw_pos++] = i2s_port_data;
|
||||
}
|
||||
|
||||
#endif // !USE_ESP32_EXIO
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
esp_err_t esp_task_wdt_reset();
|
||||
esp_err_t esp_task_wdt_reset();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 <SPI.h>
|
||||
|
||||
using MarlinSPI = SPIClass;
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
@@ -16,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __PLAT_LINUX__
|
||||
|
||||
//#define GPIO_LOGGING // Full GPIO and Positional Logging
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -156,17 +156,17 @@ int freeMemory();
|
||||
|
||||
using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
|
||||
extern uint32_t HAL_adc_reading;
|
||||
[[gnu::always_inline]] inline void HAL_start_adc(const pin_t pin) {
|
||||
[[gnu::always_inline]] inline void HAL_adc_start_conversion(const pin_t pin) {
|
||||
HAL_adc_reading = FilteredADC::read(pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits
|
||||
}
|
||||
[[gnu::always_inline]] inline uint16_t HAL_read_adc() {
|
||||
[[gnu::always_inline]] inline uint16_t HAL_adc_get_result() {
|
||||
return HAL_adc_reading;
|
||||
}
|
||||
|
||||
#define HAL_adc_init()
|
||||
#define HAL_ANALOG_SELECT(pin) FilteredADC::enable_channel(pin)
|
||||
#define HAL_START_ADC(pin) HAL_start_adc(pin)
|
||||
#define HAL_READ_ADC() HAL_read_adc()
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_READ_ADC() HAL_adc_get_result()
|
||||
#define HAL_ADC_READY() (true)
|
||||
|
||||
// Test whether the pin is valid
|
||||
|
||||
@@ -90,15 +90,15 @@ bool PersistentStore::access_finish() {
|
||||
// to see errors that are happening in read_data / write_data
|
||||
static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) {
|
||||
#if ENABLED(DEBUG_SD_EEPROM_EMULATION)
|
||||
PGM_P const rw_str = write ? PSTR("write") : PSTR("read");
|
||||
FSTR_P const rw_str = write ? F("write") : F("read");
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOPGM_P(rw_str);
|
||||
SERIAL_ECHOF(rw_str);
|
||||
SERIAL_ECHOLNPGM("_data(", pos, ",", *value, ",", size, ", ...)");
|
||||
if (total) {
|
||||
SERIAL_ECHOPGM(" f_");
|
||||
SERIAL_ECHOPGM_P(rw_str);
|
||||
SERIAL_ECHOF(rw_str);
|
||||
SERIAL_ECHOPGM("()=", s, "\n size=", size, "\n bytes_");
|
||||
SERIAL_ECHOLNPGM_P(write ? PSTR("written=") : PSTR("read="), total);
|
||||
SERIAL_ECHOLNF(write ? F("written=") : F("read="), total);
|
||||
}
|
||||
else
|
||||
SERIAL_ECHOLNPGM(" f_lseek()=", s);
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -26,39 +26,22 @@
|
||||
|
||||
#include "tft_spi.h"
|
||||
|
||||
//TFT_SPI tft;
|
||||
|
||||
SPIClass TFT_SPI::SPIx(1);
|
||||
|
||||
#define TFT_CS_H WRITE(TFT_CS_PIN, HIGH)
|
||||
#define TFT_CS_L WRITE(TFT_CS_PIN, LOW)
|
||||
|
||||
#define TFT_DC_H WRITE(TFT_DC_PIN, HIGH)
|
||||
#define TFT_DC_L WRITE(TFT_DC_PIN, LOW)
|
||||
|
||||
#define TFT_RST_H WRITE(TFT_RESET_PIN, HIGH)
|
||||
#define TFT_RST_L WRITE(TFT_RESET_PIN, LOW)
|
||||
|
||||
#define TFT_BLK_H WRITE(TFT_BACKLIGHT_PIN, HIGH)
|
||||
#define TFT_BLK_L WRITE(TFT_BACKLIGHT_PIN, LOW)
|
||||
|
||||
void TFT_SPI::Init() {
|
||||
#if PIN_EXISTS(TFT_RESET)
|
||||
SET_OUTPUT(TFT_RESET_PIN);
|
||||
TFT_RST_H;
|
||||
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||
delay(100);
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
SET_OUTPUT(TFT_BACKLIGHT_PIN);
|
||||
TFT_BLK_H;
|
||||
OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
SET_OUTPUT(TFT_DC_PIN);
|
||||
SET_OUTPUT(TFT_CS_PIN);
|
||||
|
||||
TFT_DC_H;
|
||||
TFT_CS_H;
|
||||
WRITE(TFT_DC_PIN, HIGH);
|
||||
WRITE(TFT_CS_PIN, HIGH);
|
||||
|
||||
/**
|
||||
* STM32F1 APB2 = 72MHz, APB1 = 36MHz, max SPI speed of this MCU if 18Mhz
|
||||
@@ -97,7 +80,7 @@ void TFT_SPI::Init() {
|
||||
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
|
||||
SPIx.setDataSize(DataSize);
|
||||
SPIx.begin();
|
||||
TFT_CS_L;
|
||||
WRITE(TFT_CS_PIN, LOW);
|
||||
}
|
||||
|
||||
uint32_t TFT_SPI::GetID() {
|
||||
@@ -116,7 +99,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
||||
SPIx.setDataSize(DATASIZE_8BIT);
|
||||
SPIx.setClock(SPI_CLOCK_DIV64);
|
||||
SPIx.begin();
|
||||
TFT_CS_L;
|
||||
WRITE(TFT_CS_PIN, LOW);
|
||||
WriteReg(Reg);
|
||||
|
||||
LOOP_L_N(i, 4) {
|
||||
@@ -131,21 +114,15 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
||||
return data >> 7;
|
||||
}
|
||||
|
||||
bool TFT_SPI::isBusy() {
|
||||
return false;
|
||||
}
|
||||
bool TFT_SPI::isBusy() { return false; }
|
||||
|
||||
void TFT_SPI::Abort() {
|
||||
DataTransferEnd();
|
||||
}
|
||||
void TFT_SPI::Abort() { DataTransferEnd(); }
|
||||
|
||||
void TFT_SPI::Transmit(uint16_t Data) {
|
||||
SPIx.transfer(Data);
|
||||
}
|
||||
void TFT_SPI::Transmit(uint16_t Data) { SPIx.transfer(Data); }
|
||||
|
||||
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
||||
DataTransferBegin(DATASIZE_16BIT); //16
|
||||
TFT_DC_H;
|
||||
DataTransferBegin(DATASIZE_16BIT);
|
||||
WRITE(TFT_DC_PIN, HIGH);
|
||||
SPIx.dmaSend(Data, Count, MemoryIncrease);
|
||||
DataTransferEnd();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(U8GLIB_ST7920)
|
||||
#if IS_U8GLIB_ST7920
|
||||
|
||||
#include <U8glib-HAL.h>
|
||||
#include <SoftwareSPI.h>
|
||||
@@ -143,5 +143,5 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // U8GLIB_ST7920
|
||||
#endif // IS_U8GLIB_ST7920
|
||||
#endif // TARGET_LPC1768
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB && DISABLED(U8GLIB_ST7920)
|
||||
#if HAS_MARLINUI_U8GLIB && !IS_U8GLIB_ST7920
|
||||
|
||||
#include <SoftwareSPI.h>
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
@@ -205,5 +205,5 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // HAS_MARLINUI_U8GLIB && !U8GLIB_ST7920
|
||||
#endif // HAS_MARLINUI_U8GLIB && !IS_U8GLIB_ST7920
|
||||
#endif // TARGET_LPC1768
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
/**
|
||||
* Support routines for X86_64
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(U8GLIB_ST7920)
|
||||
#if IS_U8GLIB_ST7920
|
||||
|
||||
#include <U8glib-HAL.h>
|
||||
#include "../../shared/Delay.h"
|
||||
@@ -167,5 +167,5 @@ uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // U8GLIB_ST7920
|
||||
#endif // IS_U8GLIB_ST7920
|
||||
#endif // TARGET_LPC1768
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB && DISABLED(U8GLIB_ST7920)
|
||||
#if HAS_MARLINUI_U8GLIB && !IS_U8GLIB_ST7920
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 2 // About 2 MHz
|
||||
@@ -211,5 +211,5 @@ uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt
|
||||
#elif !ANY(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI, HAS_MARLINUI_HD44780) && HAS_MARLINUI_U8GLIB
|
||||
#include <U8glib-HAL.h>
|
||||
uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {return 0;}
|
||||
#endif // HAS_MARLINUI_U8GLIB && !U8GLIB_ST7920
|
||||
#endif // HAS_MARLINUI_U8GLIB && !IS_U8GLIB_ST7920
|
||||
#endif // __PLAT_NATIVE_SIM__
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 <SPI.h>
|
||||
|
||||
using MarlinSPI = SPIClass;
|
||||
@@ -25,7 +25,6 @@
|
||||
*
|
||||
* Derived from Adafruit_SPIFlash class with no SdFat references
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Adafruit_SPIFlashBase.h>
|
||||
|
||||
@@ -162,12 +162,14 @@ void setup_endstop_interrupts() {
|
||||
#error "Z_MIN_PROBE_PIN has no EXTINT line available."
|
||||
#endif
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#elif HAS_I_MAX
|
||||
#endif
|
||||
#if HAS_I_MAX
|
||||
#if !AVAILABLE_EILINE(I_MAX_PIN)
|
||||
#error "I_MAX_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(I_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#elif HAS_I_MIN
|
||||
#endif
|
||||
#if HAS_I_MIN
|
||||
#if !AVAILABLE_EILINE(I_MIN_PIN)
|
||||
#error "I_MIN_PIN has no EXTINT line available."
|
||||
#endif
|
||||
@@ -178,7 +180,8 @@ void setup_endstop_interrupts() {
|
||||
#error "J_MAX_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(J_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#elif HAS_J_MIN
|
||||
#endif
|
||||
#if HAS_J_MIN
|
||||
#if !AVAILABLE_EILINE(J_MIN_PIN)
|
||||
#error "J_MIN_PIN has no EXTINT line available."
|
||||
#endif
|
||||
@@ -189,7 +192,8 @@ void setup_endstop_interrupts() {
|
||||
#error "K_MAX_PIN has no EXTINT line available."
|
||||
#endif
|
||||
attachInterrupt(K_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#elif HAS_K_MIN
|
||||
#endif
|
||||
#if HAS_K_MIN
|
||||
#if !AVAILABLE_EILINE(K_MIN_PIN)
|
||||
#error "K_MIN_PIN has no EXTINT line available."
|
||||
#endif
|
||||
|
||||
@@ -183,8 +183,13 @@ static inline int freeMemory() {
|
||||
|
||||
#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT)
|
||||
|
||||
#ifdef ADC_RESOLUTION
|
||||
#define HAL_ADC_RESOLUTION ADC_RESOLUTION
|
||||
#else
|
||||
#define HAL_ADC_RESOLUTION 12
|
||||
#endif
|
||||
|
||||
#define HAL_ADC_VREF 3.3
|
||||
#define HAL_ADC_RESOLUTION ADC_RESOLUTION // 12
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
@@ -47,7 +47,9 @@ static SPISettings spiConfig;
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
void spiBegin(void) {
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#if PIN_EXISTS(SD_SS)
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
OUT_WRITE(SD_SCK_PIN, HIGH);
|
||||
SET_INPUT(SD_MISO_PIN);
|
||||
OUT_WRITE(SD_MOSI_PIN, HIGH);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#if defined(HAL_STM32) && !defined(STM32H7xx)
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
@@ -16,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -183,7 +183,7 @@ void LTDC_Config() {
|
||||
hltdc_F.Init.AccumulatedVBP = (LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
|
||||
hltdc_F.Init.AccumulatedActiveH = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
|
||||
hltdc_F.Init.AccumulatedActiveW = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP - 1);
|
||||
hltdc_F.Init.TotalHeight = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP + LTDC_LCD_VFP - 1);
|
||||
hltdc_F.Init.TotalHeigh = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP + LTDC_LCD_VFP - 1);
|
||||
hltdc_F.Init.TotalWidth = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP + LTDC_LCD_HFP - 1);
|
||||
|
||||
/* Configure R,G,B component values for LCD background color : all black background */
|
||||
@@ -205,7 +205,7 @@ void LTDC_Config() {
|
||||
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
|
||||
|
||||
/* Start Address configuration : frame buffer is located at SDRAM memory */
|
||||
pLayerCfg.FBStartAddress = (uint32_t)(FRAME_BUFFER_ADDRESS);
|
||||
pLayerCfg.FBStartAdress = (uint32_t)(FRAME_BUFFER_ADDRESS);
|
||||
|
||||
/* Alpha constant (255 == totally opaque) */
|
||||
pLayerCfg.Alpha = 255;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
@@ -16,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -437,7 +437,7 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
case POWER_MONITOR_VOLTAGE_PIN: pin_index = POWERMON_VOLTS; break;
|
||||
#endif
|
||||
}
|
||||
HAL_adc_result = (HAL_adc_results[(int)pin_index] >> 2) & 0x3FF; // shift to get 10 bits only.
|
||||
HAL_adc_result = HAL_adc_results[(int)pin_index] >> (12 - HAL_ADC_RESOLUTION); // shift out unused bits
|
||||
}
|
||||
|
||||
uint16_t HAL_adc_get_result() { return HAL_adc_result; }
|
||||
|
||||
@@ -237,8 +237,13 @@ static inline int freeMemory() {
|
||||
|
||||
void HAL_adc_init();
|
||||
|
||||
#ifdef ADC_RESOLUTION
|
||||
#define HAL_ADC_RESOLUTION ADC_RESOLUTION
|
||||
#else
|
||||
#define HAL_ADC_RESOLUTION 12
|
||||
#endif
|
||||
|
||||
#define HAL_ADC_VREF 3.3
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
@@ -16,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -26,36 +26,20 @@
|
||||
|
||||
#include "tft_spi.h"
|
||||
|
||||
// TFT_SPI tft;
|
||||
|
||||
SPIClass TFT_SPI::SPIx(1);
|
||||
|
||||
#define TFT_CS_H OUT_WRITE(TFT_CS_PIN, HIGH)
|
||||
#define TFT_CS_L OUT_WRITE(TFT_CS_PIN, LOW)
|
||||
|
||||
#define TFT_DC_H OUT_WRITE(TFT_DC_PIN, HIGH)
|
||||
#define TFT_DC_L OUT_WRITE(TFT_DC_PIN, LOW)
|
||||
|
||||
#define TFT_RST_H OUT_WRITE(TFT_RST_PIN, HIGH)
|
||||
#define TFT_RST_L OUT_WRITE(TFT_RST_PIN, LOW)
|
||||
|
||||
#define TFT_BLK_H OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH)
|
||||
#define TFT_BLK_L OUT_WRITE(TFT_BACKLIGHT_PIN, LOW)
|
||||
|
||||
void TFT_SPI::Init() {
|
||||
#if PIN_EXISTS(TFT_RESET)
|
||||
// OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||
TFT_RST_H;
|
||||
OUT_WRITE(TFT_RST_PIN, HIGH);
|
||||
delay(100);
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
// OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
||||
TFT_BLK_H;
|
||||
OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
TFT_DC_H;
|
||||
TFT_CS_H;
|
||||
OUT_WRITE(TFT_DC_PIN, HIGH);
|
||||
OUT_WRITE(TFT_CS_PIN, HIGH);
|
||||
|
||||
/**
|
||||
* STM32F1 APB2 = 72MHz, APB1 = 36MHz, max SPI speed of this MCU if 18Mhz
|
||||
@@ -87,7 +71,7 @@ void TFT_SPI::Init() {
|
||||
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
|
||||
SPIx.setDataSize(DataSize);
|
||||
SPIx.begin();
|
||||
TFT_CS_L;
|
||||
OUT_WRITE(TFT_CS_PIN, LOW);
|
||||
}
|
||||
|
||||
#ifdef TFT_DEFAULT_DRIVER
|
||||
@@ -129,28 +113,16 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool TFT_SPI::isBusy() {
|
||||
return false;
|
||||
}
|
||||
bool TFT_SPI::isBusy() { return false; }
|
||||
|
||||
void TFT_SPI::Abort() {
|
||||
DataTransferEnd();
|
||||
}
|
||||
void TFT_SPI::Abort() { DataTransferEnd(); }
|
||||
|
||||
void TFT_SPI::Transmit(uint16_t Data) {
|
||||
SPIx.send(Data);
|
||||
}
|
||||
void TFT_SPI::Transmit(uint16_t Data) { SPIx.send(Data); }
|
||||
|
||||
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
||||
DataTransferBegin();
|
||||
TFT_DC_H;
|
||||
if (MemoryIncrease == DMA_MINC_ENABLE) {
|
||||
SPIx.dmaSend(Data, Count, true);
|
||||
}
|
||||
else {
|
||||
SPIx.dmaSend(Data, Count, false);
|
||||
}
|
||||
|
||||
OUT_WRITE(TFT_DC_PIN, HIGH);
|
||||
SPIx.dmaSend(Data, Count, MemoryIncrease == DMA_MINC_ENABLE);
|
||||
DataTransferEnd();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,9 @@ static SPISettings spiConfig;
|
||||
|
||||
// Initialize SPI bus
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SD_SS)
|
||||
#error "SD_SS_PIN not defined!"
|
||||
#if PIN_EXISTS(SD_SS)
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
SET_OUTPUT(SD_SCK_PIN);
|
||||
SET_INPUT(SD_MISO_PIN);
|
||||
SET_OUTPUT(SD_MOSI_PIN);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 <SPI.h>
|
||||
|
||||
using MarlinSPI = SPIClass;
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
@@ -16,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __MK20DX256__
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,10 +36,9 @@
|
||||
static SPISettings spiConfig;
|
||||
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SD_SS)
|
||||
#error "SD_SS_PIN not defined!"
|
||||
#if PIN_EXISTS(SD_SS)
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
SET_OUTPUT(SD_SCK_PIN);
|
||||
SET_INPUT(SD_MISO_PIN);
|
||||
SET_OUTPUT(SD_MOSI_PIN);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 <SPI.h>
|
||||
|
||||
using MarlinSPI = SPIClass;
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -51,12 +51,9 @@ static SPISettings spiConfig;
|
||||
// ------------------------
|
||||
|
||||
void spiBegin() {
|
||||
#ifndef SD_SS_PIN
|
||||
#error "SD_SS_PIN is not defined!"
|
||||
#if PIN_EXISTS(SD_SS)
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
OUT_WRITE(SD_SS_PIN, HIGH);
|
||||
|
||||
//SET_OUTPUT(SD_SCK_PIN);
|
||||
//SET_INPUT(SD_MISO_PIN);
|
||||
//SET_OUTPUT(SD_MOSI_PIN);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 <SPI.h>
|
||||
|
||||
using MarlinSPI = SPIClass;
|
||||
@@ -2,6 +2,9 @@
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Delay.h"
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
@@ -107,13 +108,14 @@
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
void dump_delay_accuracy_check() {
|
||||
auto report_call_time = [](PGM_P const name, PGM_P const unit, const uint32_t cycles, const uint32_t total, const bool do_flush=true) {
|
||||
auto report_call_time = [](FSTR_P const name, FSTR_P const unit, const uint32_t cycles, const uint32_t total, const bool do_flush=true) {
|
||||
SERIAL_ECHOPGM("Calling ");
|
||||
SERIAL_ECHOPGM_P(name);
|
||||
SERIAL_ECHOF(name);
|
||||
SERIAL_ECHOLNPGM(" for ", cycles);
|
||||
SERIAL_ECHOPGM_P(unit);
|
||||
SERIAL_ECHOF(unit);
|
||||
SERIAL_ECHOLNPGM(" took: ", total);
|
||||
SERIAL_ECHOPGM_P(unit);
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOF(unit);
|
||||
if (do_flush) SERIAL_FLUSHTX();
|
||||
};
|
||||
|
||||
@@ -125,41 +127,42 @@
|
||||
constexpr uint32_t testValues[] = { 1, 5, 10, 20, 50, 100, 150, 200, 350, 500, 750, 1000 };
|
||||
for (auto i : testValues) {
|
||||
s = micros(); DELAY_US(i); e = micros();
|
||||
report_call_time(PSTR("delay"), PSTR("us"), i, e - s);
|
||||
report_call_time(F("delay"), F("us"), i, e - s);
|
||||
}
|
||||
|
||||
if (HW_REG(_DWT_CTRL)) {
|
||||
static FSTR_P cyc = F("cycles");
|
||||
static FSTR_P dcd = F("DELAY_CYCLES directly ");
|
||||
|
||||
for (auto i : testValues) {
|
||||
s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(i); e = HW_REG(_DWT_CYCCNT);
|
||||
report_call_time(PSTR("runtime delay"), PSTR("cycles"), i, e - s);
|
||||
report_call_time(F("runtime delay"), cyc, i, e - s);
|
||||
}
|
||||
|
||||
// Measure the delay to call a real function compared to a function pointer
|
||||
s = HW_REG(_DWT_CYCCNT); delay_dwt(1); e = HW_REG(_DWT_CYCCNT);
|
||||
report_call_time(PSTR("delay_dwt"), PSTR("cycles"), 1, e - s);
|
||||
|
||||
static PGMSTR(dcd, "DELAY_CYCLES directly ");
|
||||
report_call_time(F("delay_dwt"), cyc, 1, e - s);
|
||||
|
||||
s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES( 1); e = HW_REG(_DWT_CYCCNT);
|
||||
report_call_time(dcd, PSTR("cycles"), 1, e - s, false);
|
||||
report_call_time(dcd, cyc, 1, e - s, false);
|
||||
|
||||
s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES( 5); e = HW_REG(_DWT_CYCCNT);
|
||||
report_call_time(dcd, PSTR("cycles"), 5, e - s, false);
|
||||
report_call_time(dcd, cyc, 5, e - s, false);
|
||||
|
||||
s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(10); e = HW_REG(_DWT_CYCCNT);
|
||||
report_call_time(dcd, PSTR("cycles"), 10, e - s, false);
|
||||
report_call_time(dcd, cyc, 10, e - s, false);
|
||||
|
||||
s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(20); e = HW_REG(_DWT_CYCCNT);
|
||||
report_call_time(dcd, PSTR("cycles"), 20, e - s, false);
|
||||
report_call_time(dcd, cyc, 20, e - s, false);
|
||||
|
||||
s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(50); e = HW_REG(_DWT_CYCCNT);
|
||||
report_call_time(dcd, PSTR("cycles"), 50, e - s, false);
|
||||
report_call_time(dcd, cyc, 50, e - s, false);
|
||||
|
||||
s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(100); e = HW_REG(_DWT_CYCCNT);
|
||||
report_call_time(dcd, PSTR("cycles"), 100, e - s, false);
|
||||
report_call_time(dcd, cyc, 100, e - s, false);
|
||||
|
||||
s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(200); e = HW_REG(_DWT_CYCCNT);
|
||||
report_call_time(dcd, PSTR("cycles"), 200, e - s, false);
|
||||
report_call_time(dcd, cyc, 200, e - s, false);
|
||||
}
|
||||
}
|
||||
#endif // MARLIN_DEV_MODE
|
||||
@@ -169,7 +172,7 @@
|
||||
|
||||
void calibrate_delay_loop() {}
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
void dump_delay_accuracy_check() { SERIAL_ECHOPGM_P(PSTR("N/A on this platform")); }
|
||||
void dump_delay_accuracy_check() { SERIAL_ECHOPGM("N/A on this platform"); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -83,7 +83,14 @@
|
||||
#endif
|
||||
|
||||
#ifndef FORCE_INLINE
|
||||
#define FORCE_INLINE inline __attribute__((always_inline))
|
||||
#define FORCE_INLINE __attribute__((always_inline)) inline
|
||||
#endif
|
||||
|
||||
#include "progmem.h"
|
||||
|
||||
class __FlashStringHelper;
|
||||
typedef const __FlashStringHelper* FSTR_P;
|
||||
#ifndef FPSTR
|
||||
#define FPSTR(S) (reinterpret_cast<FSTR_P>(S))
|
||||
#endif
|
||||
#define FTOP(S) (reinterpret_cast<const char*>(S))
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
#define PSTR(str) (str)
|
||||
#endif
|
||||
#ifndef F
|
||||
#define F(str) (str)
|
||||
class __FlashStringHelper;
|
||||
#define F(str) (reinterpret_cast<const __FlashStringHelper *>(PSTR(str)))
|
||||
#endif
|
||||
#ifndef _SFR_BYTE
|
||||
#define _SFR_BYTE(n) (n)
|
||||
@@ -110,7 +111,7 @@
|
||||
#define strrchr_P(str, c) strrchr((str), (c))
|
||||
#endif
|
||||
#ifndef strsep_P
|
||||
#define strsep_P(strp, delim) strsep((strp), (delim))
|
||||
#define strsep_P(pstr, delim) strsep((pstr), (delim))
|
||||
#endif
|
||||
#ifndef strspn_P
|
||||
#define strspn_P(str, chrs) strspn((str), (chrs))
|
||||
|
||||
+41
-89
@@ -30,10 +30,6 @@
|
||||
|
||||
#include "MarlinCore.h"
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
#warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
|
||||
#endif
|
||||
|
||||
#include "HAL/shared/Delay.h"
|
||||
#include "HAL/shared/esp_wifi.h"
|
||||
#include "HAL/shared/cpu_exception/exception_hook.h"
|
||||
@@ -74,19 +70,15 @@
|
||||
#include <lvgl.h>
|
||||
#endif
|
||||
|
||||
#if ENABLED(DWIN_CREALITY_LCD)
|
||||
#include "lcd/e3v2/creality/dwin.h"
|
||||
#include "lcd/e3v2/creality/rotary_encoder.h"
|
||||
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
|
||||
#include "lcd/e3v2/enhanced/dwin.h"
|
||||
#include "lcd/e3v2/enhanced/rotary_encoder.h"
|
||||
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
||||
#include "lcd/e3v2/jyersui/dwin.h"
|
||||
#include "lcd/e3v2/jyersui/rotary_encoder.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "lcd/extui/ui_api.h"
|
||||
#if HAS_DWIN_E3V2
|
||||
#include "lcd/e3v2/common/encoder.h"
|
||||
#if ENABLED(DWIN_CREALITY_LCD)
|
||||
#include "lcd/e3v2/creality/dwin.h"
|
||||
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
|
||||
#include "lcd/e3v2/enhanced/dwin.h"
|
||||
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
||||
#include "lcd/e3v2/jyersui/dwin.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_ETHERNET
|
||||
@@ -172,6 +164,8 @@
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
#include "module/delta.h"
|
||||
#elif ENABLED(POLARGRAPH)
|
||||
#include "module/polargraph.h"
|
||||
#elif IS_SCARA
|
||||
#include "module/scara.h"
|
||||
#endif
|
||||
@@ -314,48 +308,6 @@ bool pin_is_protected(const pin_t pin) {
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
void enable_e_steppers() {
|
||||
#define _ENA_E(N) ENABLE_AXIS_E##N();
|
||||
REPEAT(E_STEPPERS, _ENA_E)
|
||||
}
|
||||
|
||||
void enable_all_steppers() {
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
ENABLE_AXIS_X();
|
||||
ENABLE_AXIS_Y();
|
||||
ENABLE_AXIS_Z();
|
||||
ENABLE_AXIS_I(); // Marlin 6-axis support by DerAndere (https://github.com/DerAndere1/Marlin/wiki)
|
||||
ENABLE_AXIS_J();
|
||||
ENABLE_AXIS_K();
|
||||
enable_e_steppers();
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onSteppersEnabled());
|
||||
}
|
||||
|
||||
void disable_e_steppers() {
|
||||
#define _DIS_E(N) DISABLE_AXIS_E##N();
|
||||
REPEAT(E_STEPPERS, _DIS_E)
|
||||
}
|
||||
|
||||
void disable_e_stepper(const uint8_t e) {
|
||||
#define _CASE_DIS_E(N) case N: DISABLE_AXIS_E##N(); break;
|
||||
switch (e) {
|
||||
REPEAT(E_STEPPERS, _CASE_DIS_E)
|
||||
}
|
||||
}
|
||||
|
||||
void disable_all_steppers() {
|
||||
DISABLE_AXIS_X();
|
||||
DISABLE_AXIS_Y();
|
||||
DISABLE_AXIS_Z();
|
||||
DISABLE_AXIS_I();
|
||||
DISABLE_AXIS_J();
|
||||
DISABLE_AXIS_K();
|
||||
disable_e_steppers();
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onSteppersDisabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* A Print Job exists when the timer is running or SD is printing
|
||||
*/
|
||||
@@ -405,15 +357,15 @@ void startOrResumeJob() {
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
|
||||
|
||||
#ifdef EVENT_GCODE_SD_ABORT
|
||||
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
|
||||
queue.inject(F(EVENT_GCODE_SD_ABORT));
|
||||
#endif
|
||||
|
||||
TERN_(PASSWORD_AFTER_SD_PRINT_ABORT, password.lock_machine());
|
||||
}
|
||||
|
||||
inline void finishSDPrinting() {
|
||||
if (queue.enqueue_one_P(PSTR("M1001"))) { // Keep trying until it gets queued
|
||||
marlin_state = MF_RUNNING; // Signal to stop trying
|
||||
if (queue.enqueue_one(F("M1001"))) { // Keep trying until it gets queued
|
||||
marlin_state = MF_RUNNING; // Signal to stop trying
|
||||
TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
|
||||
TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished());
|
||||
}
|
||||
@@ -466,13 +418,13 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
|
||||
|
||||
// Individual axes will be disabled if configured
|
||||
if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X();
|
||||
if (ENABLED(DISABLE_INACTIVE_Y)) DISABLE_AXIS_Y();
|
||||
if (ENABLED(DISABLE_INACTIVE_Z)) DISABLE_AXIS_Z();
|
||||
if (ENABLED(DISABLE_INACTIVE_I)) DISABLE_AXIS_I();
|
||||
if (ENABLED(DISABLE_INACTIVE_J)) DISABLE_AXIS_J();
|
||||
if (ENABLED(DISABLE_INACTIVE_K)) DISABLE_AXIS_K();
|
||||
if (ENABLED(DISABLE_INACTIVE_E)) disable_e_steppers();
|
||||
TERN_(DISABLE_INACTIVE_X, stepper.disable_axis(X_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_Y, stepper.disable_axis(Y_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_Z, stepper.disable_axis(Z_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_I, stepper.disable_axis(I_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_J, stepper.disable_axis(J_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_K, stepper.disable_axis(K_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_E, stepper.disable_e_steppers());
|
||||
|
||||
TERN_(AUTO_BED_LEVELING_UBL, ubl.steppers_were_disabled());
|
||||
}
|
||||
@@ -522,7 +474,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed
|
||||
if (ELAPSED(ms, next_home_key_ms)) {
|
||||
next_home_key_ms = ms + HOME_DEBOUNCE_DELAY;
|
||||
LCD_MESSAGEPGM(MSG_AUTO_HOME);
|
||||
LCD_MESSAGE(MSG_AUTO_HOME);
|
||||
queue.inject_P(G28_STR);
|
||||
}
|
||||
}
|
||||
@@ -541,14 +493,14 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
if (ELAPSED(ms, next_cub_ms_##N)) { \
|
||||
next_cub_ms_##N = ms + CUB_DEBOUNCE_DELAY_##N; \
|
||||
CODE; \
|
||||
queue.inject_P(PSTR(BUTTON##N##_GCODE)); \
|
||||
queue.inject(F(BUTTON##N##_GCODE)); \
|
||||
TERN_(HAS_LCD_MENU, ui.quick_feedback()); \
|
||||
} \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#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)))
|
||||
#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_MESSAGE_F(BUTTON##N##_DESC))
|
||||
|
||||
#if HAS_BETTER_USER_BUTTON(1)
|
||||
CHECK_BETTER_USER_BUTTON(1);
|
||||
@@ -691,13 +643,13 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
#if ENABLED(SWITCHING_EXTRUDER)
|
||||
bool oldstatus;
|
||||
switch (active_extruder) {
|
||||
default: oldstatus = E0_ENABLE_READ(); ENABLE_AXIS_E0(); break;
|
||||
default: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 0); stepper.ENABLE_EXTRUDER(0); break;
|
||||
#if E_STEPPERS > 1
|
||||
case 2: case 3: oldstatus = E1_ENABLE_READ(); ENABLE_AXIS_E1(); break;
|
||||
case 2: case 3: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 1); stepper.ENABLE_EXTRUDER(1); break;
|
||||
#if E_STEPPERS > 2
|
||||
case 4: case 5: oldstatus = E2_ENABLE_READ(); ENABLE_AXIS_E2(); break;
|
||||
case 4: case 5: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 2); stepper.ENABLE_EXTRUDER(2); break;
|
||||
#if E_STEPPERS > 3
|
||||
case 6: case 7: oldstatus = E3_ENABLE_READ(); ENABLE_AXIS_E3(); break;
|
||||
case 6: case 7: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 3); stepper.ENABLE_EXTRUDER(3); break;
|
||||
#endif // E_STEPPERS > 3
|
||||
#endif // E_STEPPERS > 2
|
||||
#endif // E_STEPPERS > 1
|
||||
@@ -706,7 +658,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
bool oldstatus;
|
||||
switch (active_extruder) {
|
||||
default:
|
||||
#define _CASE_EN(N) case N: oldstatus = E##N##_ENABLE_READ(); ENABLE_AXIS_E##N(); break;
|
||||
#define _CASE_EN(N) case N: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, N); stepper.ENABLE_EXTRUDER(N); break;
|
||||
REPEAT(E_STEPPERS, _CASE_EN);
|
||||
}
|
||||
#endif
|
||||
@@ -720,17 +672,17 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
|
||||
#if ENABLED(SWITCHING_EXTRUDER)
|
||||
switch (active_extruder) {
|
||||
default: oldstatus = E0_ENABLE_WRITE(oldstatus); break;
|
||||
default: if (oldstatus) stepper.ENABLE_EXTRUDER(0); else stepper.DISABLE_EXTRUDER(0); break;
|
||||
#if E_STEPPERS > 1
|
||||
case 2: case 3: oldstatus = E1_ENABLE_WRITE(oldstatus); break;
|
||||
case 2: case 3: if (oldstatus) stepper.ENABLE_EXTRUDER(1); else stepper.DISABLE_EXTRUDER(1); break;
|
||||
#if E_STEPPERS > 2
|
||||
case 4: case 5: oldstatus = E2_ENABLE_WRITE(oldstatus); break;
|
||||
case 4: case 5: if (oldstatus) stepper.ENABLE_EXTRUDER(2); else stepper.DISABLE_EXTRUDER(2); break;
|
||||
#endif // E_STEPPERS > 2
|
||||
#endif // E_STEPPERS > 1
|
||||
}
|
||||
#else // !SWITCHING_EXTRUDER
|
||||
switch (active_extruder) {
|
||||
#define _CASE_RESTORE(N) case N: E##N##_ENABLE_WRITE(oldstatus); break;
|
||||
#define _CASE_RESTORE(N) case N: if (oldstatus) stepper.ENABLE_EXTRUDER(N); else stepper.DISABLE_EXTRUDER(N); break;
|
||||
REPEAT(E_STEPPERS, _CASE_RESTORE);
|
||||
}
|
||||
#endif // !SWITCHING_EXTRUDER
|
||||
@@ -900,16 +852,16 @@ void idle(bool no_stepper_sleep/*=false*/) {
|
||||
* Kill all activity and lock the machine.
|
||||
* After this the machine will need to be reset.
|
||||
*/
|
||||
void kill(PGM_P const lcd_error/*=nullptr*/, PGM_P const lcd_component/*=nullptr*/, const bool steppers_off/*=false*/) {
|
||||
void kill(FSTR_P const lcd_error/*=nullptr*/, FSTR_P const lcd_component/*=nullptr*/, const bool steppers_off/*=false*/) {
|
||||
thermalManager.disable_all_heaters();
|
||||
|
||||
TERN_(HAS_CUTTER, cutter.kill()); // Full cutter shutdown including ISR control
|
||||
|
||||
// Echo the LCD message to serial for extra context
|
||||
if (lcd_error) { SERIAL_ECHO_START(); SERIAL_ECHOLNPGM_P(lcd_error); }
|
||||
if (lcd_error) { SERIAL_ECHO_START(); SERIAL_ECHOLNF(lcd_error); }
|
||||
|
||||
#if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD_ENHANCED)
|
||||
ui.kill_screen(lcd_error ?: GET_TEXT(MSG_KILLED), lcd_component ?: NUL_STR);
|
||||
ui.kill_screen(lcd_error ?: GET_TEXT_F(MSG_KILLED), lcd_component ?: FPSTR(NUL_STR));
|
||||
#else
|
||||
UNUSED(lcd_error); UNUSED(lcd_component);
|
||||
#endif
|
||||
@@ -942,7 +894,7 @@ void minkill(const bool steppers_off/*=false*/) {
|
||||
TERN_(HAS_CUTTER, cutter.kill()); // Reiterate cutter shutdown
|
||||
|
||||
// Power off all steppers (for M112) or just the E steppers
|
||||
steppers_off ? disable_all_steppers() : disable_e_steppers();
|
||||
steppers_off ? stepper.disable_all_steppers() : stepper.disable_e_steppers();
|
||||
|
||||
TERN_(PSU_CONTROL, powerManager.power_off());
|
||||
|
||||
@@ -983,7 +935,7 @@ void stop() {
|
||||
|
||||
if (!IsStopped()) {
|
||||
SERIAL_ERROR_MSG(STR_ERR_STOPPED);
|
||||
LCD_MESSAGEPGM(MSG_STOPPED);
|
||||
LCD_MESSAGE(MSG_STOPPED);
|
||||
safe_delay(350); // allow enough time for messages to get out before stopping
|
||||
marlin_state = MF_STOPPED;
|
||||
}
|
||||
@@ -1569,7 +1521,7 @@ void setup() {
|
||||
|
||||
#ifdef STARTUP_COMMANDS
|
||||
SETUP_LOG("STARTUP_COMMANDS");
|
||||
queue.inject_P(PSTR(STARTUP_COMMANDS));
|
||||
queue.inject(F(STARTUP_COMMANDS));
|
||||
#endif
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
@@ -1599,7 +1551,7 @@ void setup() {
|
||||
HMI_Init();
|
||||
HMI_SetLanguageCache();
|
||||
HMI_StartFrame(true);
|
||||
DWIN_StatusChanged_P(GET_TEXT(WELCOME_MSG));
|
||||
DWIN_StatusChanged(GET_TEXT_F(WELCOME_MSG));
|
||||
#endif
|
||||
|
||||
#if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC
|
||||
|
||||
+1
-10
@@ -38,16 +38,7 @@ inline void idle_no_sleep() { idle(true); }
|
||||
extern bool G38_did_trigger; // Flag from the ISR to indicate the endstop changed
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The axis order in all axis related arrays is X, Y, Z, E
|
||||
*/
|
||||
void enable_e_steppers();
|
||||
void enable_all_steppers();
|
||||
void disable_e_stepper(const uint8_t e);
|
||||
void disable_e_steppers();
|
||||
void disable_all_steppers();
|
||||
|
||||
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
|
||||
void kill(FSTR_P const lcd_error=nullptr, FSTR_P const lcd_component=nullptr, const bool steppers_off=false);
|
||||
void minkill(const bool steppers_off=false);
|
||||
|
||||
// Global State of the firmware
|
||||
|
||||
@@ -422,6 +422,8 @@
|
||||
#define BOARD_MRR_ESPE 6002 // MRR ESPE based on ESP32 (with I2S stepper stream)
|
||||
#define BOARD_E4D_BOX 6003 // E4d@BOX
|
||||
#define BOARD_FYSETC_E4 6004 // FYSETC E4
|
||||
#define BOARD_PANDA_ZHU 6005 // Panda_ZHU
|
||||
#define BOARD_PANDA_M4 6006 // Panda_M4
|
||||
|
||||
//
|
||||
// SAMD51 ARM Cortex M4
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#undef DEBUG_ECHOLN
|
||||
#undef DEBUG_ECHOPGM
|
||||
#undef DEBUG_ECHOLNPGM
|
||||
#undef DEBUG_ECHOF
|
||||
#undef DEBUG_ECHOLNF
|
||||
#undef DEBUG_ECHOPGM_P
|
||||
#undef DEBUG_ECHOLNPGM_P
|
||||
#undef DEBUG_ECHOPAIR_F
|
||||
@@ -54,7 +56,7 @@
|
||||
#if DEBUG_OUT
|
||||
|
||||
#include "debug_section.h"
|
||||
#define DEBUG_SECTION(N,S,D) SectionLog N(PSTR(S),D)
|
||||
#define DEBUG_SECTION(N,S,D) SectionLog N(F(S),D)
|
||||
|
||||
#define DEBUG_ECHO_START SERIAL_ECHO_START
|
||||
#define DEBUG_ERROR_START SERIAL_ERROR_START
|
||||
@@ -65,6 +67,8 @@
|
||||
#define DEBUG_ECHOLN SERIAL_ECHOLN
|
||||
#define DEBUG_ECHOPGM SERIAL_ECHOPGM
|
||||
#define DEBUG_ECHOLNPGM SERIAL_ECHOLNPGM
|
||||
#define DEBUG_ECHOF SERIAL_ECHOF
|
||||
#define DEBUG_ECHOLNF SERIAL_ECHOLNF
|
||||
#define DEBUG_ECHOPGM SERIAL_ECHOPGM
|
||||
#define DEBUG_ECHOPGM_P SERIAL_ECHOPGM_P
|
||||
#define DEBUG_ECHOPAIR_F SERIAL_ECHOPAIR_F
|
||||
@@ -94,6 +98,8 @@
|
||||
#define DEBUG_ECHOLN(...) NOOP
|
||||
#define DEBUG_ECHOPGM(...) NOOP
|
||||
#define DEBUG_ECHOLNPGM(...) NOOP
|
||||
#define DEBUG_ECHOF(...) NOOP
|
||||
#define DEBUG_ECHOLNF(...) NOOP
|
||||
#define DEBUG_ECHOPGM_P(...) NOOP
|
||||
#define DEBUG_ECHOLNPGM_P(...) NOOP
|
||||
#define DEBUG_ECHOPAIR_F(...) NOOP
|
||||
|
||||
@@ -26,22 +26,22 @@
|
||||
|
||||
class SectionLog {
|
||||
public:
|
||||
SectionLog(PGM_P const msg=nullptr, bool inbug=true) {
|
||||
the_msg = msg;
|
||||
if ((debug = inbug)) echo_msg(PSTR(">>>"));
|
||||
SectionLog(FSTR_P const fmsg=nullptr, bool inbug=true) {
|
||||
the_msg = fmsg;
|
||||
if ((debug = inbug)) echo_msg(F(">>>"));
|
||||
}
|
||||
|
||||
~SectionLog() { if (debug) echo_msg(PSTR("<<<")); }
|
||||
~SectionLog() { if (debug) echo_msg(F("<<<")); }
|
||||
|
||||
private:
|
||||
PGM_P the_msg;
|
||||
FSTR_P the_msg;
|
||||
bool debug;
|
||||
|
||||
void echo_msg(PGM_P const pre) {
|
||||
SERIAL_ECHOPGM_P(pre);
|
||||
void echo_msg(FSTR_P const fpre) {
|
||||
SERIAL_ECHOF(fpre);
|
||||
if (the_msg) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOPGM_P(the_msg);
|
||||
SERIAL_ECHOF(the_msg);
|
||||
}
|
||||
SERIAL_CHAR(' ');
|
||||
print_pos(current_position);
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
// cz Czech
|
||||
// da Danish
|
||||
// de German
|
||||
// el Greek
|
||||
// el_gr Greek (Greece)
|
||||
// el Greek (Greece)
|
||||
// el_CY Greek (Cyprus)
|
||||
// en English
|
||||
// es Spanish
|
||||
// eu Basque-Euskera
|
||||
@@ -165,6 +165,7 @@
|
||||
#define STR_SAVED_POS "Position saved"
|
||||
#define STR_RESTORING_POS "Restoring position"
|
||||
#define STR_INVALID_POS_SLOT "Invalid slot. Total: "
|
||||
#define STR_DONE "Done."
|
||||
|
||||
#define STR_SD_CANT_OPEN_SUBDIR "Cannot open subdir "
|
||||
#define STR_SD_INIT_FAIL "No SD card"
|
||||
@@ -263,9 +264,10 @@
|
||||
// Settings Report Strings
|
||||
#define STR_Z_AUTO_ALIGN "Z Auto-Align"
|
||||
#define STR_BACKLASH_COMPENSATION "Backlash compensation"
|
||||
#define STR_DELTA_SETTINGS "Delta settings (L<diagonal-rod> R<radius> H<height> S<segments-per-sec> XYZ<tower-angle-trim> ABC<rod-trim>)"
|
||||
#define STR_SCARA_SETTINGS "SCARA settings"
|
||||
#define STR_SCARA_S "S<seg-per-sec>"
|
||||
#define STR_S_SEG_PER_SEC "S<seg-per-sec>"
|
||||
#define STR_DELTA_SETTINGS "Delta (L<diagonal-rod> R<radius> H<height> S<seg-per-sec> XYZ<tower-angle-trim> ABC<rod-trim>)"
|
||||
#define STR_SCARA_SETTINGS "SCARA"
|
||||
#define STR_POLARGRAPH_SETTINGS "Polargraph"
|
||||
#define STR_SCARA_P_T_Z "P<theta-psi-offset> T<theta-offset> Z<home-offset>"
|
||||
#define STR_ENDSTOP_ADJUSTMENT "Endstop adjustment"
|
||||
#define STR_SKEW_FACTOR "Skew Factor"
|
||||
|
||||
+37
-26
@@ -33,32 +33,32 @@
|
||||
|
||||
#define _AXIS(A) (A##_AXIS)
|
||||
|
||||
#define _XMIN_ 100
|
||||
#define _YMIN_ 200
|
||||
#define _ZMIN_ 300
|
||||
#define _IMIN_ 500
|
||||
#define _JMIN_ 600
|
||||
#define _KMIN_ 700
|
||||
#define _XMAX_ 101
|
||||
#define _YMAX_ 201
|
||||
#define _ZMAX_ 301
|
||||
#define _IMAX_ 501
|
||||
#define _JMAX_ 601
|
||||
#define _KMAX_ 701
|
||||
#define _XDIAG_ 102
|
||||
#define _YDIAG_ 202
|
||||
#define _ZDIAG_ 302
|
||||
#define _IDIAG_ 502
|
||||
#define _JDIAG_ 602
|
||||
#define _KDIAG_ 702
|
||||
#define _E0DIAG_ 400
|
||||
#define _E1DIAG_ 401
|
||||
#define _E2DIAG_ 402
|
||||
#define _E3DIAG_ 403
|
||||
#define _E4DIAG_ 404
|
||||
#define _E5DIAG_ 405
|
||||
#define _E6DIAG_ 406
|
||||
#define _E7DIAG_ 407
|
||||
#define _XMIN_ 0x11
|
||||
#define _YMIN_ 0x12
|
||||
#define _ZMIN_ 0x13
|
||||
#define _IMIN_ 0x14
|
||||
#define _JMIN_ 0x15
|
||||
#define _KMIN_ 0x16
|
||||
#define _XMAX_ 0x21
|
||||
#define _YMAX_ 0x22
|
||||
#define _ZMAX_ 0x23
|
||||
#define _IMAX_ 0x24
|
||||
#define _JMAX_ 0x25
|
||||
#define _KMAX_ 0x26
|
||||
#define _XDIAG_ 0x31
|
||||
#define _YDIAG_ 0x32
|
||||
#define _ZDIAG_ 0x33
|
||||
#define _IDIAG_ 0x34
|
||||
#define _JDIAG_ 0x35
|
||||
#define _KDIAG_ 0x36
|
||||
#define _E0DIAG_ 0xE0
|
||||
#define _E1DIAG_ 0xE1
|
||||
#define _E2DIAG_ 0xE2
|
||||
#define _E3DIAG_ 0xE3
|
||||
#define _E4DIAG_ 0xE4
|
||||
#define _E5DIAG_ 0xE5
|
||||
#define _E6DIAG_ 0xE6
|
||||
#define _E7DIAG_ 0xE7
|
||||
|
||||
#define _FORCE_INLINE_ __attribute__((__always_inline__)) __inline__
|
||||
#define FORCE_INLINE __attribute__((always_inline)) inline
|
||||
@@ -251,6 +251,8 @@
|
||||
memcpy(&a[0],&b[0],_MIN(sizeof(a),sizeof(b))); \
|
||||
}while(0)
|
||||
|
||||
#define CODE_11( A,B,C,D,E,F,G,H,I,J,K,...) A; B; C; D; E; F; G; H; I; J; K
|
||||
#define CODE_10( A,B,C,D,E,F,G,H,I,J,...) A; B; C; D; E; F; G; H; I; J
|
||||
#define CODE_9( A,B,C,D,E,F,G,H,I,...) A; B; C; D; E; F; G; H; I
|
||||
#define CODE_8( A,B,C,D,E,F,G,H,...) A; B; C; D; E; F; G; H
|
||||
#define CODE_7( A,B,C,D,E,F,G,...) A; B; C; D; E; F; G
|
||||
@@ -286,6 +288,10 @@
|
||||
#define GANG_N_1(N,K) _GANG_N(N,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K)
|
||||
|
||||
// Macros for initializing arrays
|
||||
#define LIST_20(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T
|
||||
#define LIST_19(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S
|
||||
#define LIST_18(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R
|
||||
#define LIST_17(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q
|
||||
#define LIST_16(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P
|
||||
#define LIST_15(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O
|
||||
#define LIST_14(A,B,C,D,E,F,G,H,I,J,K,L,M,N,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N
|
||||
@@ -502,6 +508,11 @@
|
||||
#define INC_13 14
|
||||
#define INC_14 15
|
||||
#define INC_15 16
|
||||
#define INC_16 17
|
||||
#define INC_17 18
|
||||
#define INC_18 19
|
||||
#define INC_19 20
|
||||
#define INC_20 21
|
||||
#define INCREMENT_(n) INC_##n
|
||||
#define INCREMENT(n) INCREMENT_(n)
|
||||
|
||||
|
||||
@@ -1,28 +1,35 @@
|
||||
/********************
|
||||
* multi_language.h *
|
||||
********************/
|
||||
|
||||
/****************************************************************************
|
||||
* Written By Marcio Teixeira 2019 - Aleph Objects, Inc. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* To view a copy of the GNU General Public License, go to the following *
|
||||
* location: <https://www.gnu.org/licenses/>. *
|
||||
****************************************************************************/
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
/*******************************************************
|
||||
* multi_language.h *
|
||||
* By Marcio Teixeira 2019 for Aleph Objects *
|
||||
*******************************************************/
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
typedef const char Language_Str[];
|
||||
#define LSTR PROGMEM Language_Str
|
||||
|
||||
#ifdef LCD_LANGUAGE_5
|
||||
#define NUM_LANGUAGES 5
|
||||
@@ -71,7 +78,7 @@ typedef const char Language_Str[];
|
||||
#define GET_TEXT(MSG) GET_LANG(LCD_LANGUAGE)::MSG
|
||||
#define MAX_LANG_CHARSIZE LANG_CHARSIZE
|
||||
#endif
|
||||
#define GET_TEXT_F(MSG) (const __FlashStringHelper*)GET_TEXT(MSG)
|
||||
#define GET_TEXT_F(MSG) FPSTR(GET_TEXT(MSG))
|
||||
|
||||
#define GET_LANGUAGE_NAME(INDEX) GET_LANG(LCD_LANGUAGE_##INDEX)::LANGUAGE
|
||||
#define LANG_CHARSIZE GET_TEXT(CHARSIZE)
|
||||
|
||||
+12
-12
@@ -69,23 +69,23 @@ PGMSTR(SP_I_LBL, " " AXIS4_STR ":"); PGMSTR(SP_J_LBL, " " AXIS5_STR ":"); PGMSTR
|
||||
|
||||
#endif
|
||||
|
||||
void serialprintPGM(PGM_P str) {
|
||||
void serial_print_P(PGM_P str) {
|
||||
while (const char c = pgm_read_byte(str++)) SERIAL_CHAR(c);
|
||||
}
|
||||
|
||||
void serial_echo_start() { static PGMSTR(echomagic, "echo:"); serialprintPGM(echomagic); }
|
||||
void serial_error_start() { static PGMSTR(errormagic, "Error:"); serialprintPGM(errormagic); }
|
||||
void serial_echo_start() { static PGMSTR(echomagic, "echo:"); serial_print_P(echomagic); }
|
||||
void serial_error_start() { static PGMSTR(errormagic, "Error:"); serial_print_P(errormagic); }
|
||||
|
||||
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
|
||||
|
||||
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post/*=nullptr*/) {
|
||||
if (pre) serialprintPGM(pre);
|
||||
serialprintPGM(onoff ? on : off);
|
||||
if (post) serialprintPGM(post);
|
||||
void serial_ternary(const bool onoff, FSTR_P const pre, FSTR_P const on, FSTR_P const off, FSTR_P const post/*=nullptr*/) {
|
||||
if (pre) serial_print(pre);
|
||||
serial_print(onoff ? on : off);
|
||||
if (post) serial_print(post);
|
||||
}
|
||||
void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(STR_ON) : PSTR(STR_OFF)); }
|
||||
void serialprint_onoff(const bool onoff) { serial_print(onoff ? F(STR_ON) : F(STR_OFF)); }
|
||||
void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); }
|
||||
void serialprint_truefalse(const bool tf) { serialprintPGM(tf ? PSTR("true") : PSTR("false")); }
|
||||
void serialprint_truefalse(const bool tf) { serial_print(tf ? F("true") : F("false")); }
|
||||
|
||||
void print_bin(uint16_t val) {
|
||||
for (uint8_t i = 16; i--;) {
|
||||
@@ -94,10 +94,10 @@ void print_bin(uint16_t val) {
|
||||
}
|
||||
}
|
||||
|
||||
void print_pos(LINEAR_AXIS_ARGS(const_float_t), PGM_P const prefix/*=nullptr*/, PGM_P const suffix/*=nullptr*/) {
|
||||
if (prefix) serialprintPGM(prefix);
|
||||
void print_pos(LINEAR_AXIS_ARGS(const_float_t), FSTR_P const prefix/*=nullptr*/, FSTR_P const suffix/*=nullptr*/) {
|
||||
if (prefix) serial_print(prefix);
|
||||
SERIAL_ECHOPGM_P(
|
||||
LIST_N(DOUBLE(LINEAR_AXES), SP_X_STR, x, SP_Y_STR, y, SP_Z_STR, z, SP_I_STR, i, SP_J_STR, j, SP_K_STR, k)
|
||||
);
|
||||
if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
|
||||
if (suffix) serial_print(suffix); else SERIAL_EOL();
|
||||
}
|
||||
|
||||
+82
-44
@@ -167,13 +167,10 @@ inline void SERIAL_ECHO(serial_char_t x) { SERIAL_IMPL.write(x.c); }
|
||||
#define AS_CHAR(C) serial_char_t(C)
|
||||
#define AS_DIGIT(C) AS_CHAR('0' + (C))
|
||||
|
||||
// SERIAL_ECHO_F prints a floating point value with optional precision
|
||||
inline void SERIAL_ECHO_F(EnsureDouble x, int digit=2) { SERIAL_IMPL.print(x, digit); }
|
||||
|
||||
template <typename T>
|
||||
void SERIAL_ECHOLN(T x) { SERIAL_IMPL.println(x); }
|
||||
|
||||
// SERIAL_PRINT works like SERIAL_ECHO but allow to specify the encoding base of the number printed
|
||||
// SERIAL_PRINT works like SERIAL_ECHO but also takes the numeric base
|
||||
template <typename T, typename U>
|
||||
void SERIAL_PRINT(T x, U y) { SERIAL_IMPL.print(x, y); }
|
||||
|
||||
@@ -184,8 +181,20 @@ void SERIAL_PRINTLN(T x, PrintBase y) { SERIAL_IMPL.println(x, y); }
|
||||
inline void SERIAL_FLUSH() { SERIAL_IMPL.flush(); }
|
||||
inline void SERIAL_FLUSHTX() { SERIAL_IMPL.flushTX(); }
|
||||
|
||||
// Print a single PROGMEM string to serial
|
||||
void serialprintPGM(PGM_P str);
|
||||
// Serial echo and error prefixes
|
||||
#define SERIAL_ECHO_START() serial_echo_start()
|
||||
#define SERIAL_ERROR_START() serial_error_start()
|
||||
|
||||
// Serial end-of-line
|
||||
#define SERIAL_EOL() SERIAL_CHAR('\n')
|
||||
|
||||
// Print a single PROGMEM, PGM_P, or PSTR() string.
|
||||
void serial_print_P(PGM_P str);
|
||||
inline void serial_println_P(PGM_P str) { serial_print_P(str); SERIAL_EOL(); }
|
||||
|
||||
// Print a single FSTR_P, F(), or FPSTR() string.
|
||||
inline void serial_print(FSTR_P const fstr) { serial_print_P(FTOP(fstr)); }
|
||||
inline void serial_println(FSTR_P const fstr) { serial_println_P(FTOP(fstr)); }
|
||||
|
||||
//
|
||||
// SERIAL_ECHOPGM... macros are used to output string-value pairs.
|
||||
@@ -195,8 +204,8 @@ void serialprintPGM(PGM_P str);
|
||||
#define __SEP_N(N,V...) _SEP_##N(V)
|
||||
#define _SEP_N(N,V...) __SEP_N(N,V)
|
||||
#define _SEP_N_REF() _SEP_N
|
||||
#define _SEP_1(s) serialprintPGM(PSTR(s));
|
||||
#define _SEP_2(s,v) serial_echopair_PGM(PSTR(s),v);
|
||||
#define _SEP_1(s) serial_print(F(s));
|
||||
#define _SEP_2(s,v) serial_echopair(F(s),v);
|
||||
#define _SEP_3(s,v,V...) _SEP_2(s,v); DEFER2(_SEP_N_REF)()(TWO_ARGS(V),V);
|
||||
#define SERIAL_ECHOPGM(V...) do{ EVAL(_SEP_N(TWO_ARGS(V),V)); }while(0)
|
||||
|
||||
@@ -204,8 +213,8 @@ void serialprintPGM(PGM_P str);
|
||||
#define __SELP_N(N,V...) _SELP_##N(V)
|
||||
#define _SELP_N(N,V...) __SELP_N(N,V)
|
||||
#define _SELP_N_REF() _SELP_N
|
||||
#define _SELP_1(s) serialprintPGM(PSTR(s "\n"));
|
||||
#define _SELP_2(s,v) serial_echopair_PGM(PSTR(s),v); SERIAL_EOL();
|
||||
#define _SELP_1(s) serial_print(F(s "\n"));
|
||||
#define _SELP_2(s,v) serial_echolnpair(F(s),v);
|
||||
#define _SELP_3(s,v,V...) _SEP_2(s,v); DEFER2(_SELP_N_REF)()(TWO_ARGS(V),V);
|
||||
#define SERIAL_ECHOLNPGM(V...) do{ EVAL(_SELP_N(TWO_ARGS(V),V)); }while(0)
|
||||
|
||||
@@ -213,8 +222,8 @@ void serialprintPGM(PGM_P str);
|
||||
#define __SEP_N_P(N,V...) _SEP_##N##_P(V)
|
||||
#define _SEP_N_P(N,V...) __SEP_N_P(N,V)
|
||||
#define _SEP_N_P_REF() _SEP_N_P
|
||||
#define _SEP_1_P(p) serialprintPGM(p);
|
||||
#define _SEP_2_P(p,v) serial_echopair_PGM(p,v);
|
||||
#define _SEP_1_P(p) serial_print_P(p);
|
||||
#define _SEP_2_P(p,v) serial_echopair_P(p,v);
|
||||
#define _SEP_3_P(p,v,V...) _SEP_2_P(p,v); DEFER2(_SEP_N_P_REF)()(TWO_ARGS(V),V);
|
||||
#define SERIAL_ECHOPGM_P(V...) do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0)
|
||||
|
||||
@@ -222,11 +231,29 @@ void serialprintPGM(PGM_P str);
|
||||
#define __SELP_N_P(N,V...) _SELP_##N##_P(V)
|
||||
#define _SELP_N_P(N,V...) __SELP_N_P(N,V)
|
||||
#define _SELP_N_P_REF() _SELP_N_P
|
||||
#define _SELP_1_P(p) { serialprintPGM(p); SERIAL_EOL(); }
|
||||
#define _SELP_2_P(p,v) { serial_echopair_PGM(p,v); SERIAL_EOL(); }
|
||||
#define _SELP_1_P(p) serial_println_P(p)
|
||||
#define _SELP_2_P(p,v) serial_echolnpair_P(p,v)
|
||||
#define _SELP_3_P(p,v,V...) { _SEP_2_P(p,v); DEFER2(_SELP_N_P_REF)()(TWO_ARGS(V),V); }
|
||||
#define SERIAL_ECHOLNPGM_P(V...) do{ EVAL(_SELP_N_P(TWO_ARGS(V),V)); }while(0)
|
||||
|
||||
// Print up to 20 pairs of values. Odd elements must be FSTR_P, F(), or FPSTR().
|
||||
#define __SEP_N_F(N,V...) _SEP_##N##_F(V)
|
||||
#define _SEP_N_F(N,V...) __SEP_N_F(N,V)
|
||||
#define _SEP_N_F_REF() _SEP_N_F
|
||||
#define _SEP_1_F(p) serial_print(p);
|
||||
#define _SEP_2_F(p,v) serial_echopair(p,v);
|
||||
#define _SEP_3_F(p,v,V...) _SEP_2_F(p,v); DEFER2(_SEP_N_F_REF)()(TWO_ARGS(V),V);
|
||||
#define SERIAL_ECHOF(V...) do{ EVAL(_SEP_N_F(TWO_ARGS(V),V)); }while(0)
|
||||
|
||||
// Print up to 20 pairs of values followed by newline. Odd elements must be FSTR_P, F(), or FPSTR().
|
||||
#define __SELP_N_F(N,V...) _SELP_##N##_F(V)
|
||||
#define _SELP_N_F(N,V...) __SELP_N_F(N,V)
|
||||
#define _SELP_N_F_REF() _SELP_N_F
|
||||
#define _SELP_1_F(p) serial_println(p)
|
||||
#define _SELP_2_F(p,v) serial_echolnpair(p,v)
|
||||
#define _SELP_3_F(p,v,V...) { _SEP_2_F(p,v); DEFER2(_SELP_N_F_REF)()(TWO_ARGS(V),V); }
|
||||
#define SERIAL_ECHOLNF(V...) do{ EVAL(_SELP_N_F(TWO_ARGS(V),V)); }while(0)
|
||||
|
||||
#ifdef AllowDifferentTypeInList
|
||||
|
||||
inline void SERIAL_ECHOLIST_IMPL() {}
|
||||
@@ -236,47 +263,49 @@ void serialprintPGM(PGM_P str);
|
||||
template <typename T, typename ... Args>
|
||||
void SERIAL_ECHOLIST_IMPL(T && t, Args && ... args) {
|
||||
SERIAL_IMPL.print(t);
|
||||
serialprintPGM(PSTR(", "));
|
||||
serial_print(F(", "));
|
||||
SERIAL_ECHOLIST_IMPL(args...);
|
||||
}
|
||||
|
||||
template <typename ... Args>
|
||||
void SERIAL_ECHOLIST(PGM_P const str, Args && ... args) {
|
||||
SERIAL_IMPL.print(str);
|
||||
void SERIAL_ECHOLIST(FSTR_P const str, Args && ... args) {
|
||||
SERIAL_IMPL.print(FTOP(str));
|
||||
SERIAL_ECHOLIST_IMPL(args...);
|
||||
}
|
||||
|
||||
#else // Optimization if the listed type are all the same (seems to be the case in the codebase so use that instead)
|
||||
|
||||
template <typename ... Args>
|
||||
void SERIAL_ECHOLIST(PGM_P const str, Args && ... args) {
|
||||
serialprintPGM(str);
|
||||
void SERIAL_ECHOLIST(FSTR_P const fstr, Args && ... args) {
|
||||
serial_print(fstr);
|
||||
typename Private::first_type_of<Args...>::type values[] = { args... };
|
||||
constexpr size_t argsSize = sizeof...(args);
|
||||
for (size_t i = 0; i < argsSize; i++) {
|
||||
if (i) serialprintPGM(PSTR(", "));
|
||||
if (i) serial_print(F(", "));
|
||||
SERIAL_IMPL.print(values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define SERIAL_ECHOPAIR_F_P(P,V...) do{ serialprintPGM(P); SERIAL_ECHO_F(V); }while(0)
|
||||
#define SERIAL_ECHOLNPAIR_F_P(V...) do{ SERIAL_ECHOPAIR_F_P(V); SERIAL_EOL(); }while(0)
|
||||
// SERIAL_ECHO_F prints a floating point value with optional precision
|
||||
inline void SERIAL_ECHO_F(EnsureDouble x, int digit=2) { SERIAL_IMPL.print(x, digit); }
|
||||
|
||||
#define SERIAL_ECHOPAIR_F(S,V...) SERIAL_ECHOPAIR_F_P(PSTR(S),V)
|
||||
#define SERIAL_ECHOLNPAIR_F(V...) do{ SERIAL_ECHOPAIR_F(V); SERIAL_EOL(); }while(0)
|
||||
#define SERIAL_ECHOPAIR_F_P(P,V...) do{ serial_print_P(P); SERIAL_ECHO_F(V); }while(0)
|
||||
#define SERIAL_ECHOLNPAIR_F_P(P,V...) do{ SERIAL_ECHOPAIR_F_P(P,V); SERIAL_EOL(); }while(0)
|
||||
|
||||
#define SERIAL_ECHO_START() serial_echo_start()
|
||||
#define SERIAL_ERROR_START() serial_error_start()
|
||||
#define SERIAL_EOL() SERIAL_CHAR('\n')
|
||||
#define SERIAL_ECHOPAIR_F_F(S,V...) do{ serial_print(S); SERIAL_ECHO_F(V); }while(0)
|
||||
#define SERIAL_ECHOLNPAIR_F_F(S,V...) do{ SERIAL_ECHOPAIR_F_F(S,V); SERIAL_EOL(); }while(0)
|
||||
|
||||
#define SERIAL_ECHO_MSG(V...) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(V); }while(0)
|
||||
#define SERIAL_ERROR_MSG(V...) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(V); }while(0)
|
||||
#define SERIAL_ECHOPAIR_F(S,V...) SERIAL_ECHOPAIR_F_F(F(S),V)
|
||||
#define SERIAL_ECHOLNPAIR_F(V...) do{ SERIAL_ECHOPAIR_F(V); SERIAL_EOL(); }while(0)
|
||||
|
||||
#define SERIAL_ECHO_SP(C) serial_spaces(C)
|
||||
#define SERIAL_ECHO_MSG(V...) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(V); }while(0)
|
||||
#define SERIAL_ERROR_MSG(V...) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(V); }while(0)
|
||||
|
||||
#define SERIAL_ECHO_TERNARY(TF, PRE, ON, OFF, POST) serial_ternary(TF, PSTR(PRE), PSTR(ON), PSTR(OFF), PSTR(POST))
|
||||
#define SERIAL_ECHO_SP(C) serial_spaces(C)
|
||||
|
||||
#define SERIAL_ECHO_TERNARY(TF, PRE, ON, OFF, POST) serial_ternary(TF, F(PRE), F(ON), F(OFF), F(POST))
|
||||
|
||||
#if SERIAL_FLOAT_PRECISION
|
||||
#define SERIAL_DECIMAL(V) SERIAL_PRINT(V, SERIAL_FLOAT_PRECISION)
|
||||
@@ -287,33 +316,42 @@ void serialprintPGM(PGM_P str);
|
||||
//
|
||||
// Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
|
||||
//
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, serial_char_t v) { serialprintPGM(s_P); SERIAL_CHAR(v.c); }
|
||||
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, float v) { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, double v) { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
inline void serial_echopair_P(PGM_P const pstr, serial_char_t v) { serial_print_P(pstr); SERIAL_CHAR(v.c); }
|
||||
inline void serial_echopair_P(PGM_P const pstr, float v) { serial_print_P(pstr); SERIAL_DECIMAL(v); }
|
||||
inline void serial_echopair_P(PGM_P const pstr, double v) { serial_print_P(pstr); SERIAL_DECIMAL(v); }
|
||||
//inline void serial_echopair_P(PGM_P const pstr, const char *v) { serial_print_P(pstr); SERIAL_ECHO(v); }
|
||||
inline void serial_echopair_P(PGM_P const pstr, FSTR_P v) { serial_print_P(pstr); SERIAL_ECHOF(v); }
|
||||
|
||||
// Default implementation for types without a specialization. Handles integers.
|
||||
template <typename T>
|
||||
void serial_echopair_PGM(PGM_P const s_P, T v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
inline void serial_echopair_P(PGM_P const pstr, T v) { serial_print_P(pstr); SERIAL_ECHO(v); }
|
||||
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, bool v) { serial_echopair_PGM(s_P, (int)v); }
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PGM(s_P, (uintptr_t)v); }
|
||||
// Add a newline.
|
||||
template <typename T>
|
||||
inline void serial_echolnpair_P(PGM_P const pstr, T v) { serial_echopair_P(pstr, v); SERIAL_EOL(); }
|
||||
|
||||
// Catch-all for __FlashStringHelper *
|
||||
template <typename T>
|
||||
inline void serial_echopair(FSTR_P const fstr, T v) { serial_echopair_P(FTOP(fstr), v); }
|
||||
|
||||
// Add a newline to the serial output
|
||||
template <typename T>
|
||||
inline void serial_echolnpair(FSTR_P const fstr, T v) { serial_echolnpair_P(FTOP(fstr), v); }
|
||||
|
||||
void serial_echo_start();
|
||||
void serial_error_start();
|
||||
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=nullptr);
|
||||
void serial_ternary(const bool onoff, FSTR_P const pre, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr);
|
||||
void serialprint_onoff(const bool onoff);
|
||||
void serialprintln_onoff(const bool onoff);
|
||||
void serialprint_truefalse(const bool tf);
|
||||
void serial_spaces(uint8_t count);
|
||||
|
||||
void print_bin(const uint16_t val);
|
||||
void print_pos(LINEAR_AXIS_ARGS(const_float_t), PGM_P const prefix=nullptr, PGM_P const suffix=nullptr);
|
||||
void print_pos(LINEAR_AXIS_ARGS(const_float_t), FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr);
|
||||
|
||||
inline void print_pos(const xyz_pos_t &xyz, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr) {
|
||||
inline void print_pos(const xyz_pos_t &xyz, FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr) {
|
||||
print_pos(LINEAR_AXIS_ELEM(xyz), prefix, suffix);
|
||||
}
|
||||
|
||||
#define SERIAL_POS(SUFFIX,VAR) do { print_pos(VAR, PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n")); }while(0)
|
||||
#define SERIAL_XYZ(PREFIX,V...) do { print_pos(V, PSTR(PREFIX), nullptr); }while(0)
|
||||
#define SERIAL_POS(SUFFIX,VAR) do { print_pos(VAR, F(" " STRINGIFY(VAR) "="), F(" : " SUFFIX "\n")); }while(0)
|
||||
#define SERIAL_XYZ(PREFIX,V...) do { print_pos(V, F(PREFIX)); }while(0)
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
class __FlashStringHelper;
|
||||
typedef const __FlashStringHelper *progmem_str;
|
||||
|
||||
//
|
||||
// Conditional type assignment magic. For example...
|
||||
//
|
||||
|
||||
@@ -92,9 +92,9 @@ void safe_delay(millis_t ms) {
|
||||
SERIAL_ECHOPGM(" (Aligned With");
|
||||
|
||||
if (probe.offset_xy.y > 0)
|
||||
SERIAL_ECHOPGM_P(ENABLED(IS_SCARA) ? PSTR("-Distal") : PSTR("-Back"));
|
||||
SERIAL_ECHOF(F(TERN(IS_SCARA, "-Distal", "-Back")));
|
||||
else if (probe.offset_xy.y < 0)
|
||||
SERIAL_ECHOPGM_P(ENABLED(IS_SCARA) ? PSTR("-Proximal") : PSTR("-Front"));
|
||||
SERIAL_ECHOF(F(TERN(IS_SCARA, "-Proximal", "-Front")));
|
||||
else if (probe.offset_xy.x != 0)
|
||||
SERIAL_ECHOPGM("-Center");
|
||||
|
||||
@@ -102,7 +102,7 @@ void safe_delay(millis_t ms) {
|
||||
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOPGM_P(probe.offset.z < 0 ? PSTR("Below") : probe.offset.z > 0 ? PSTR("Above") : PSTR("Same Z as"));
|
||||
SERIAL_ECHOF(probe.offset.z < 0 ? F("Below") : probe.offset.z > 0 ? F("Above") : F("Same Z as"));
|
||||
SERIAL_ECHOLNPGM(" Nozzle)");
|
||||
|
||||
#endif
|
||||
|
||||
@@ -60,9 +60,9 @@ Backlash backlash;
|
||||
* spread over multiple segments, smoothing out artifacts even more.
|
||||
*/
|
||||
|
||||
void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const uint8_t dm, block_t * const block) {
|
||||
static uint8_t last_direction_bits;
|
||||
uint8_t changed_dir = last_direction_bits ^ dm;
|
||||
void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const axis_bits_t dm, block_t * const block) {
|
||||
static axis_bits_t last_direction_bits;
|
||||
axis_bits_t changed_dir = last_direction_bits ^ dm;
|
||||
// Ignore direction change unless steps are taken in that direction
|
||||
#if DISABLED(CORE_BACKLASH) || ENABLED(MARKFORGED_XY)
|
||||
if (!da) CBI(changed_dir, X_AXIS);
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
return has_measurement(X_AXIS) || has_measurement(Y_AXIS) || has_measurement(Z_AXIS);
|
||||
}
|
||||
|
||||
void add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const uint8_t dm, block_t * const block);
|
||||
void add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const axis_bits_t dm, block_t * const block);
|
||||
};
|
||||
|
||||
extern Backlash backlash;
|
||||
|
||||
@@ -180,10 +180,8 @@ void unified_bed_leveling::display_map(const uint8_t map_type) {
|
||||
SERIAL_EOL();
|
||||
serial_echo_column_labels(eachsp - 2);
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHOPGM(" for ");
|
||||
SERIAL_ECHOPGM_P(csv ? PSTR("CSV:\n") : PSTR("LCD:\n"));
|
||||
}
|
||||
else
|
||||
SERIAL_ECHOPGM(" for ", csv ? F("CSV:\n") : F("LCD:\n"));
|
||||
|
||||
// Add XY probe offset from extruder because probe.probe_at_point() subtracts them when
|
||||
// moving to the XY position to be measured. This ensures better agreement between
|
||||
@@ -213,7 +211,7 @@ void unified_bed_leveling::display_map(const uint8_t map_type) {
|
||||
// TODO: Display on Graphical LCD
|
||||
}
|
||||
else if (isnan(f))
|
||||
SERIAL_ECHOPGM_P(human ? PSTR(" . ") : PSTR("NAN"));
|
||||
SERIAL_ECHOF(human ? F(" . ") : F("NAN"));
|
||||
else if (human || csv) {
|
||||
if (human && f >= 0.0) SERIAL_CHAR(f > 0 ? '+' : ' '); // Display sign also for positive numbers (' ' for 0)
|
||||
SERIAL_ECHO_F(f, 3); // Positive: 5 digits, Negative: 6 digits
|
||||
@@ -281,10 +279,10 @@ bool unified_bed_leveling::sanity_check() {
|
||||
}
|
||||
#endif
|
||||
|
||||
process_subcommands_now_P(G28_STR); // Home
|
||||
process_subcommands_now_P(PSTR(ALIGN_GCODE "\n" // Align multi z axis if available
|
||||
PROBE_GCODE "\n" // Build mesh with available hardware
|
||||
"G29P3\nG29P3")); // Ensure mesh is complete by running smart fill twice
|
||||
process_subcommands_now(FPSTR(G28_STR)); // Home
|
||||
process_subcommands_now(F(ALIGN_GCODE "\n" // Align multi z axis if available
|
||||
PROBE_GCODE "\n" // Build mesh with available hardware
|
||||
"G29P3\nG29P3")); // Ensure mesh is complete by running smart fill twice
|
||||
|
||||
if (parser.seenval('S')) {
|
||||
char umw_gcode[32];
|
||||
@@ -292,9 +290,9 @@ bool unified_bed_leveling::sanity_check() {
|
||||
queue.inject(umw_gcode);
|
||||
}
|
||||
|
||||
process_subcommands_now_P(PSTR("G29A\nG29F10\n" // Set UBL Active & Fade 10
|
||||
"M140S0\nM104S0\n" // Turn off heaters
|
||||
"M500")); // Store settings
|
||||
process_subcommands_now(F("G29A\nG29F10\n" // Set UBL Active & Fade 10
|
||||
"M140S0\nM104S0\n" // Turn off heaters
|
||||
"M500")); // Store settings
|
||||
}
|
||||
|
||||
#endif // UBL_MESH_WIZARD
|
||||
|
||||
@@ -609,7 +609,7 @@ void unified_bed_leveling::G29() {
|
||||
settings.load_mesh(param.KLS_storage_slot);
|
||||
storage_slot = param.KLS_storage_slot;
|
||||
|
||||
SERIAL_ECHOLNPGM("Done.");
|
||||
SERIAL_ECHOLNPGM(STR_DONE);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -637,7 +637,7 @@ void unified_bed_leveling::G29() {
|
||||
settings.store_mesh(param.KLS_storage_slot);
|
||||
storage_slot = param.KLS_storage_slot;
|
||||
|
||||
SERIAL_ECHOLNPGM("Done.");
|
||||
SERIAL_ECHOLNPGM(STR_DONE);
|
||||
}
|
||||
|
||||
if (parser.seen_test('T'))
|
||||
@@ -656,7 +656,7 @@ void unified_bed_leveling::G29() {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Probe End Script: ", Z_PROBE_END_SCRIPT);
|
||||
if (probe_deployed) {
|
||||
planner.synchronize();
|
||||
gcode.process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT));
|
||||
gcode.process_subcommands_now(F(Z_PROBE_END_SCRIPT));
|
||||
}
|
||||
#else
|
||||
UNUSED(probe_deployed);
|
||||
@@ -736,7 +736,7 @@ void unified_bed_leveling::shift_mesh_height() {
|
||||
|
||||
const uint8_t point_num = (GRID_MAX_POINTS - count) + 1;
|
||||
SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, ".");
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS)));
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS)));
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (ui.button_pressed()) {
|
||||
@@ -789,12 +789,12 @@ void unified_bed_leveling::shift_mesh_height() {
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
|
||||
void set_message_with_feedback(PGM_P const msg_P) {
|
||||
void set_message_with_feedback(FSTR_P const fstr) {
|
||||
#if HAS_LCD_MENU
|
||||
ui.set_status_P(msg_P);
|
||||
ui.set_status(fstr);
|
||||
ui.quick_feedback();
|
||||
#else
|
||||
UNUSED(msg_P);
|
||||
UNUSED(fstr);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
planner.synchronize();
|
||||
|
||||
SERIAL_ECHOPGM("Place shim under nozzle");
|
||||
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
|
||||
LCD_MESSAGE(MSG_UBL_BC_INSERT);
|
||||
ui.return_to_status();
|
||||
echo_and_take_a_measurement();
|
||||
|
||||
@@ -859,7 +859,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
planner.synchronize();
|
||||
|
||||
SERIAL_ECHOPGM("Remove shim");
|
||||
LCD_MESSAGEPGM(MSG_UBL_BC_REMOVE);
|
||||
LCD_MESSAGE(MSG_UBL_BC_REMOVE);
|
||||
echo_and_take_a_measurement();
|
||||
|
||||
const float z2 = measure_point_with_encoder();
|
||||
@@ -905,7 +905,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
|
||||
if (!position_is_reachable(ppos)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points)
|
||||
|
||||
LCD_MESSAGEPGM(MSG_UBL_MOVING_TO_NEXT);
|
||||
LCD_MESSAGE(MSG_UBL_MOVING_TO_NEXT);
|
||||
|
||||
do_blocking_move_to(ppos);
|
||||
do_z_clearance(z_clearance);
|
||||
@@ -917,11 +917,11 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
|
||||
if (parser.seen_test('B')) {
|
||||
SERIAL_ECHOPGM("Place Shim & Measure");
|
||||
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
|
||||
LCD_MESSAGE(MSG_UBL_BC_INSERT);
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHOPGM("Measure");
|
||||
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT2);
|
||||
LCD_MESSAGE(MSG_UBL_BC_INSERT2);
|
||||
}
|
||||
|
||||
const float z_step = 0.01f; // 0.01mm per encoder tick, occasionally step
|
||||
@@ -974,7 +974,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
|
||||
save_ubl_active_state_and_disable();
|
||||
|
||||
LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH);
|
||||
LCD_MESSAGE(MSG_UBL_FINE_TUNE_MESH);
|
||||
ui.capture(); // Take over control of the LCD encoder
|
||||
|
||||
do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES); // Move to the given XY with probe clearance
|
||||
@@ -1039,7 +1039,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
if (_click_and_hold([]{
|
||||
ui.return_to_status();
|
||||
do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
set_message_with_feedback(GET_TEXT(MSG_EDITING_STOPPED));
|
||||
set_message_with_feedback(GET_TEXT_F(MSG_EDITING_STOPPED));
|
||||
})) break;
|
||||
|
||||
// TODO: Disable leveling here so the Z value becomes the 'native' Z value.
|
||||
@@ -1060,7 +1060,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
|
||||
do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES);
|
||||
|
||||
LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH);
|
||||
LCD_MESSAGE(MSG_UBL_DONE_EDITING_MESH);
|
||||
SERIAL_ECHOLNPGM("Done Editing Mesh");
|
||||
|
||||
if (lcd_map_control)
|
||||
@@ -1077,7 +1077,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
bool unified_bed_leveling::G29_parse_parameters() {
|
||||
bool err_flag = false;
|
||||
|
||||
set_message_with_feedback(GET_TEXT(MSG_UBL_DOING_G29));
|
||||
set_message_with_feedback(GET_TEXT_F(MSG_UBL_DOING_G29));
|
||||
|
||||
param.C_constant = 0;
|
||||
param.R_repetition = 0;
|
||||
@@ -1200,7 +1200,7 @@ void unified_bed_leveling::save_ubl_active_state_and_disable() {
|
||||
ubl_state_recursion_chk++;
|
||||
if (ubl_state_recursion_chk != 1) {
|
||||
SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row.");
|
||||
set_message_with_feedback(GET_TEXT(MSG_UBL_SAVE_ERROR));
|
||||
set_message_with_feedback(GET_TEXT_F(MSG_UBL_SAVE_ERROR));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1213,7 +1213,7 @@ void unified_bed_leveling::restore_ubl_active_state_and_leave() {
|
||||
#if ENABLED(UBL_DEVEL_DEBUGGING)
|
||||
if (--ubl_state_recursion_chk) {
|
||||
SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
|
||||
set_message_with_feedback(GET_TEXT(MSG_UBL_RESTORE_ERROR));
|
||||
set_message_with_feedback(GET_TEXT_F(MSG_UBL_RESTORE_ERROR));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1438,7 +1438,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
|
||||
if (do_3_pt_leveling) {
|
||||
SERIAL_ECHOLNPGM("Tilting mesh (1/3)");
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
|
||||
measured_z = probe.probe_at_point(points[0], PROBE_PT_RAISE, param.V_verbosity);
|
||||
if (isnan(measured_z))
|
||||
@@ -1457,7 +1457,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
|
||||
if (!abort_flag) {
|
||||
SERIAL_ECHOLNPGM("Tilting mesh (2/3)");
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
|
||||
measured_z = probe.probe_at_point(points[1], PROBE_PT_RAISE, param.V_verbosity);
|
||||
#ifdef VALIDATE_MESH_TILT
|
||||
@@ -1477,7 +1477,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
|
||||
if (!abort_flag) {
|
||||
SERIAL_ECHOLNPGM("Tilting mesh (3/3)");
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
|
||||
measured_z = probe.probe_at_point(points[2], PROBE_PT_LAST_STOW, param.V_verbosity);
|
||||
#ifdef VALIDATE_MESH_TILT
|
||||
@@ -1518,7 +1518,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
|
||||
if (!abort_flag) {
|
||||
SERIAL_ECHOLNPGM("Tilting mesh point ", point_num, "/", total_points, "\n");
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points));
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points));
|
||||
|
||||
measured_z = probe.probe_at_point(rpos, parser.seen_test('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity); // TODO: Needs error handling
|
||||
|
||||
@@ -1609,7 +1609,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
}
|
||||
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
rotation.debug(PSTR("rotation matrix:\n"));
|
||||
rotation.debug(F("rotation matrix:\n"));
|
||||
DEBUG_ECHOPAIR_F("LSF Results A=", lsf_results.A, 7);
|
||||
DEBUG_ECHOPAIR_F(" B=", lsf_results.B, 7);
|
||||
DEBUG_ECHOLNPAIR_F(" D=", lsf_results.D, 7);
|
||||
@@ -1636,14 +1636,14 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
auto normed = [&](const xy_pos_t &pos, const_float_t zadd) {
|
||||
return normal.x * pos.x + normal.y * pos.y + zadd;
|
||||
};
|
||||
auto debug_pt = [](PGM_P const pre, const xy_pos_t &pos, const_float_t zadd) {
|
||||
d_from(); SERIAL_ECHOPGM_P(pre);
|
||||
auto debug_pt = [](FSTR_P const pre, const xy_pos_t &pos, const_float_t zadd) {
|
||||
d_from(); SERIAL_ECHOF(pre);
|
||||
DEBUG_ECHO_F(normed(pos, zadd), 6);
|
||||
DEBUG_ECHOLNPAIR_F(" Z error = ", zadd - get_z_correction(pos), 6);
|
||||
};
|
||||
debug_pt(PSTR("1st point: "), probe_pt[0], normal.z * z1);
|
||||
debug_pt(PSTR("2nd point: "), probe_pt[1], normal.z * z2);
|
||||
debug_pt(PSTR("3rd point: "), probe_pt[2], normal.z * z3);
|
||||
debug_pt(F("1st point: "), probe_pt[0], normal.z * z1);
|
||||
debug_pt(F("2nd point: "), probe_pt[1], normal.z * z2);
|
||||
debug_pt(F("3rd point: "), probe_pt[2], normal.z * z3);
|
||||
d_from(); DEBUG_ECHOPGM("safe home with Z=");
|
||||
DEBUG_ECHOLNPAIR_F("0 : ", normed(safe_homing_xy, 0), 6);
|
||||
d_from(); DEBUG_ECHOPGM("safe home with Z=");
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
@@ -323,6 +324,8 @@
|
||||
#define DELTA_SEGMENT_MIN_LENGTH 0.25 // SCARA minimum segment size is 0.25mm
|
||||
#elif ENABLED(DELTA)
|
||||
#define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DELTA_SEGMENTS_PER_SECOND)
|
||||
#elif ENABLED(POLARGRAPH)
|
||||
#define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DELTA_SEGMENTS_PER_SECOND)
|
||||
#else // CARTESIAN
|
||||
#ifdef LEVELED_SEGMENT_LENGTH
|
||||
#define DELTA_SEGMENT_MIN_LENGTH LEVELED_SEGMENT_LENGTH
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
@@ -45,7 +46,7 @@ void CancelObject::set_active_object(const int8_t obj) {
|
||||
|
||||
#if BOTH(HAS_STATUS_MESSAGE, CANCEL_OBJECTS_REPORTING)
|
||||
if (active_object >= 0)
|
||||
ui.status_printf_P(0, PSTR(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object));
|
||||
ui.status_printf(0, F(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object));
|
||||
else
|
||||
ui.reset_status();
|
||||
#endif
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
|
||||
#include "controllerfan.h"
|
||||
#include "../module/stepper/indirection.h"
|
||||
#include "../module/stepper.h"
|
||||
#include "../module/temperature.h"
|
||||
|
||||
ControllerFan controllerFan;
|
||||
@@ -54,33 +54,12 @@ void ControllerFan::update() {
|
||||
if (ELAPSED(ms, nextMotorCheck)) {
|
||||
nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s
|
||||
|
||||
#define MOTOR_IS_ON(A,B) (A##_ENABLE_READ() == bool(B##_ENABLE_ON))
|
||||
#define _OR_ENABLED_E(N) || MOTOR_IS_ON(E##N,E)
|
||||
|
||||
const bool motor_on = (
|
||||
( DISABLED(CONTROLLER_FAN_IGNORE_Z) &&
|
||||
( MOTOR_IS_ON(Z,Z)
|
||||
|| TERN0(HAS_Z2_ENABLE, MOTOR_IS_ON(Z2,Z))
|
||||
|| TERN0(HAS_Z3_ENABLE, MOTOR_IS_ON(Z3,Z))
|
||||
|| TERN0(HAS_Z4_ENABLE, MOTOR_IS_ON(Z4,Z))
|
||||
)
|
||||
) || (
|
||||
DISABLED(CONTROLLER_FAN_USE_Z_ONLY) &&
|
||||
( MOTOR_IS_ON(X,X) || MOTOR_IS_ON(Y,Y)
|
||||
|| TERN0(HAS_X2_ENABLE, MOTOR_IS_ON(X2,X))
|
||||
|| TERN0(HAS_Y2_ENABLE, MOTOR_IS_ON(Y2,Y))
|
||||
#if E_STEPPERS
|
||||
REPEAT(E_STEPPERS, _OR_ENABLED_E)
|
||||
#endif
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// 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
|
||||
const ena_mask_t axis_mask = TERN(CONTROLLER_FAN_USE_Z_ONLY, _BV(Z_AXIS), ~TERN0(CONTROLLER_FAN_IGNORE_Z, _BV(Z_AXIS)));
|
||||
if ( (stepper.axis_enabled.bits & axis_mask)
|
||||
|| 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
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DIRECT_STEPPING)
|
||||
@@ -173,7 +174,7 @@ namespace DirectStepping {
|
||||
template <typename Cfg>
|
||||
void SerialPageManager<Cfg>::write_responses() {
|
||||
if (fatal_error) {
|
||||
kill(GET_TEXT(MSG_BAD_PAGE));
|
||||
kill(GET_TEXT_F(MSG_BAD_PAGE));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ void I2CPositionEncoder::update() {
|
||||
|
||||
#ifdef I2CPE_ERR_THRESH_ABORT
|
||||
if (ABS(error) > I2CPE_ERR_THRESH_ABORT * planner.settings.axis_steps_per_mm[encoderAxis]) {
|
||||
//kill(PSTR("Significant Error"));
|
||||
//kill(F("Significant Error"));
|
||||
SERIAL_ECHOLNPGM("Axis error over threshold, aborting!", error);
|
||||
safe_delay(5000);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ void I2CPositionEncoder::update() {
|
||||
LOOP_L_N(i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i];
|
||||
const int32_t errorP = int32_t(sumP * RECIPROCAL(I2CPE_ERR_PRST_ARRAY_SIZE));
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
SERIAL_ECHOLNPGM(" : CORRECT ERR ", errorP * planner.steps_to_mm[encoderAxis], "mm");
|
||||
SERIAL_ECHOLNPGM(" : CORRECT ERR ", errorP * planner.mm_per_step[encoderAxis], "mm");
|
||||
babystep.add_steps(encoderAxis, -LROUND(errorP));
|
||||
errPrstIdx = 0;
|
||||
}
|
||||
@@ -232,7 +232,7 @@ bool I2CPositionEncoder::passes_test(const bool report) {
|
||||
if (report) {
|
||||
if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. ");
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
serial_ternary(H == I2CPE_MAG_SIG_BAD, PSTR(" axis "), PSTR("magnetic strip "), PSTR("encoder "));
|
||||
serial_ternary(H == I2CPE_MAG_SIG_BAD, F(" axis "), F("magnetic strip "), F("encoder "));
|
||||
switch (H) {
|
||||
case I2CPE_MAG_SIG_GOOD:
|
||||
case I2CPE_MAG_SIG_MID:
|
||||
|
||||
@@ -75,7 +75,7 @@ void FWRetract::reset() {
|
||||
|
||||
LOOP_L_N(i, EXTRUDERS) {
|
||||
retracted[i] = false;
|
||||
TERN_(HAS_MULTI_EXTRUDER, retracted_swap[i] = false);
|
||||
E_TERN_(retracted_swap[i] = false);
|
||||
current_retract[i] = 0.0;
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ void FWRetract::reset() {
|
||||
* Note: Auto-retract will apply the set Z hop in addition to any Z hop
|
||||
* included in the G-code. Use M207 Z0 to to prevent double hop.
|
||||
*/
|
||||
void FWRetract::retract(const bool retracting OPTARG(HAS_MULTI_EXTRUDER, bool swapping/*=false*/)) {
|
||||
void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/)) {
|
||||
// Prevent two retracts or recovers in a row
|
||||
if (retracted[active_extruder] == retracting) return;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user