Browse Source

update 2.0.x

pull/45/head
Sergey 3 years ago
parent
commit
c4d79ab54c
  1. 2
      Marlin/Configuration.h
  2. 4
      Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.h
  3. 2
      Marlin/src/HAL/DUE/usb/udd.h
  4. 2
      Marlin/src/HAL/LINUX/hardware/Gpio.h
  5. 2
      Marlin/src/HAL/LINUX/hardware/LinearAxis.cpp
  6. 2
      Marlin/src/HAL/LINUX/hardware/Timer.h
  7. 4
      Marlin/src/HAL/LPC1768/inc/SanityCheck.h
  8. 217
      Marlin/src/HAL/NATIVE_SIM/HAL.h
  9. 26
      Marlin/src/HAL/NATIVE_SIM/MarlinSPI.h
  10. 111
      Marlin/src/HAL/NATIVE_SIM/fastio.h
  11. 22
      Marlin/src/HAL/NATIVE_SIM/inc/Conditionals_LCD.h
  12. 31
      Marlin/src/HAL/NATIVE_SIM/inc/Conditionals_adv.h
  13. 22
      Marlin/src/HAL/NATIVE_SIM/inc/Conditionals_post.h
  14. 43
      Marlin/src/HAL/NATIVE_SIM/inc/SanityCheck.h
  15. 61
      Marlin/src/HAL/NATIVE_SIM/pinsDebug.h
  16. 80
      Marlin/src/HAL/NATIVE_SIM/servo_private.h
  17. 55
      Marlin/src/HAL/NATIVE_SIM/spi_pins.h
  18. 64
      Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h
  19. 80
      Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h
  20. 91
      Marlin/src/HAL/NATIVE_SIM/timers.h
  21. 52
      Marlin/src/HAL/NATIVE_SIM/u8g/LCD_I2C_routines.cpp
  22. 37
      Marlin/src/HAL/NATIVE_SIM/u8g/LCD_I2C_routines.h
  23. 44
      Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h
  24. 43
      Marlin/src/HAL/NATIVE_SIM/u8g/LCD_delay.h
  25. 52
      Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp
  26. 46
      Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.h
  27. 171
      Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp
  28. 215
      Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp
  29. 27
      Marlin/src/HAL/NATIVE_SIM/watchdog.h
  30. 8
      Marlin/src/HAL/STM32/HAL.cpp
  31. 6
      Marlin/src/HAL/STM32/HAL_MinSerial.cpp
  32. 6
      Marlin/src/HAL/STM32/HAL_SPI.cpp
  33. 4
      Marlin/src/HAL/STM32/MarlinSPI.cpp
  34. 6
      Marlin/src/HAL/STM32/MarlinSerial.cpp
  35. 10
      Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp
  36. 6
      Marlin/src/HAL/STM32/Servo.cpp
  37. 8
      Marlin/src/HAL/STM32/eeprom_flash.cpp
  38. 6
      Marlin/src/HAL/STM32/eeprom_sdcard.cpp
  39. 6
      Marlin/src/HAL/STM32/eeprom_sram.cpp
  40. 6
      Marlin/src/HAL/STM32/eeprom_wired.cpp
  41. 6
      Marlin/src/HAL/STM32/fast_pwm.cpp
  42. 8
      Marlin/src/HAL/STM32/fastio.cpp
  43. 1
      Marlin/src/HAL/STM32/fastio.h
  44. 6
      Marlin/src/HAL/STM32/msc_sd.cpp
  45. 6
      Marlin/src/HAL/STM32/tft/gt911.cpp
  46. 6
      Marlin/src/HAL/STM32/tft/tft_fsmc.cpp
  47. 10
      Marlin/src/HAL/STM32/tft/tft_ltdc.cpp
  48. 6
      Marlin/src/HAL/STM32/tft/tft_spi.cpp
  49. 6
      Marlin/src/HAL/STM32/tft/xpt2046.cpp
  50. 6
      Marlin/src/HAL/STM32/timers.cpp
  51. 5
      Marlin/src/HAL/STM32/usb_host.cpp
  52. 6
      Marlin/src/HAL/STM32/usb_serial.cpp
  53. 6
      Marlin/src/HAL/STM32/watchdog.cpp
  54. 4
      Marlin/src/HAL/STM32F1/SPI.h
  55. 6
      Marlin/src/HAL/STM32F1/pinsDebug.h
  56. 5
      Marlin/src/HAL/platforms.h
  57. 2
      Marlin/src/HAL/shared/Delay.h
  58. 4
      Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp
  59. 6
      Marlin/src/MarlinCore.cpp
  60. 11
      Marlin/src/core/boards.h
  61. 11
      Marlin/src/core/serial.cpp
  62. 25
      Marlin/src/core/serial.h
  63. 114
      Marlin/src/core/serial_base.h
  64. 4
      Marlin/src/feature/binary_stream.h
  65. 4
      Marlin/src/feature/pause.cpp
  66. 4
      Marlin/src/feature/probe_temp_comp.cpp
  67. 2
      Marlin/src/feature/tmc_util.cpp
  68. 2
      Marlin/src/feature/tmc_util.h
  69. 6
      Marlin/src/gcode/bedlevel/G35.cpp
  70. 16
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  71. 13
      Marlin/src/gcode/bedlevel/mbl/G29.cpp
  72. 36
      Marlin/src/gcode/control/M42.cpp
  73. 4
      Marlin/src/gcode/gcode.cpp
  74. 5
      Marlin/src/gcode/gcode.h
  75. 37
      Marlin/src/gcode/lcd/M256.cpp
  76. 4
      Marlin/src/gcode/lcd/M73.cpp
  77. 4
      Marlin/src/gcode/lcd/M995.cpp
  78. 13
      Marlin/src/inc/Conditionals_LCD.h
  79. 2
      Marlin/src/inc/Conditionals_adv.h
  80. 40
      Marlin/src/inc/Conditionals_post.h
  81. 21
      Marlin/src/inc/SanityCheck.h
  82. 5
      Marlin/src/lcd/dogm/HAL_LCD_com_defines.h
  83. 6
      Marlin/src/lcd/dwin/e3v2/dwin.cpp
  84. 1
      Marlin/src/lcd/dwin/e3v2/dwin.h
  85. 2
      Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp
  86. 6
      Marlin/src/lcd/extui/dgus/DGUSDisplay.h
  87. 2
      Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp
  88. 49
      Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp
  89. 13
      Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp
  90. 60
      Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp
  91. 6
      Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp
  92. 20
      Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp
  93. 20
      Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp
  94. 22
      Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h
  95. 7
      Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp
  96. 2
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp
  97. 2
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_e.cpp
  98. 2
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_xyz.cpp
  99. 20
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/main_menu.cpp
  100. 2
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp

2
Marlin/Configuration.h

@ -980,7 +980,7 @@
#endif
#endif
#define DEFAULT_EJERK 8 // May be used by Linear Advance
#define DEFAULT_EJERK 10 // May be used by Linear Advance
/**
* Junction Deviation Factor

4
Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.h

@ -74,7 +74,7 @@
#define SD_MMC_REMOVING 2
//---- CONTROL FONCTIONS ----
//---- CONTROL FUNCTIONS ----
//!
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
//!/
@ -134,7 +134,7 @@ extern bool sd_mmc_spi_wr_protect(void);
extern bool sd_mmc_spi_removal(void);
//---- ACCESS DATA FONCTIONS ----
//---- ACCESS DATA FUNCTIONS ----
#if ACCESS_USB == true
// Standard functions for open in read/write mode the device

2
Marlin/src/HAL/DUE/usb/udd.h

@ -135,7 +135,7 @@ typedef void (*udd_callback_halt_cleared_t)(void);
* \param n number of data transfered
*/
typedef void (*udd_callback_trans_t) (udd_ep_status_t status,
iram_size_t nb_transfered, udd_ep_id_t ep);
iram_size_t nb_transferred, udd_ep_id_t ep);
/**
* \brief Authorizes the VBUS event

2
Marlin/src/HAL/LINUX/hardware/Gpio.h

@ -40,7 +40,7 @@ struct GpioEvent {
pin_type pin_id;
GpioEvent::Type event;
GpioEvent(uint64_t timestamp, pin_type pin_id, GpioEvent::Type event){
GpioEvent(uint64_t timestamp, pin_type pin_id, GpioEvent::Type event) {
this->timestamp = timestamp;
this->pin_id = pin_id;
this->event = event;

2
Marlin/src/HAL/LINUX/hardware/LinearAxis.cpp

@ -51,7 +51,7 @@ void LinearAxis::update() {
}
void LinearAxis::interrupt(GpioEvent ev) {
if (ev.pin_id == step_pin && !Gpio::pin_map[enable_pin].value){
if (ev.pin_id == step_pin && !Gpio::pin_map[enable_pin].value) {
if (ev.event == GpioEvent::RISE) {
last_update = ev.timestamp;
position += -1 + 2 * Gpio::pin_map[dir_pin].value;

2
Marlin/src/HAL/LINUX/hardware/Timer.h

@ -52,7 +52,7 @@ public:
return (*(intptr_t*)timerid);
}
static void handler(int sig, siginfo_t *si, void *uc){
static void handler(int sig, siginfo_t *si, void *uc) {
Timer* _this = (Timer*)si->si_value.sival_ptr;
_this->avg_error += (Clock::nanos() - _this->start_time) - _this->period; //high_resolution_clock is also limited in precision, but best we have
_this->avg_error /= 2; //very crude precision analysis (actually within +-500ns usually)

4
Marlin/src/HAL/LPC1768/inc/SanityCheck.h

@ -146,7 +146,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#error "Serial port pins (2) conflict with other pins!"
#elif Y_HOME_TO_MIN && IS_TX2(Y_STOP_PIN)
#error "Serial port pins (2) conflict with Y endstop pin!"
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
#elif USES_Z_MIN_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
#error "Serial port pins (2) conflict with probe pin!"
#elif ANY_TX(2, X_ENABLE_PIN, Y_ENABLE_PIN) || ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
#error "Serial port pins (2) conflict with X/Y stepper pins!"
@ -237,7 +237,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#define PIN_IS_SCL2(P) (P##_PIN == P0_11)
#if PIN_IS_SDA2(Y_STOP)
#error "i2c SDA2 overlaps with Y endstop pin!"
#elif HAS_CUSTOM_PROBE_PIN && PIN_IS_SDA2(Z_MIN_PROBE)
#elif USES_Z_MIN_PROBE_PIN && PIN_IS_SDA2(Z_MIN_PROBE)
#error "i2c SDA2 overlaps with Z probe pin!"
#elif PIN_IS_SDA2(X_ENABLE) || PIN_IS_SDA2(Y_ENABLE)
#error "i2c SDA2 overlaps with X/Y ENABLE pin!"

217
Marlin/src/HAL/NATIVE_SIM/HAL.h

@ -0,0 +1,217 @@
/**
* Marlin 3D Printer Firmware
*
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
*
* 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
#define CPU_32_BIT
#define HAL_IDLETASK
void HAL_idletask();
#define F_CPU 100000000
#define SystemCoreClock F_CPU
#include <stdint.h>
#include <stdarg.h>
#undef min
#undef max
#include <algorithm>
#include "pinmapping.h"
void _printf (const char *format, ...);
void _putc(uint8_t c);
uint8_t _getc();
//extern "C" volatile uint32_t _millis;
//arduino: Print.h
#define DEC 10
#define HEX 16
#define OCT 8
#define BIN 2
//arduino: binary.h (weird defines)
#define B01 1
#define B10 2
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio.h"
#include "watchdog.h"
#include "serial.h"
#define SHARED_SERVOS HAS_SERVOS
extern MSerialT serial_stream_0;
extern MSerialT serial_stream_1;
extern MSerialT serial_stream_2;
extern MSerialT serial_stream_3;
#define _MSERIAL(X) serial_stream_##X
#define MSERIAL(X) _MSERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "SERIAL_PORT must be from 0 to 3. Please update your configuration."
#endif
#ifdef SERIAL_PORT_2
#if WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from 0 to 3. Please update your configuration."
#endif
#endif
#ifdef MMU2_SERIAL_PORT
#if WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else
#error "MMU2_SERIAL_PORT must be from 0 to 3. Please update your configuration."
#endif
#endif
#ifdef LCD_SERIAL_PORT
#if WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else
#error "LCD_SERIAL_PORT must be from 0 to 3. Please update your configuration."
#endif
#endif
#define ST7920_DELAY_1 DELAY_NS(600)
#define ST7920_DELAY_2 DELAY_NS(750)
#define ST7920_DELAY_3 DELAY_NS(750)
//
// Interrupts
//
#define CRITICAL_SECTION_START()
#define CRITICAL_SECTION_END()
#define ISRS_ENABLED()
#define ENABLE_ISRS()
#define DISABLE_ISRS()
inline void HAL_init() {}
// Utility functions
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory();
#pragma GCC diagnostic pop
// ADC
#define HAL_ADC_VREF 5.0
#define HAL_ADC_RESOLUTION 10
#define HAL_ANALOG_SELECT(ch) HAL_adc_enable_channel(ch)
#define HAL_START_ADC(ch) HAL_adc_start_conversion(ch)
#define HAL_READ_ADC() HAL_adc_get_result()
#define HAL_ADC_READY() true
void HAL_adc_init();
void HAL_adc_enable_channel(const uint8_t ch);
void HAL_adc_start_conversion(const uint8_t ch);
uint16_t HAL_adc_get_result();
// Reset source
inline void HAL_clear_reset_source(void) {}
inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
/* ---------------- Delay in cycles */
#define DELAY_CYCLES(x) Kernel::delayCycles(x)
#define SYSTEM_YIELD() Kernel::yield()
// Maple Compatibility
typedef void (*systickCallback_t)(void);
void systick_attach_callback(systickCallback_t cb);
extern volatile uint32_t systick_uptime_millis;
// Marlin uses strstr in constexpr context, this is not supported, workaround by defining constexpr versions of the required functions.
#define strstr(a, b) strstr_constexpr((a), (b))
constexpr inline std::size_t strlen_constexpr(const char* str) {
// https://github.com/gcc-mirror/gcc/blob/5c7634a0e5f202935aa6c11b6ea953b8bf80a00a/libstdc%2B%2B-v3/include/bits/char_traits.h#L329
if (str != nullptr) {
std::size_t i = 0;
while (str[i] != '\0') {
++i;
}
return i;
}
return 0;
}
constexpr inline int strncmp_constexpr(const char* lhs, const char* rhs, std::size_t count) {
// https://github.com/gcc-mirror/gcc/blob/13b9cbfc32fe3ac4c81c4dd9c42d141c8fb95db4/libstdc%2B%2B-v3/include/bits/char_traits.h#L655
if (lhs == nullptr || rhs == nullptr) {
return rhs != nullptr ? -1 : 1;
}
for (std::size_t i = 0; i < count; ++i) {
if (lhs[i] != rhs[i]) {
return lhs[i] < rhs[i] ? -1 : 1;
} else if (lhs[i] == '\0') {
return 0;
}
}
return 0;
}
constexpr inline const char* strstr_constexpr(const char* str, const char* target) {
// https://github.com/freebsd/freebsd/blob/master/sys/libkern/strstr.c
if (char c = target != nullptr ? *target++ : '\0'; c != '\0' && str != nullptr) {
std::size_t len = strlen_constexpr(target);
do {
char sc = {};
do {
if ((sc = *str++) == '\0') {
return nullptr;
}
} while (sc != c);
} while (strncmp_constexpr(str, target, len) != 0);
--str;
}
return str;
}
constexpr inline char* strstr_constexpr(char* str, const char* target) {
// https://github.com/freebsd/freebsd/blob/master/sys/libkern/strstr.c
if (char c = target != nullptr ? *target++ : '\0'; c != '\0' && str != nullptr) {
std::size_t len = strlen_constexpr(target);
do {
char sc = {};
do {
if ((sc = *str++) == '\0') {
return nullptr;
}
} while (sc != c);
} while (strncmp_constexpr(str, target, len) != 0);
--str;
}
return str;
}

26
Marlin/src/HAL/NATIVE_SIM/MarlinSPI.h

@ -0,0 +1,26 @@
/**
* Marlin 3D Printer Firmware
*
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
*
* 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;

111
Marlin/src/HAL/NATIVE_SIM/fastio.h

@ -0,0 +1,111 @@
/**
* 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
/**
* Fast I/O Routines for X86_64
*/
#include "../shared/Marduino.h"
#include <pinmapping.h>
#define SET_DIR_INPUT(IO) Gpio::setDir(IO, 1)
#define SET_DIR_OUTPUT(IO) Gpio::setDir(IO, 0)
#define SET_MODE(IO, mode) Gpio::setMode(IO, mode)
#define WRITE_PIN_SET(IO) Gpio::set(IO)
#define WRITE_PIN_CLR(IO) Gpio::clear(IO)
#define READ_PIN(IO) Gpio::get(IO)
#define WRITE_PIN(IO,V) Gpio::set(IO, V)
/**
* Magic I/O routines
*
* Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW);
*
* Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
*/
/// Read a pin
#define _READ(IO) READ_PIN(IO)
/// Write to a pin
#define _WRITE(IO,V) WRITE_PIN(IO,V)
/// toggle a pin
#define _TOGGLE(IO) _WRITE(IO, !READ(IO))
/// set pin as input
#define _SET_INPUT(IO) SET_DIR_INPUT(IO)
/// set pin as output
#define _SET_OUTPUT(IO) SET_DIR_OUTPUT(IO)
/// set pin as input with pullup mode
#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
/// set pin as input with pulldown mode
#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
// hg42: all pins can be input or output (I hope)
// hg42: undefined pins create compile error (IO, is no pin)
// hg42: currently not used, but was used by pinsDebug
/// check if pin is an input
#define _IS_INPUT(IO) (IO >= 0)
/// check if pin is an output
#define _IS_OUTPUT(IO) (IO >= 0)
/// Read a pin wrapper
#define READ(IO) _READ(IO)
/// Write to a pin wrapper
#define WRITE(IO,V) _WRITE(IO,V)
/// toggle a pin wrapper
#define TOGGLE(IO) _TOGGLE(IO)
/// set pin as input wrapper
#define SET_INPUT(IO) _SET_INPUT(IO)
/// set pin as input with pullup wrapper
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
/// set pin as input with pulldown wrapper
#define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0)
/// set pin as output wrapper - reads the pin and sets the output to that value
#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
// set pin as PWM
#define SET_PWM(IO) SET_OUTPUT(IO)
/// check if pin is an input wrapper
#define IS_INPUT(IO) _IS_INPUT(IO)
/// check if pin is an output wrapper
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
// Shorthand
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
// digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)

22
Marlin/src/HAL/NATIVE_SIM/inc/Conditionals_LCD.h

@ -0,0 +1,22 @@
/**
* 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

31
Marlin/src/HAL/NATIVE_SIM/inc/Conditionals_adv.h

@ -0,0 +1,31 @@
/**
* 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
// Add strcmp_P if missing
#ifndef strcmp_P
#define strcmp_P(a, b) strcmp((a), (b))
#endif
#ifndef strcat_P
#define strcat_P(dest, src) strcat((dest), (src))
#endif

22
Marlin/src/HAL/NATIVE_SIM/inc/Conditionals_post.h

@ -0,0 +1,22 @@
/**
* 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

43
Marlin/src/HAL/NATIVE_SIM/inc/SanityCheck.h

@ -0,0 +1,43 @@
/**
* 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
/**
* Test X86_64-specific configuration values for errors at compile-time.
*/
// Emulating RAMPS
#if ENABLED(SPINDLE_LASER_PWM) && !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11)
#error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
#endif
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
#error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on LINUX."
#endif
#if HAS_TMC_SW_SERIAL
#error "TMC220x Software Serial is not supported on LINUX."
#endif
#if ENABLED(POSTMORTEM_DEBUGGING)
#error "POSTMORTEM_DEBUGGING is not yet supported on LINUX."
#endif

61
Marlin/src/HAL/NATIVE_SIM/pinsDebug.h

@ -0,0 +1,61 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* Support routines for X86_64
*/
#pragma once
/**
* Translation of routines & variables used by pinsDebug.h
*/
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
#define pwm_details(pin) pin = pin // do nothing // print PWM details
#define pwm_status(pin) false //Print a pin's PWM status. Return true if it's currently a PWM pin.
#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0)
#define digitalRead_mod(p) digitalRead(p)
#define PRINT_PORT(p)
#define GET_ARRAY_PIN(p) pin_array[p].pin
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
// active ADC function/mode/code values for PINSEL registers
inline constexpr int8_t ADC_pin_mode(pin_t pin) {
return (-1);
}
inline int8_t get_pin_mode(pin_t pin) {
if (!VALID_PIN(pin)) return -1;
return 0;
}
inline bool GET_PINMODE(pin_t pin) {
int8_t pin_mode = get_pin_mode(pin);
if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // found an invalid pin or active analog pin
return false;
return (Gpio::getMode(pin) != 0); //input/output state
}
inline bool GET_ARRAY_IS_DIGITAL(pin_t pin) {
return (!IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin));
}

80
Marlin/src/HAL/NATIVE_SIM/servo_private.h

@ -0,0 +1,80 @@
/**
* 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
/**
* servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
* Copyright (c) 2009 Michael Margolis. All right reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers -
* Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
*
* The only modification was to update/delete macros to match the LPC176x.
*
*/
#include <stdint.h>
// Macros
//values in microseconds
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
#define MAX_SERVOS 4
#define INVALID_SERVO 255 // flag indicating an invalid servo index
// Types
typedef struct {
uint8_t nbr : 8 ; // a pin number from 0 to 254 (255 signals invalid pin)
uint8_t isActive : 1 ; // true if this channel is enabled, pin not pulsed if false
} ServoPin_t;
typedef struct {
ServoPin_t Pin;
unsigned int pulse_width; // pulse width in microseconds
} ServoInfo_t;
// Global variables
extern uint8_t ServoCount;
extern ServoInfo_t servo_info[MAX_SERVOS];

55
Marlin/src/HAL/NATIVE_SIM/spi_pins.h

@ -0,0 +1,55 @@
/**
* 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 "../../core/macros.h"
#include "../../inc/MarlinConfigPre.h"
#if BOTH(HAS_MARLINUI_U8GLIB, SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_ENABLE == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
#define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
// needed due to the speed and mode required for communicating with each device being different.
// This requirement can be removed if the SPI access to these devices is updated to use
// spiBeginTransaction.
#endif
// Onboard SD
//#define SD_SCK_PIN P0_07
//#define SD_MISO_PIN P0_08
//#define SD_MOSI_PIN P0_09
//#define SD_SS_PIN P0_06
// External SD
#ifndef SD_SCK_PIN
#define SD_SCK_PIN 50
#endif
#ifndef SD_MISO_PIN
#define SD_MISO_PIN 51
#endif
#ifndef SD_MOSI_PIN
#define SD_MOSI_PIN 52
#endif
#ifndef SD_SS_PIN
#define SD_SS_PIN 53
#endif
#ifndef SDSS
#define SDSS SD_SS_PIN
#endif

64
Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h

@ -0,0 +1,64 @@
/**
* 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 "../../../inc/MarlinConfig.h"
#ifndef LCD_READ_ID
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
#endif
#ifndef LCD_READ_ID4
#define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341)
#endif
#define DATASIZE_8BIT 8
#define DATASIZE_16BIT 16
#define TFT_IO_DRIVER TFT_SPI
#define DMA_MINC_ENABLE 1
#define DMA_MINC_DISABLE 0
class TFT_SPI {
private:
static uint32_t ReadID(uint16_t Reg);
static void Transmit(uint16_t Data);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
public:
// static SPIClass SPIx;
static void Init();
static uint32_t GetID();
static bool isBusy();
static void Abort();
static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT);
static void DataTransferEnd();
static void DataTransferAbort();
static void WriteData(uint16_t Data);
static void WriteReg(uint16_t Reg);
static void WriteSequence(uint16_t *Data, uint16_t Count);
// static void WriteMultiple(uint16_t Color, uint16_t Count);
static void WriteMultiple(uint16_t Color, uint32_t Count);
};

80
Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h

@ -0,0 +1,80 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../../../inc/MarlinConfig.h"
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
#include <SPI.h>
#endif
#ifndef TOUCH_MISO_PIN
#define TOUCH_MISO_PIN SD_MISO_PIN
#endif
#ifndef TOUCH_MOSI_PIN
#define TOUCH_MOSI_PIN SD_MOSI_PIN
#endif
#ifndef TOUCH_SCK_PIN
#define TOUCH_SCK_PIN SD_SCK_PIN
#endif
#ifndef TOUCH_CS_PIN
#define TOUCH_CS_PIN SD_SS_PIN
#endif
#ifndef TOUCH_INT_PIN
#define TOUCH_INT_PIN -1
#endif
#define XPT2046_DFR_MODE 0x00
#define XPT2046_SER_MODE 0x04
#define XPT2046_CONTROL 0x80
enum XPTCoordinate : uint8_t {
XPT2046_X = 0x10 | XPT2046_CONTROL | XPT2046_DFR_MODE,
XPT2046_Y = 0x50 | XPT2046_CONTROL | XPT2046_DFR_MODE,
XPT2046_Z1 = 0x30 | XPT2046_CONTROL | XPT2046_DFR_MODE,
XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
};
#if !defined(XPT2046_Z1_THRESHOLD)
#define XPT2046_Z1_THRESHOLD 10
#endif
class XPT2046 {
private:
static bool isBusy() { return false; }
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();
static inline void DataTransferBegin();
static inline void DataTransferEnd();
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static uint16_t HardwareIO(uint16_t data);
#endif
static uint16_t SoftwareIO(uint16_t data);
static uint16_t IO(uint16_t data = 0);
public:
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static SPIClass SPIx;
#endif
static void Init();
static bool getRawPoint(int16_t *x, int16_t *y);
};

91
Marlin/src/HAL/NATIVE_SIM/timers.h

@ -0,0 +1,91 @@
/**
* Marlin 3D Printer Firmware
*
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
*
* 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
/**
* HAL timers for Linux X86_64
*/
#include <stdint.h>
// ------------------------
// Defines
// ------------------------
#define FORCE_INLINE __attribute__((always_inline)) inline
typedef uint64_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFFFFFFFFF
#define HAL_TIMER_RATE ((SystemCoreClock) / 4) // frequency of timers peripherals
#ifndef STEP_TIMER_NUM
#define STEP_TIMER_NUM 0 // Timer Index for Stepper
#endif
#ifndef PULSE_TIMER_NUM
#define PULSE_TIMER_NUM STEP_TIMER_NUM
#endif
#ifndef TEMP_TIMER_NUM
#define TEMP_TIMER_NUM 1 // Timer Index for Temperature
#endif
#ifndef SYSTICK_TIMER_NUM
#define SYSTICK_TIMER_NUM 2 // Timer Index for Systick
#endif
#define SYSTICK_TIMER_FREQUENCY 1000
#define TEMP_TIMER_RATE 1000000
#define TEMP_TIMER_FREQUENCY 1000 // temperature interrupt frequency
#define STEPPER_TIMER_RATE HAL_TIMER_RATE // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
#define STEPPER_TIMER_PRESCALE (CYCLES_PER_MICROSECOND / STEPPER_TIMER_TICKS_PER_US)
#define PULSE_TIMER_RATE STEPPER_TIMER_RATE // frequency of pulse timer
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
#define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
#define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM)
#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#ifndef HAL_STEP_TIMER_ISR
#define HAL_STEP_TIMER_ISR() extern "C" void TIMER0_IRQHandler()
#endif
#ifndef HAL_TEMP_TIMER_ISR
#define HAL_TEMP_TIMER_ISR() extern "C" void TIMER1_IRQHandler()
#endif
void HAL_timer_init();
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t compare);
hal_timer_t HAL_timer_get_compare(const uint8_t timer_num);
hal_timer_t HAL_timer_get_count(const uint8_t timer_num);
void HAL_timer_enable_interrupt(const uint8_t timer_num);
void HAL_timer_disable_interrupt(const uint8_t timer_num);
bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
#define HAL_timer_isr_prologue(TIMER_NUM)
#define HAL_timer_isr_epilogue(TIMER_NUM)

52
Marlin/src/HAL/NATIVE_SIM/u8g/LCD_I2C_routines.cpp

@ -0,0 +1,52 @@
/**
* 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/>.
*
*/
// adapted from I2C/master/master.c example
// https://www-users.cs.york.ac.uk/~pcc/MCP/HAPR-Course-web/CMSIS/examples/html/master_8c_source.html
#ifdef __PLAT_NATIVE_SIM__
#include <cstdint>
#ifdef __cplusplus
extern "C" {
#endif
uint8_t u8g_i2c_start(const uint8_t sla) {
return 1;
}
void u8g_i2c_init(const uint8_t clock_option) {
}
uint8_t u8g_i2c_send_byte(uint8_t data) {
return 1;
}
void u8g_i2c_stop() {
}
#ifdef __cplusplus
}
#endif
#endif // __PLAT_NATIVE_SIM__

37
Marlin/src/HAL/NATIVE_SIM/u8g/LCD_I2C_routines.h

@ -0,0 +1,37 @@
/**
* 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
#ifdef __cplusplus
extern "C" {
#endif
void u8g_i2c_init(const uint8_t clock_options);
//uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos);
uint8_t u8g_i2c_start(uint8_t sla);
uint8_t u8g_i2c_send_byte(uint8_t data);
void u8g_i2c_stop();
#ifdef __cplusplus
}
#endif

44
Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h

@ -0,0 +1,44 @@
/**
* 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
void usleep(uint64_t microsec);
// The following are optional depending on the platform.
// definitions of HAL specific com and device drivers.
uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
// connect U8g com generic com names to the desired driver
#define U8G_COM_SW_SPI u8g_com_sw_spi_fn
#define U8G_COM_ST7920_SW_SPI u8g_com_ST7920_sw_spi_fn
// let these default for now
#define U8G_COM_HW_SPI u8g_com_null_fn
#define U8G_COM_ST7920_HW_SPI u8g_com_null_fn
#define U8G_COM_SSD_I2C u8g_com_null_fn
#define U8G_COM_PARALLEL u8g_com_null_fn
#define U8G_COM_T6963 u8g_com_null_fn
#define U8G_COM_FAST_PARALLEL u8g_com_null_fn
#define U8G_COM_UC_I2C u8g_com_null_fn

43
Marlin/src/HAL/NATIVE_SIM/u8g/LCD_delay.h

@ -0,0 +1,43 @@
/**
* 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
/**
* LCD delay routines - used by all the drivers.
*
* These are based on the LPC1768 routines.
*
* Couldn't just call exact copies because the overhead
* results in a one microsecond delay taking about 4µS.
*/
#ifdef __cplusplus
extern "C" {
#endif
void U8g_delay(int msec);
void u8g_MicroDelay();
void u8g_10MicroDelay();
#ifdef __cplusplus
}
#endif

52
Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp

@ -0,0 +1,52 @@
/**
* 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/>.
*
*/
/**
* Low level pin manipulation routines - used by all the drivers.
*
* These are based on the LPC1768 pinMode, digitalRead & digitalWrite routines.
*
* Couldn't just call exact copies because the overhead killed the LCD update speed
* With an intermediate level the softspi was running in the 10-20kHz range which
* resulted in using about about 25% of the CPU's time.
*/
#ifdef __PLAT_NATIVE_SIM__
#include "../fastio.h"
#include "LCD_pin_routines.h"
#ifdef __cplusplus
extern "C" {
#endif
void u8g_SetPinOutput(uint8_t internal_pin_number){SET_DIR_OUTPUT(internal_pin_number);}
void u8g_SetPinInput(uint8_t internal_pin_number){SET_DIR_INPUT(internal_pin_number);}
void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status){WRITE_PIN(pin, pin_status);}
uint8_t u8g_GetPinLevel(uint8_t pin){return READ_PIN(pin);}
void usleep(uint64_t microsec){
assert(false); // why we here?
}
#ifdef __cplusplus
}
#endif
#endif // __PLAT_NATIVE_SIM__

46
Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.h

@ -0,0 +1,46 @@
/**
* 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
/**
* Low level pin manipulation routines - used by all the drivers.
*
* These are based on the LPC1768 pinMode, digitalRead & digitalWrite routines.
*
* Couldn't just call exact copies because the overhead killed the LCD update speed
* With an intermediate level the softspi was running in the 10-20kHz range which
* resulted in using about about 25% of the CPU's time.
*/
#ifdef __cplusplus
extern "C" {
#endif
void u8g_SetPinOutput(uint8_t internal_pin_number);
void u8g_SetPinInput(uint8_t internal_pin_number);
void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status);
uint8_t u8g_GetPinLevel(uint8_t pin);
#ifdef __cplusplus
}
#endif

171
Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp

@ -0,0 +1,171 @@
/**
* 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/>.
*
*/
/**
* Based on u8g_com_st7920_hw_spi.c
*
* Universal 8bit Graphics Library
*
* Copyright (c) 2011, olikraus@gmail.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef __PLAT_NATIVE_SIM__
#include "../../../inc/MarlinConfig.h"
#if ENABLED(U8GLIB_ST7920)
#include <U8glib-HAL.h>
#include "../../shared/Delay.h"
#undef SPI_SPEED
#define SPI_SPEED 6
#define SPI_DELAY_CYCLES (1 + SPI_SPEED * 10)
static pin_t SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL;
static uint8_t SPI_speed = 0;
static uint8_t swSpiTransfer(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin) {
for (uint8_t i = 0; i < 8; i++) {
WRITE_PIN(mosi_pin, !!(b & 0x80));
DELAY_CYCLES(SPI_SPEED);
WRITE_PIN(sck_pin, HIGH);
DELAY_CYCLES(SPI_SPEED);
b <<= 1;
if (miso_pin >= 0 && READ_PIN(miso_pin)) b |= 1;
WRITE_PIN(sck_pin, LOW);
DELAY_CYCLES(SPI_SPEED);
}
return b;
}
static uint8_t swSpiInit(const uint8_t spiRate, const pin_t sck_pin, const pin_t mosi_pin) {
WRITE_PIN(mosi_pin, HIGH);
WRITE_PIN(sck_pin, LOW);
return spiRate;
}
static void u8g_com_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) {
static uint8_t rs_last_state = 255;
if (rs != rs_last_state) {
// Transfer Data (FA) or Command (F8)
swSpiTransfer(rs ? 0x0FA : 0x0F8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
rs_last_state = rs;
DELAY_US(40); // Give the controller time to process the data: 20 is bad, 30 is OK, 40 is safe
}
swSpiTransfer(val & 0x0F0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
swSpiTransfer(val << 4, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
}
#ifdef __cplusplus
extern "C" {
#endif
uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
switch (msg) {
case U8G_COM_MSG_INIT:
SCK_pin_ST7920_HAL = u8g->pin_list[U8G_PI_SCK];
MOSI_pin_ST7920_HAL_HAL = u8g->pin_list[U8G_PI_MOSI];
u8g_SetPIOutput(u8g, U8G_PI_CS);
u8g_SetPIOutput(u8g, U8G_PI_SCK);
u8g_SetPIOutput(u8g, U8G_PI_MOSI);
u8g_Delay(5);
SPI_speed = swSpiInit(SPI_SPEED, SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL);
u8g_SetPILevel(u8g, U8G_PI_CS, 0);
u8g_SetPILevel(u8g, U8G_PI_SCK, 0);
u8g_SetPILevel(u8g, U8G_PI_MOSI, 0);
u8g->pin_list[U8G_PI_A0_STATE] = 0; /* initial RS state: command mode */
break;
case U8G_COM_MSG_STOP:
break;
case U8G_COM_MSG_RESET:
if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
break;
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
break;
case U8G_COM_MSG_CHIP_SELECT:
if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_CS]) u8g_SetPILevel(u8g, U8G_PI_CS, arg_val); //note: the st7920 has an active high chip select
break;
case U8G_COM_MSG_WRITE_BYTE:
u8g_com_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], arg_val);
break;
case U8G_COM_MSG_WRITE_SEQ: {
uint8_t *ptr = (uint8_t*) arg_ptr;
while (arg_val > 0) {
u8g_com_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
arg_val--;
}
}
break;
case U8G_COM_MSG_WRITE_SEQ_P: {
uint8_t *ptr = (uint8_t*) arg_ptr;
while (arg_val > 0) {
u8g_com_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
arg_val--;
}
}
break;
}
return 1;
}
#ifdef __cplusplus
}
#endif
#endif // U8GLIB_ST7920
#endif // TARGET_LPC1768

215
Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp

@ -0,0 +1,215 @@
/**
* 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/>.
*
*/
/**
* Based on u8g_com_std_sw_spi.c
*
* Universal 8bit Graphics Library
*
* Copyright (c) 2015, olikraus@gmail.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef __PLAT_NATIVE_SIM__
#include "../../../inc/MarlinConfig.h"
#if HAS_MARLINUI_U8GLIB && DISABLED(U8GLIB_ST7920)
#undef SPI_SPEED
#define SPI_SPEED 2 // About 2 MHz
#include <Arduino.h>
#include <U8glib-HAL.h>
#ifdef __cplusplus
extern "C" {
#endif
uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) {
LOOP_L_N(i, 8) {
if (spi_speed == 0) {
WRITE_PIN(mosi_pin, !!(b & 0x80));
WRITE_PIN(sck_pin, HIGH);
b <<= 1;
if (miso_pin >= 0 && READ_PIN(miso_pin)) b |= 1;
WRITE_PIN(sck_pin, LOW);
}
else {
const uint8_t state = (b & 0x80) ? HIGH : LOW;
LOOP_L_N(j, spi_speed)
WRITE_PIN(mosi_pin, state);
LOOP_L_N(j, spi_speed + (miso_pin >= 0 ? 0 : 1))
WRITE_PIN(sck_pin, HIGH);
b <<= 1;
if (miso_pin >= 0 && READ_PIN(miso_pin)) b |= 1;
LOOP_L_N(j, spi_speed)
WRITE_PIN(sck_pin, LOW);
}
}
return b;
}
uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) {
LOOP_L_N(i, 8) {
const uint8_t state = (b & 0x80) ? HIGH : LOW;
if (spi_speed == 0) {
WRITE_PIN(sck_pin, LOW);
WRITE_PIN(mosi_pin, state);
WRITE_PIN(mosi_pin, state); // need some setup time
WRITE_PIN(sck_pin, HIGH);
}
else {
LOOP_L_N(j, spi_speed + (miso_pin >= 0 ? 0 : 1))
WRITE_PIN(sck_pin, LOW);
LOOP_L_N(j, spi_speed)
WRITE_PIN(mosi_pin, state);
LOOP_L_N(j, spi_speed)
WRITE_PIN(sck_pin, HIGH);
}
b <<= 1;
if (miso_pin >= 0 && READ_PIN(miso_pin)) b |= 1;
}
return b;
}
static uint8_t SPI_speed = 0;
static uint8_t swSpiInit(const uint8_t spi_speed, const uint8_t clk_pin, const uint8_t mosi_pin) {
return spi_speed;
}
static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
#if EITHER(FYSETC_MINI_12864, MKS_MINI_12864)
swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin);
#else
swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin);
#endif
}
uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
switch (msg) {
case U8G_COM_MSG_INIT:
u8g_SetPIOutput(u8g, U8G_PI_SCK);
u8g_SetPIOutput(u8g, U8G_PI_MOSI);
u8g_SetPIOutput(u8g, U8G_PI_CS);
u8g_SetPIOutput(u8g, U8G_PI_A0);
if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPIOutput(u8g, U8G_PI_RESET);
SPI_speed = swSpiInit(SPI_SPEED, u8g->pin_list[U8G_PI_SCK], u8g->pin_list[U8G_PI_MOSI]);
u8g_SetPILevel(u8g, U8G_PI_SCK, 0);
u8g_SetPILevel(u8g, U8G_PI_MOSI, 0);
break;
case U8G_COM_MSG_STOP:
break;
case U8G_COM_MSG_RESET:
if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
break;
case U8G_COM_MSG_CHIP_SELECT:
#if EITHER(FYSETC_MINI_12864, MKS_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
u8g_SetPILevel(u8g, U8G_PI_CS, LOW);
}
else {
u8g_SetPILevel(u8g, U8G_PI_CS, HIGH);
u8g_SetPILevel(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive
}
#else
u8g_SetPILevel(u8g, U8G_PI_CS, !arg_val);
#endif
break;
case U8G_COM_MSG_WRITE_BYTE:
u8g_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val);
break;
case U8G_COM_MSG_WRITE_SEQ: {
uint8_t *ptr = (uint8_t *)arg_ptr;
while (arg_val > 0) {
u8g_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], *ptr++);
arg_val--;
}
}
break;
case U8G_COM_MSG_WRITE_SEQ_P: {
uint8_t *ptr = (uint8_t *)arg_ptr;
while (arg_val > 0) {
u8g_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], u8g_pgm_read(ptr));
ptr++;
arg_val--;
}
}
break;
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
break;
}
return 1;
}
#ifdef __cplusplus
}
#endif
#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 // __PLAT_NATIVE_SIM__

27
Marlin/src/HAL/NATIVE_SIM/watchdog.h

@ -0,0 +1,27 @@
/**
* 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
#define WDT_TIMEOUT 4000000 // 4 second timeout
void watchdog_init();
void HAL_watchdog_refresh();

8
Marlin/src/HAL/STM32/HAL.cpp

@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "HAL.h"
#include "usb_serial.h"
@ -61,8 +63,6 @@ TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
// HAL initialization task
void HAL_init() {
FastIO_init();
// Ensure F_CPU is a constant expression.
// If the compiler breaks here, it means that delay code that should compute at compile time will not work.
// So better safe than sorry here.
@ -165,4 +165,4 @@ void HAL_SYSTICK_Callback() {
if (systick_user_callback) systick_user_callback();
}
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/HAL_MinSerial.cpp

@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfigPre.h"
@ -149,4 +151,4 @@ extern "C" {
#endif
#endif // POSTMORTEM_DEBUGGING
#endif // ARDUINO_ARCH_STM32
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/HAL_SPI.cpp

@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
@ -224,4 +226,4 @@ static SPISettings spiConfig;
#endif // SOFTWARE_SPI
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

4
Marlin/src/HAL/STM32/MarlinSPI.cpp

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1) && !defined(STM32H7xx)
#if defined(HAL_STM32) && !defined(STM32H7xx)
#include "MarlinSPI.h"
@ -165,4 +165,4 @@ uint8_t MarlinSPI::dmaSend(const void * transmitBuf, uint16_t length, bool minc)
return 1;
}
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1 && !STM32H7xx
#endif // HAL_STM32 && !STM32H7xx

6
Marlin/src/HAL/STM32/MarlinSerial.cpp

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
#include "MarlinSerial.h"
@ -101,4 +103,4 @@ void MarlinSerial::_rx_complete_irq(serial_t *obj) {
}
}
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

10
Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
@ -290,13 +292,13 @@ static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
uint8_t retries = SDIO_READ_RETRIES;
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, NULL, dst)) return true;
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, nullptr, dst)) return true;
return false;
}
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
uint8_t retries = SDIO_READ_RETRIES;
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, NULL)) return true;
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, nullptr)) return true;
return false;
}
@ -320,4 +322,4 @@ extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); }
#endif // SDIO_SUPPORT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/Servo.cpp

@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
@ -107,4 +109,4 @@ void libServo::setInterruptPriority(uint32_t preemptPriority, uint32_t subPriori
}
#endif // HAS_SERVOS
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

8
Marlin/src/HAL/STM32/eeprom_flash.cpp

@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
@ -104,6 +106,8 @@ size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() {
EEPROM.begin(); // Avoid STM32 EEPROM.h warning (do nothing)
#if ENABLED(FLASH_EEPROM_LEVELING)
if (current_slot == -1 || eeprom_data_written) {
@ -270,4 +274,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
}
#endif // FLASH_EEPROM_EMULATION
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/eeprom_sdcard.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
/**
* Implementation of EEPROM settings in SD Card
@ -88,4 +90,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uin
}
#endif // SDCARD_EEPROM_EMULATION
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/eeprom_sram.cpp

@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
@ -65,4 +67,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
}
#endif // SRAM_EEPROM_EMULATION
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/eeprom_wired.cpp

@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
@ -80,4 +82,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
}
#endif // USE_WIRED_EEPROM
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/fast_pwm.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfigPre.h"
@ -56,4 +58,4 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255
}
#endif // NEEDS_HARDWARE_PWM
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

8
Marlin/src/HAL/STM32/fastio.cpp

@ -20,15 +20,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
GPIO_TypeDef* FastIOPortMap[LastPort + 1];
GPIO_TypeDef* FastIOPortMap[LastPort + 1] = { 0 };
void FastIO_init() {
LOOP_L_N(i, NUM_DIGITAL_PINS)
FastIOPortMap[STM_PORT(digitalPin[i])] = get_GPIO_Port(STM_PORT(digitalPin[i]));
}
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

1
Marlin/src/HAL/STM32/fastio.h

@ -38,6 +38,7 @@ extern GPIO_TypeDef * FastIOPortMap[];
// ------------------------
void FastIO_init(); // Must be called before using fast io macros
#define FASTIO_INIT() FastIO_init()
// ------------------------
// Defines

6
Marlin/src/HAL/STM32/msc_sd.cpp

@ -13,7 +13,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfigPre.h"
@ -125,4 +127,4 @@ void MSC_SD_init() {
}
#endif // HAS_SD_HOST_DRIVE
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/tft/gt911.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../../inc/MarlinConfig.h"
@ -199,4 +201,4 @@ bool GT911::getPoint(int16_t *x, int16_t *y) {
}
#endif // TFT_TOUCH_DEVICE_GT911
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/tft/tft_fsmc.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../../inc/MarlinConfig.h"
@ -178,4 +180,4 @@ void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
}
#endif // HAS_FSMC_TFT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

10
Marlin/src/HAL/STM32/tft/tft_ltdc.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../../inc/MarlinConfig.h"
@ -181,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.TotalHeigh = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP + LTDC_LCD_VFP - 1);
hltdc_F.Init.TotalHeight = (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 */
@ -203,7 +205,7 @@ void LTDC_Config() {
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
/* Start Address configuration : frame buffer is located at SDRAM memory */
pLayerCfg.FBStartAdress = (uint32_t)(FRAME_BUFFER_ADDRESS);
pLayerCfg.FBStartAddress = (uint32_t)(FRAME_BUFFER_ADDRESS);
/* Alpha constant (255 == totally opaque) */
pLayerCfg.Alpha = 255;
@ -384,4 +386,4 @@ void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
}
#endif // HAS_LTDC_TFT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/tft/tft_spi.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../../inc/MarlinConfig.h"
@ -240,4 +242,4 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun
}
#endif // HAS_SPI_TFT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/tft/xpt2046.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../../inc/MarlinConfig.h"
@ -167,4 +169,4 @@ uint16_t XPT2046::SoftwareIO(uint16_t data) {
}
#endif // HAS_TFT_XPT2046
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/timers.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
@ -319,4 +321,4 @@ static constexpr bool verify_no_timer_conflicts() {
// when hovering over it, making it easy to identify the conflicting timers.
static_assert(verify_no_timer_conflicts(), "One or more timer conflict detected. Examine \"timers_in_use\" to help identify conflict.");
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

5
Marlin/src/HAL/STM32/usb_host.cpp

@ -19,8 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../platforms.h"
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
@ -114,4 +115,4 @@ uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t b
}
#endif // USE_OTG_USB_HOST && USBHOST
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/usb_serial.cpp

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfigPre.h"
@ -51,4 +53,4 @@ void USB_Hook_init() {
}
#endif // EMERGENCY_PARSER && USBD_USE_CDC
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

6
Marlin/src/HAL/STM32/watchdog.cpp

@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfigPre.h"
@ -46,4 +48,4 @@ void HAL_watchdog_refresh() {
}
#endif // USE_WATCHDOG
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32

4
Marlin/src/HAL/STM32F1/SPI.h

@ -138,8 +138,8 @@ private:
spi_dev *spi_d;
dma_channel spiRxDmaChannel, spiTxDmaChannel;
dma_dev* spiDmaDev;
void (*receiveCallback)() = NULL;
void (*transmitCallback)() = NULL;
void (*receiveCallback)() = nullptr;
void (*transmitCallback)() = nullptr;
friend class SPIClass;
};

6
Marlin/src/HAL/STM32F1/pinsDebug.h

@ -19,15 +19,15 @@
#pragma once
/**
* Support routines for STM32GENERIC (Maple)
* Support routines for MAPLE_STM32F1
*/
/**
* Translation of routines & variables used by pinsDebug.h
*/
#ifndef BOARD_NR_GPIO_PINS // Only in STM32GENERIC (Maple)
#error "Expected BOARD_NR_GPIO_PINS not found"
#ifndef BOARD_NR_GPIO_PINS // Only in MAPLE_STM32F1
#error "Expected BOARD_NR_GPIO_PINS not found"
#endif
#include "fastio.h"

5
Marlin/src/HAL/platforms.h

@ -38,11 +38,16 @@
#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
#define HAL_PATH(PATH, NAME) XSTR(PATH/STM32F1/NAME)
#elif defined(ARDUINO_ARCH_STM32)
#ifndef HAL_STM32
#define HAL_STM32
#endif
#define HAL_PATH(PATH, NAME) XSTR(PATH/STM32/NAME)
#elif defined(ARDUINO_ARCH_ESP32)
#define HAL_PATH(PATH, NAME) XSTR(PATH/ESP32/NAME)
#elif defined(__PLAT_LINUX__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/LINUX/NAME)
#elif defined(__PLAT_NATIVE_SIM__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/NATIVE_SIM/NAME)
#elif defined(__SAMD51__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/SAMD51/NAME)
#else

2
Marlin/src/HAL/shared/Delay.h

@ -160,7 +160,7 @@ void calibrate_delay_loop();
// Delay in microseconds
#define DELAY_US(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL))
#elif defined(__PLAT_LINUX__) || defined(ESP32)
#elif defined(ESP32) || defined(__PLAT_LINUX__) || defined(__PLAT_NATIVE_SIM__)
// DELAY_CYCLES specified inside platform

4
Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp

@ -322,7 +322,7 @@ void hook_cpu_exceptions() {
unsigned long *vecAddr = (unsigned long*)get_vtor();
SERIAL_ECHOPGM("Vector table addr: ");
SERIAL_PRINTLN(get_vtor(), HEX);
SERIAL_PRINTLN(get_vtor(), PrintBase::Hex);
#ifdef VECTOR_TABLE_SIZE
uint32_t vec_size = VECTOR_TABLE_SIZE;
@ -349,7 +349,7 @@ void hook_cpu_exceptions() {
alignas(128) static unsigned long vectable[VECTOR_TABLE_SENTINEL];
SERIAL_ECHOPGM("Detected vector table size: ");
SERIAL_PRINTLN(vec_size, HEX);
SERIAL_PRINTLN(vec_size, PrintBase::Hex);
#endif
uint32_t defaultFaultHandler = vecAddr[(unsigned)7];

6
Marlin/src/MarlinCore.cpp

@ -1126,6 +1126,10 @@ inline void tmc_standby_setup() {
* - Set Marlin to RUNNING State
*/
void setup() {
#ifdef FASTIO_INIT
FASTIO_INIT();
#endif
#ifdef BOARD_PREINIT
BOARD_PREINIT(); // Low-level init (before serial init)
#endif
@ -1589,7 +1593,7 @@ void setup() {
HMI_Init();
DWIN_JPG_CacheTo1(Language_English);
HMI_StartFrame(true);
DWIN_StatusChanged(GET_TEXT(WELCOME_MSG));
DWIN_StatusChanged_P(GET_TEXT(WELCOME_MSG));
#endif
#if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD)

11
Marlin/src/core/boards.h

@ -346,6 +346,9 @@
#define BOARD_BEAST 4048 // STM32F103RET6 Libmaple-based controller
#define BOARD_MINGDA_MPX_ARM_MINI 4049 // STM32F103ZET6 Mingda MD-16
#define BOARD_GTM32_PRO_VD 4050 // STM32F103VET6 controller
#define BOARD_ZONESTAR_ZM3E2 4051 // Zonestar ZM3E2 (STM32F103RCT6)
#define BOARD_ZONESTAR_ZM3E4 4052 // Zonestar ZM3E4 V1 (STM32F103VCT6)
#define BOARD_ZONESTAR_ZM3E4V2 4053 // Zonestar ZM3E4 V2 (STM32F103VCT6)
//
// ARM Cortex-M4F
@ -385,10 +388,10 @@
#define BOARD_MKS_ROBIN2 4224 // MKS_ROBIN2 (STM32F407ZE)
#define BOARD_MKS_ROBIN_PRO_V2 4225 // MKS Robin Pro V2 (STM32F407VE)
#define BOARD_MKS_ROBIN_NANO_V3 4226 // MKS Robin Nano V3 (STM32F407VG)
#define BOARD_ANET_ET4 4227 // ANET ET4 V1.x (STM32F407VGT6)
#define BOARD_ANET_ET4P 4228 // ANET ET4P V1.x (STM32F407VGT6)
#define BOARD_FYSETC_CHEETAH_V20 4229 // FYSETC Cheetah V2.0
#define BOARD_MKS_MONSTER8 4227 // MKS Monster8 (STM32F407VGT6)
#define BOARD_ANET_ET4 4228 // ANET ET4 V1.x (STM32F407VGT6)
#define BOARD_ANET_ET4P 4229 // ANET ET4P V1.x (STM32F407VGT6)
#define BOARD_FYSETC_CHEETAH_V20 4230 // FYSETC Cheetah V2.0
//
// ARM Cortex M7

11
Marlin/src/core/serial.cpp

@ -76,17 +76,6 @@ void serialprintPGM(PGM_P str) {
void serial_echo_start() { static PGMSTR(echomagic, "echo:"); serialprintPGM(echomagic); }
void serial_error_start() { static PGMSTR(errormagic, "Error:"); serialprintPGM(errormagic); }
void serial_echopair_PGM(PGM_P const s_P, serial_char_t v) { serialprintPGM(s_P); SERIAL_CHAR(v.c); }
void serial_echopair_PGM(PGM_P const s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, char v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, float v) { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
void serial_echopair_PGM(PGM_P const s_P, double v) { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
void serial_echopair_PGM(PGM_P const s_P, unsigned char v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, unsigned int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
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*/) {

25
Marlin/src/core/serial.h

@ -37,6 +37,7 @@ extern const char NUL_STR[],
SP_I_LBL[], SP_J_LBL[], SP_K_LBL[],
SP_P_STR[], SP_T_STR[],
X_STR[], Y_STR[], Z_STR[], E_STR[],
I_STR[], J_STR[], K_STR[],
X_LBL[], Y_LBL[], Z_LBL[], E_LBL[],
I_LBL[], J_LBL[], K_LBL[];
@ -176,8 +177,8 @@ void SERIAL_ECHOLN(T x) { SERIAL_IMPL.println(x); }
template <typename T, typename U>
void SERIAL_PRINT(T x, U y) { SERIAL_IMPL.print(x, y); }
template <typename T, typename U>
void SERIAL_PRINTLN(T x, U y) { SERIAL_IMPL.println(x, y); }
template <typename T>
void SERIAL_PRINTLN(T x, PrintBase y) { SERIAL_IMPL.println(x, y); }
// Flush the serial port
inline void SERIAL_FLUSH() { SERIAL_IMPL.flush(); }
@ -292,16 +293,16 @@ void serialprintPGM(PGM_P str);
//
// Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
//
void serial_echopair_PGM(PGM_P const s_P, serial_char_t v);
void serial_echopair_PGM(PGM_P const s_P, const char *v);
void serial_echopair_PGM(PGM_P const s_P, char v);
void serial_echopair_PGM(PGM_P const s_P, int v);
void serial_echopair_PGM(PGM_P const s_P, long v);
void serial_echopair_PGM(PGM_P const s_P, float v);
void serial_echopair_PGM(PGM_P const s_P, double v);
void serial_echopair_PGM(PGM_P const s_P, unsigned char v);
void serial_echopair_PGM(PGM_P const s_P, unsigned int v);
void serial_echopair_PGM(PGM_P const s_P, unsigned long v);
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); }
// 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_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); }

114
Marlin/src/core/serial_base.h

@ -74,12 +74,12 @@ CALL_IF_EXISTS_IMPL(SerialFeature, features, SerialFeature::None);
// for any type other than double/float. For double/float, a conversion exists so the call will be invisible.
struct EnsureDouble {
double a;
FORCE_INLINE operator double() { return a; }
operator double() { return a; }
// If the compiler breaks on ambiguity here, it's likely because print(X, base) is called with X not a double/float, and
// a base that's not a PrintBase value. This code is made to detect the error. You MUST set a base explicitly like this:
// SERIAL_PRINT(v, PrintBase::Hex)
FORCE_INLINE EnsureDouble(double a) : a(a) {}
FORCE_INLINE EnsureDouble(float a) : a(a) {}
EnsureDouble(double a) : a(a) {}
EnsureDouble(float a) : a(a) {}
};
// Using Curiously-Recurring Template Pattern here to avoid virtual table cost when compiling.
@ -136,70 +136,90 @@ struct SerialBase {
void flushTX() { CALL_IF_EXISTS(void, SerialChild, flushTX); }
// Glue code here
FORCE_INLINE void write(const char *str) { while (*str) write(*str++); }
FORCE_INLINE void write(const uint8_t *buffer, size_t size) { while (size--) write(*buffer++); }
FORCE_INLINE void print(const char *str) { write(str); }
void write(const char *str) { while (*str) write(*str++); }
void write(const uint8_t *buffer, size_t size) { while (size--) write(*buffer++); }
void print(char *str) { write(str); }
void print(const char *str) { write(str); }
// No default argument to avoid ambiguity
NO_INLINE void print(char c, PrintBase base) { printNumber((signed long)c, (uint8_t)base); }
NO_INLINE void print(unsigned char c, PrintBase base) { printNumber((unsigned long)c, (uint8_t)base); }
NO_INLINE void print(int c, PrintBase base) { printNumber((signed long)c, (uint8_t)base); }
NO_INLINE void print(unsigned int c, PrintBase base) { printNumber((unsigned long)c, (uint8_t)base); }
void print(unsigned long c, PrintBase base) { printNumber((unsigned long)c, (uint8_t)base); }
void print(long c, PrintBase base) { printNumber((signed long)c, (uint8_t)base); }
void print(EnsureDouble c, int digits) { printFloat(c, digits); }
// Define print for every fundamental integer type, to ensure that all redirect properly
// to the correct underlying implementation.
// Prints are performed with a single size, to avoid needing multiple print functions.
// The fixed integer size used for prints will be the larger of long or a pointer.
#if __LONG_WIDTH__ >= __INTPTR_WIDTH__
typedef long int_fixed_print_t;
typedef unsigned long uint_fixed_print_t;
#else
typedef intptr_t int_fixed_print_t;
typedef uintptr_t uint_fixed_print_t;
FORCE_INLINE void print(intptr_t c, PrintBase base) { printNumber_signed(c, base); }
FORCE_INLINE void print(uintptr_t c, PrintBase base) { printNumber_unsigned(c, base); }
#endif
FORCE_INLINE void print(char c, PrintBase base) { printNumber_signed(c, base); }
FORCE_INLINE void print(short c, PrintBase base) { printNumber_signed(c, base); }
FORCE_INLINE void print(int c, PrintBase base) { printNumber_signed(c, base); }
FORCE_INLINE void print(long c, PrintBase base) { printNumber_signed(c, base); }
FORCE_INLINE void print(unsigned char c, PrintBase base) { printNumber_unsigned(c, base); }
FORCE_INLINE void print(unsigned short c, PrintBase base) { printNumber_unsigned(c, base); }
FORCE_INLINE void print(unsigned int c, PrintBase base) { printNumber_unsigned(c, base); }
FORCE_INLINE void print(unsigned long c, PrintBase base) { printNumber_unsigned(c, base); }
void print(EnsureDouble c, int digits) { printFloat(c, digits); }
// Forward the call to the former's method
FORCE_INLINE void print(char c) { print(c, PrintBase::Dec); }
FORCE_INLINE void print(unsigned char c) { print(c, PrintBase::Dec); }
FORCE_INLINE void print(int c) { print(c, PrintBase::Dec); }
FORCE_INLINE void print(unsigned int c) { print(c, PrintBase::Dec); }
FORCE_INLINE void print(unsigned long c) { print(c, PrintBase::Dec); }
FORCE_INLINE void print(long c) { print(c, PrintBase::Dec); }
FORCE_INLINE void print(double c) { print(c, 2); }
FORCE_INLINE void println(const char s[]) { print(s); println(); }
FORCE_INLINE void println(char c, PrintBase base) { print(c, base); println(); }
FORCE_INLINE void println(unsigned char c, PrintBase base) { print(c, base); println(); }
FORCE_INLINE void println(int c, PrintBase base) { print(c, base); println(); }
FORCE_INLINE void println(unsigned int c, PrintBase base) { print(c, base); println(); }
FORCE_INLINE void println(long c, PrintBase base) { print(c, base); println(); }
FORCE_INLINE void println(unsigned long c, PrintBase base) { print(c, base); println(); }
FORCE_INLINE void println(double c, int digits) { print(c, digits); println(); }
FORCE_INLINE void println() { write('\r'); write('\n'); }
// Default implementation for anything without a specialization
// This handles integers since they are the most common
template <typename T>
void print(T c) { print(c, PrintBase::Dec); }
void print(float c) { print(c, 2); }
void print(double c) { print(c, 2); }
void println(char *s) { print(s); println(); }
void println(const char *s) { print(s); println(); }
void println(float c, int digits) { print(c, digits); println(); }
void println(double c, int digits) { print(c, digits); println(); }
void println() { write('\r'); write('\n'); }
// Default implementations for types without a specialization. Handles integers.
template <typename T>
void println(T c, PrintBase base) { print(c, base); println(); }
template <typename T>
void println(T c) { println(c, PrintBase::Dec); }
// Forward the call to the former's method
FORCE_INLINE void println(char c) { println(c, PrintBase::Dec); }
FORCE_INLINE void println(unsigned char c) { println(c, PrintBase::Dec); }
FORCE_INLINE void println(int c) { println(c, PrintBase::Dec); }
FORCE_INLINE void println(unsigned int c) { println(c, PrintBase::Dec); }
FORCE_INLINE void println(unsigned long c) { println(c, PrintBase::Dec); }
FORCE_INLINE void println(long c) { println(c, PrintBase::Dec); }
FORCE_INLINE void println(double c) { println(c, 2); }
void println(float c) { println(c, 2); }
void println(double c) { println(c, 2); }
// Print a number with the given base
NO_INLINE void printNumber(unsigned long n, const uint8_t base) {
if (!base) return; // Hopefully, this should raise visible bug immediately
NO_INLINE void printNumber_unsigned(uint_fixed_print_t n, PrintBase base) {
if (n) {
unsigned char buf[8 * sizeof(long)]; // Enough space for base 2
int8_t i = 0;
while (n) {
buf[i++] = n % base;
n /= base;
buf[i++] = n % (uint_fixed_print_t)base;
n /= (uint_fixed_print_t)base;
}
while (i--) write((char)(buf[i] + (buf[i] < 10 ? '0' : 'A' - 10)));
}
else write('0');
}
void printNumber(signed long n, const uint8_t base) {
if (base == 10 && n < 0) {
NO_INLINE void printNumber_signed(int_fixed_print_t n, PrintBase base) {
if (base == PrintBase::Dec && n < 0) {
n = -n; // This works because all platforms Marlin's builds on are using 2-complement encoding for negative number
// On such CPU, changing the sign of a number is done by inverting the bits and adding one, so if n = 0x80000000 = -2147483648 then
// -n = 0x7FFFFFFF + 1 => 0x80000000 = 2147483648 (if interpreted as unsigned) or -2147483648 if interpreted as signed.
// On non 2-complement CPU, there would be no possible representation for 2147483648.
write('-');
}
printNumber((unsigned long)n , base);
printNumber_unsigned((uint_fixed_print_t)n , base);
}
// Print a decimal number
@ -218,7 +238,7 @@ struct SerialBase {
// Extract the integer part of the number and print it
unsigned long int_part = (unsigned long)number;
double remainder = number - (double)int_part;
printNumber(int_part, 10);
printNumber_unsigned(int_part, PrintBase::Dec);
// Print the decimal point, but only if there are digits beyond
if (digits) {
@ -227,7 +247,7 @@ struct SerialBase {
while (digits--) {
remainder *= 10.0;
unsigned long toPrint = (unsigned long)remainder;
printNumber(toPrint, 10);
printNumber_unsigned(toPrint, PrintBase::Dec);
remainder -= toPrint;
}
}

4
Marlin/src/feature/binary_stream.h

@ -148,9 +148,9 @@ public:
case FileTransfer::QUERY:
SERIAL_ECHOPAIR("PFT:version:", VERSION_MAJOR, ".", VERSION_MINOR, ".", VERSION_PATCH);
#if ENABLED(BINARY_STREAM_COMPRESSION)
SERIAL_ECHOLNPAIR(":compresion:heatshrink,", HEATSHRINK_STATIC_WINDOW_BITS, ",", HEATSHRINK_STATIC_LOOKAHEAD_BITS);
SERIAL_ECHOLNPAIR(":compression:heatshrink,", HEATSHRINK_STATIC_WINDOW_BITS, ",", HEATSHRINK_STATIC_LOOKAHEAD_BITS);
#else
SERIAL_ECHOLNPGM(":compresion:none");
SERIAL_ECHOLNPGM(":compression:none");
#endif
break;
case FileTransfer::OPEN:

4
Marlin/src/feature/pause.cpp

@ -535,8 +535,8 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), CONTINUE_STR));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Reheat finished.")));
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_REHEATDONE), CONTINUE_STR));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_REHEATDONE)));
wait_for_user = true;
nozzle_timed_out = false;

4
Marlin/src/feature/probe_temp_comp.cpp

@ -143,13 +143,13 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) {
// Sanity check
for (calib_idx = 0; calib_idx < measurements; ++calib_idx) {
// Restrict the max. offset
if (abs(data[calib_idx]) > 2000) {
if (ABS(data[calib_idx]) > 2000) {
SERIAL_ECHOLNPGM("!Invalid Z-offset detected (0-2).");
clear_offsets(tsi);
return false;
}
// Restrict the max. offset difference between two probings
if (calib_idx > 0 && abs(data[calib_idx - 1] - data[calib_idx]) > 800) {
if (calib_idx > 0 && ABS(data[calib_idx - 1] - data[calib_idx]) > 800) {
SERIAL_ECHOLNPGM("!Invalid Z-offset between two probings detected (0-0.8).");
clear_offsets(TSI_PROBE);
return false;

2
Marlin/src/feature/tmc_util.cpp

@ -208,7 +208,7 @@
#if ENABLED(STOP_ON_ERROR)
void report_driver_error(const TMC_driver_data &data) {
SERIAL_ECHOPGM(" driver error detected: 0x");
SERIAL_PRINTLN(data.drv_status, HEX);
SERIAL_PRINTLN(data.drv_status, PrintBase::Hex);
if (data.is_ot) SERIAL_ECHOLNPGM("overtemperature");
if (data.is_s2g) SERIAL_ECHOLNPGM("coil short circuit");
TERN_(TMC_DEBUG, tmc_report_all());

2
Marlin/src/feature/tmc_util.h

@ -330,7 +330,7 @@ void tmc_print_current(TMC &st) {
void tmc_print_sgt(TMC &st) {
st.printLabel();
SERIAL_ECHOPGM(" homing sensitivity: ");
SERIAL_PRINTLN(st.homing_threshold(), DEC);
SERIAL_PRINTLN(st.homing_threshold(), PrintBase::Dec);
}
#endif

6
Marlin/src/gcode/bedlevel/G35.cpp

@ -130,7 +130,7 @@ void GcodeSuite::G35() {
// Calculate adjusts
LOOP_S_L_N(i, 1, G35_PROBE_COUNT) {
const float diff = z_measured[0] - z_measured[i],
adjust = abs(diff) < 0.001f ? 0 : diff / threads_factor[(screw_thread - 30) / 10];
adjust = ABS(diff) < 0.001f ? 0 : diff / threads_factor[(screw_thread - 30) / 10];
const int full_turns = trunc(adjust);
const float decimal_part = adjust - float(full_turns);
@ -138,8 +138,8 @@ void GcodeSuite::G35() {
SERIAL_ECHOPGM("Turn ");
SERIAL_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i]));
SERIAL_ECHOPAIR(" ", (screw_thread & 1) == (adjust > 0) ? "CCW" : "CW", " by ", abs(full_turns), " turns");
if (minutes) SERIAL_ECHOPAIR(" and ", abs(minutes), " minutes");
SERIAL_ECHOPAIR(" ", (screw_thread & 1) == (adjust > 0) ? "CCW" : "CW", " by ", ABS(full_turns), " turns");
if (minutes) SERIAL_ECHOPAIR(" and ", ABS(minutes), " minutes");
if (ENABLED(REPORT_TRAMMING_MM)) SERIAL_ECHOPAIR(" (", -diff, "mm)");
SERIAL_EOL();
}

16
Marlin/src/gcode/bedlevel/abl/G29.cpp

@ -217,6 +217,8 @@ public:
* There's no extra effect if you have a fixed Z probe.
*/
G29_TYPE GcodeSuite::G29() {
DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING));
TERN_(PROBE_MANUALLY, static) G29_State abl;
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
@ -227,11 +229,7 @@ G29_TYPE GcodeSuite::G29() {
// G29 Q is also available if debugging
#if ENABLED(DEBUG_LEVELING_FEATURE)
const uint8_t old_debug_flags = marlin_debug_flags;
if (seenQ) marlin_debug_flags |= MARLIN_DEBUG_LEVELING;
DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING));
if (DEBUGGING(LEVELING)) log_machine_info();
marlin_debug_flags = old_debug_flags;
if (seenQ || DEBUGGING(LEVELING)) log_machine_info();
if (DISABLED(PROBE_MANUALLY) && seenQ) G29_RETURN(false);
#endif
@ -365,6 +363,8 @@ G29_TYPE GcodeSuite::G29() {
#if ABL_USES_GRID
xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_FEEDRATE));
if (!xy_probe_feedrate_mm_s) xy_probe_feedrate_mm_s = PLANNER_XY_FEEDRATE();
NOLESS(xy_probe_feedrate_mm_s, planner.settings.min_feedrate_mm_s);
const float x_min = probe.min_x(), x_max = probe.max_x(),
y_min = probe.min_y(), y_max = probe.max_y();
@ -472,10 +472,8 @@ G29_TYPE GcodeSuite::G29() {
// Query G29 status
if (abl.verbose_level || seenQ) {
SERIAL_ECHOPGM("Manual G29 ");
if (g29_in_progress) {
SERIAL_ECHOPAIR("point ", _MIN(abl.abl_probe_index + 1, abl.abl_points));
SERIAL_ECHOLNPAIR(" of ", abl.abl_points);
}
if (g29_in_progress)
SERIAL_ECHOLNPAIR("point ", _MIN(abl.abl_probe_index + 1, abl.abl_points), " of ", abl.abl_points);
else
SERIAL_ECHOLNPGM("idle");
}

13
Marlin/src/gcode/bedlevel/mbl/G29.cpp

@ -42,6 +42,9 @@
#include "../../../lcd/extui/ui_api.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../../core/debug_out.h"
// Save 130 bytes with non-duplication of PSTR
inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }
@ -59,6 +62,16 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
* S5 Reset and disable mesh
*/
void GcodeSuite::G29() {
DEBUG_SECTION(log_G29, "G29", true);
// G29 Q is also available if debugging
#if ENABLED(DEBUG_LEVELING_FEATURE)
const bool seenQ = parser.seen_test('Q');
if (seenQ || DEBUGGING(LEVELING)) {
log_machine_info();
if (seenQ) return;
}
#endif
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));

36
Marlin/src/gcode/control/M42.cpp

@ -31,6 +31,13 @@
#include "../../module/temperature.h"
#endif
#ifdef MAPLE_STM32F1
// these are enums on the F1...
#define INPUT_PULLDOWN INPUT_PULLDOWN
#define INPUT_ANALOG INPUT_ANALOG
#define OUTPUT_OPEN_DRAIN OUTPUT_OPEN_DRAIN
#endif
void protected_pin_err() {
SERIAL_ERROR_MSG(STR_ERR_PROTECTED_PIN);
}
@ -55,13 +62,20 @@ void GcodeSuite::M42() {
if (!parser.boolval('I') && pin_is_protected(pin)) return protected_pin_err();
bool avoidWrite = false;
if (parser.seenval('M')) {
switch (parser.value_byte()) {
case 0: pinMode(pin, INPUT); break;
case 0: pinMode(pin, INPUT); avoidWrite = true; break;
case 1: pinMode(pin, OUTPUT); break;
case 2: pinMode(pin, INPUT_PULLUP); break;
case 2: pinMode(pin, INPUT_PULLUP); avoidWrite = true; break;
#ifdef INPUT_PULLDOWN
case 3: pinMode(pin, INPUT_PULLDOWN); break;
case 3: pinMode(pin, INPUT_PULLDOWN); avoidWrite = true; break;
#endif
#ifdef INPUT_ANALOG
case 4: pinMode(pin, INPUT_ANALOG); avoidWrite = true; break;
#endif
#ifdef OUTPUT_OPEN_DRAIN
case 5: pinMode(pin, OUTPUT_OPEN_DRAIN); break;
#endif
default: SERIAL_ECHOLNPGM("Invalid Pin Mode"); return;
}
@ -99,8 +113,22 @@ void GcodeSuite::M42() {
}
#endif
pinMode(pin, OUTPUT);
if (avoidWrite) {
SERIAL_ECHOLNPGM("?Cannot write to INPUT");
return;
}
// An OUTPUT_OPEN_DRAIN should not be changed to normal OUTPUT (STM32)
// Use M42 Px M1/5 S0/1 to set the output type and then set value
#ifndef OUTPUT_OPEN_DRAIN
pinMode(pin, OUTPUT);
#endif
extDigitalWrite(pin, pin_status);
#ifdef ARDUINO_ARCH_STM32
// A simple I/O will be set to 0 by analogWrite()
if (pin_status <= 1) return;
#endif
analogWrite(pin, pin_status);
}

4
Marlin/src/gcode/gcode.cpp

@ -783,6 +783,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 250: M250(); break; // M250: Set LCD contrast
#endif
#if HAS_LCD_BRIGHTNESS
case 256: M256(); break; // M256: Set LCD brightness
#endif
#if ENABLED(EXPERIMENTAL_I2CBUS)
case 260: M260(); break; // M260: Send data to an i2c slave
case 261: M261(); break; // M261: Request data from an i2c slave

5
Marlin/src/gcode/gcode.h

@ -191,6 +191,7 @@
* M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>" (Requires DIRECT_PIN_CONTROL)
* M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE)
* M250 - Set LCD contrast: "M250 C<contrast>" (0-63). (Requires LCD support)
* M256 - Set LCD brightness: "M256 B<brightness>" (0-255). (Requires an LCD with brightness control)
* M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS)
* M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS)
* M280 - Set servo position absolute: "M280 P<index> S<angle|µs>". (Requires servos)
@ -818,6 +819,10 @@ private:
static void M250();
#endif
#if HAS_LCD_BRIGHTNESS
static void M256();
#endif
#if ENABLED(EXPERIMENTAL_I2CBUS)
static void M260();
static void M261();

37
Marlin/src/gcode/lcd/M256.cpp

@ -0,0 +1,37 @@
/**
* 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/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if HAS_LCD_BRIGHTNESS
#include "../gcode.h"
#include "../../lcd/marlinui.h"
/**
* M256: Set the LCD brightness
*/
void GcodeSuite::M256() {
if (parser.seenval('B')) ui.set_brightness(parser.value_int());
SERIAL_ECHOLNPAIR("LCD Brightness: ", ui.brightness);
}
#endif // HAS_LCD_BRIGHTNESS

4
Marlin/src/gcode/lcd/M73.cpp

@ -35,13 +35,13 @@
* M73 P25 ; Set progress to 25%
*/
void GcodeSuite::M73() {
if (parser.seen('P'))
if (parser.seenval('P'))
ui.set_progress((PROGRESS_SCALE) > 1
? parser.value_float() * (PROGRESS_SCALE)
: parser.value_byte()
);
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
if (parser.seen('R')) ui.set_remaining_time(60 * parser.value_ulong());
if (parser.seenval('R')) ui.set_remaining_time(60 * parser.value_ulong());
#endif
}

4
Marlin/src/gcode/lcd/M995.cpp

@ -26,7 +26,7 @@
#include "../gcode.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../lcd/extui/mks_ui/draw_touch_calibration.h"
#else
#include "../../lcd/menu/menu.h"
@ -37,7 +37,7 @@
*/
void GcodeSuite::M995() {
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
lv_draw_touch_calibration_screen();
#else
ui.goto_screen(touch_screen_calibration);

13
Marlin/src/inc/Conditionals_LCD.h

@ -141,6 +141,13 @@
#define IS_RRD_SC 1
#define IS_U8GLIB_SSD1306
#elif ENABLED(SAV_3DGLCD)
#ifdef U8GLIB_SSD1306
#define IS_U8GLIB_SSD1306
#endif
#define IS_NEWPANEL 1
#elif ENABLED(FYSETC_242_OLED_12864)
#define IS_RRD_SC 1
@ -764,7 +771,7 @@
#endif
/**
* Set flags for enabled probes
* Set a flag for any type of bed probe, including the paper-test
*/
#if ANY(HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE)
#define HAS_BED_PROBE 1
@ -904,9 +911,9 @@
#define HAS_PROBE_XY_OFFSET 1
#endif
#if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && !BOTH(DELTA, SENSORLESS_PROBING)
#define HAS_CUSTOM_PROBE_PIN 1
#define USES_Z_MIN_PROBE_PIN 1
#endif
#if Z_HOME_TO_MIN && (!HAS_CUSTOM_PROBE_PIN || ENABLED(USE_PROBE_FOR_Z_HOMING))
#if Z_HOME_TO_MIN && TERN1(USES_Z_MIN_PROBE_PIN, ENABLED(USE_PROBE_FOR_Z_HOMING))
#define HOMING_Z_WITH_PROBE 1
#endif
#ifndef Z_PROBE_LOW_POINT

2
Marlin/src/inc/Conditionals_adv.h

@ -567,7 +567,7 @@
#endif
#if BOTH(HAS_TFT_LVGL_UI, CUSTOM_MENU_MAIN)
#define _HAS_1(N) (defined(USER_DESC_##N) && defined(USER_GCODE_##N))
#define _HAS_1(N) (defined(MAIN_MENU_ITEM_##N##_DESC) && defined(MAIN_MENU_ITEM_##N##_GCODE))
#define HAS_USER_ITEM(V...) DO(HAS,||,V)
#else
#define HAS_USER_ITEM(N) 0

40
Marlin/src/inc/Conditionals_post.h

@ -2151,6 +2151,15 @@
#if defined(Z4_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z4)
#define Z4_SENSORLESS 1
#endif
#if defined(I_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(I)
#define I_SENSORLESS 1
#endif
#if defined(J_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(J)
#define J_SENSORLESS 1
#endif
#if defined(K_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(K)
#define K_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(X)
#define X_HAS_STEALTHCHOP 1
@ -2212,8 +2221,21 @@
#if ENABLED(SPI_ENDSTOPS)
#define X_SPI_SENSORLESS X_SENSORLESS
#define Y_SPI_SENSORLESS Y_SENSORLESS
#define Z_SPI_SENSORLESS Z_SENSORLESS
#if HAS_Y_AXIS
#define Y_SPI_SENSORLESS Y_SENSORLESS
#endif
#if HAS_Z_AXIS
#define Z_SPI_SENSORLESS Z_SENSORLESS
#endif
#if LINEAR_AXES >= 4
#define I_SPI_SENSORLESS I_SENSORLESS
#endif
#if LINEAR_AXES >= 5
#define J_SPI_SENSORLESS J_SENSORLESS
#endif
#if LINEAR_AXES >= 6
#define K_SPI_SENSORLESS K_SENSORLESS
#endif
#endif
#ifndef X_INTERPOLATE
#define X_INTERPOLATE INTERPOLATE
@ -2459,7 +2481,7 @@
//
// Is an endstop plug used for extra Z endstops or the probe?
#define IS_PROBE_PIN(A,M) (HAS_CUSTOM_PROBE_PIN && Z_MIN_PROBE_PIN == A##_##M##_PIN)
#define IS_PROBE_PIN(A,M) (USES_Z_MIN_PROBE_PIN && Z_MIN_PROBE_PIN == A##_##M##_PIN)
#define IS_X2_ENDSTOP(A,M) (ENABLED(X_DUAL_ENDSTOPS) && X2_USE_ENDSTOP == _##A##M##_)
#define IS_Y2_ENDSTOP(A,M) (ENABLED(Y_DUAL_ENDSTOPS) && Y2_USE_ENDSTOP == _##A##M##_)
#define IS_Z2_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && Z2_USE_ENDSTOP == _##A##M##_)
@ -2473,16 +2495,16 @@
#if _HAS_STOP(X,MAX)
#define HAS_X_MAX 1
#endif
#if HAS_Y_AXIS && _HAS_STOP(Y,MIN)
#if _HAS_STOP(Y,MIN)
#define HAS_Y_MIN 1
#endif
#if HAS_Y_AXIS && _HAS_STOP(Y,MAX)
#if _HAS_STOP(Y,MAX)
#define HAS_Y_MAX 1
#endif
#if BOTH(HAS_Z_AXIS, USE_ZMIN_PLUG) && _HAS_STOP(Z,MIN)
#if _HAS_STOP(Z,MIN)
#define HAS_Z_MIN 1
#endif
#if BOTH(HAS_Z_AXIS, USE_ZMAX_PLUG) && _HAS_STOP(Z,MAX)
#if _HAS_STOP(Z,MAX)
#define HAS_Z_MAX 1
#endif
#if _HAS_STOP(I,MIN)
@ -2533,10 +2555,12 @@
#if PIN_EXISTS(Z4_MAX)
#define HAS_Z4_MAX 1
#endif
#if BOTH(HAS_BED_PROBE, HAS_CUSTOM_PROBE_PIN) && PIN_EXISTS(Z_MIN_PROBE)
#if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE)
#define HAS_Z_MIN_PROBE_PIN 1
#endif
#undef _HAS_STOP
#undef IS_PROBE_PIN
#undef IS_X2_ENDSTOP
#undef IS_Y2_ENDSTOP

21
Marlin/src/inc/SanityCheck.h

@ -1178,6 +1178,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "Please select either MIXING_EXTRUDER or SWITCHING_EXTRUDER, not both."
#elif ENABLED(SINGLENOZZLE)
#error "MIXING_EXTRUDER is incompatible with SINGLENOZZLE."
#elif ENABLED(DISABLE_INACTIVE_EXTRUDER)
#error "MIXING_EXTRUDER is incompatible with DISABLE_INACTIVE_EXTRUDER."
#endif
#endif
@ -1204,6 +1206,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
);
#if ENABLED(S_CURVE_ACCELERATION) && DISABLED(EXPERIMENTAL_SCURVE)
#error "LIN_ADVANCE and S_CURVE_ACCELERATION may not play well together! Enable EXPERIMENTAL_SCURVE to continue."
#elif ENABLED(DIRECT_STEPPING)
#error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. Enable in external planner if possible."
#elif !HAS_JUNCTION_DEVIATION && defined(DEFAULT_EJERK)
static_assert(DEFAULT_EJERK >= 10, "It is strongly recommended to set DEFAULT_EJERK >= 10 when using LIN_ADVANCE.");
#endif
#endif
@ -2041,10 +2047,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Cooler (-5): requires TEMP_COOLER_PIN"
#endif
#if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0 && !PIN_EXISTS(TEMP_0_CS)
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 0 requires TEMP_0_CS_PIN."
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1 && !PIN_EXISTS(TEMP_1_CS)
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 1 requires TEMP_1_CS_PIN."
#if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E0) && !PIN_EXISTS(TEMP_0_CS)
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE E0 requires TEMP_0_CS_PIN."
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1) && !PIN_EXISTS(TEMP_1_CS)
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE E1 requires TEMP_1_CS_PIN."
#endif
#endif
@ -3574,13 +3580,6 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#error "SAVED_POSITIONS must be an integer from 0 to 256."
#endif
/**
* Stepper Chunk support
*/
#if BOTH(DIRECT_STEPPING, LIN_ADVANCE)
#error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. Enable in external planner if possible."
#endif
/**
* Touch Screen Calibration
*/

5
Marlin/src/lcd/dogm/HAL_LCD_com_defines.h

@ -97,6 +97,11 @@
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn
#define U8G_COM_SSD_I2C_HAL u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
#elif defined(__PLAT_NATIVE_SIM__)
uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_HAL_SW_SPI_FN u8g_com_sw_spi_fn
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_ST7920_sw_spi_fn
#endif
#ifndef U8G_COM_HAL_SW_SPI_FN

6
Marlin/src/lcd/dwin/e3v2/dwin.cpp

@ -4128,6 +4128,12 @@ void DWIN_StatusChanged(const char *text) {
DWIN_UpdateLCD();
}
void DWIN_StatusChanged_P(PGM_P const pstr) {
char str[strlen_P((const char*)pstr) + 1];
strcpy_P(str, (const char*)pstr);
DWIN_StatusChanged(str);
}
// GUI extension
void DWIN_Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool mode=false) {
DWIN_Draw_String(false,true,font8x16,Select_Color,bcolor,x+4,y,F(mode ? "x" : " "));

1
Marlin/src/lcd/dwin/e3v2/dwin.h

@ -404,6 +404,7 @@ void DWIN_Update();
void EachMomentUpdate();
void DWIN_HandleScreen();
void DWIN_StatusChanged(const char *text);
void DWIN_StatusChanged_P(PGM_P const pstr);
void DWIN_Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool mode /* = false*/);
inline void DWIN_StartHoming() { HMI_flag.home_flag = true; }

2
Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp

@ -121,7 +121,7 @@ ENCODER_DiffState Encoder_ReceiveAnalyze() {
lastEncoderBits = newbutton;
}
if (abs(temp_diff) >= ENCODER_PULSES_PER_STEP) {
if (ABS(temp_diff) >= ENCODER_PULSES_PER_STEP) {
if (temp_diff > 0) temp_diffState = ENCODER_DIFF_CW;
else temp_diffState = ENCODER_DIFF_CCW;

6
Marlin/src/lcd/extui/dgus/DGUSDisplay.h

@ -108,14 +108,14 @@ private:
static bool Initialized, no_reentrance;
};
#define GET_VARIABLE(f, t, V...) (&DGUSDisplay::GetVariable<decltype(t), f, t, ##V>)
#define SET_VARIABLE(f, t, V...) (&DGUSDisplay::SetVariable<decltype(t), f, t, ##V>)
extern DGUSDisplay dgusdisplay;
// compile-time x^y
constexpr float cpow(const float x, const int y) { return y == 0 ? 1.0 : x * cpow(x, y - 1); }
///
const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen);
/// Find the flash address of a DGUS_VP_Variable for the VP.
const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp);

2
Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp

@ -559,7 +559,7 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
#endif
#if ENABLED(PIDTEMPBED)
case VP_PID_AUTOTUNE_BED:
sprintf_P(buf, PSTR("M303 E-1 C5 S70 U1"));
strcpy_P(buf, PSTR("M303 E-1 C5 S70 U1"));
break;
#endif
}

49
Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp

@ -41,7 +41,10 @@
uint16_t distanceToMove = 10;
#endif
const uint16_t VPList_Boot[] PROGMEM = { VP_MARLIN_VERSION, 0x0000 };
const uint16_t VPList_Boot[] PROGMEM = {
VP_MARLIN_VERSION,
0x0000
};
const uint16_t VPList_Main[] PROGMEM = {
// VP_M117, for completeness, but it cannot be auto-uploaded.
@ -101,7 +104,7 @@ const uint16_t VPList_Status[] PROGMEM = {
};
const uint16_t VPList_Status2[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded */
// VP_M117, for completeness, but it cannot be auto-uploaded
#if HAS_HOTEND
VP_Flowrate_E0,
#if HAS_MULTI_EXTRUDER
@ -286,28 +289,28 @@ const uint16_t VPList_Z_Offset[] PROGMEM = {
};
const struct VPMapping VPMap[] PROGMEM = {
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
{ DGUSLCD_SCREEN_PREHEAT, VPList_Preheat },
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
{ DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
{ DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
{ DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
{ DGUSLCD_SCREEN_PREHEAT, VPList_Preheat },
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
{ DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
{ DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
{ DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
{ DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
{ DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
{ DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting },
{ DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
{ DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
{ DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset },
{ DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM },
{ DGUSLCD_SCREEN_PID_E, VPList_PIDE0 },
{ DGUSLCD_SCREEN_PID_BED, VPList_PIDBED },
{ DGUSLCD_SCREEN_INFOS, VPList_Infos },
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
{ DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
{ DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting },
{ DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
{ DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
{ DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset },
{ DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM },
{ DGUSLCD_SCREEN_PID_E, VPList_PIDE0 },
{ DGUSLCD_SCREEN_PID_BED, VPList_PIDBED },
{ DGUSLCD_SCREEN_INFOS, VPList_Infos },
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
};

13
Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp

@ -42,6 +42,8 @@
#if ENABLED(SDSUPPORT)
static ExtUI::FileList filelist;
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
if (touched_nr > filelist.count()) return;
@ -83,7 +85,7 @@
case 1: // Pause
GotoScreen(MKSLCD_SCREEN_PAUSE);
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
if (!ExtUI::isPrintingFromMediaPaused()) {
ExtUI::pausePrint();
//ExtUI::mks_pausePrint();
@ -409,8 +411,15 @@ bool DGUSScreenHandler::loop() {
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
booted = true;
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) {
booted = true;
if (TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
GotoScreen(DGUSLCD_SCREEN_POWER_LOSS);
else
GotoScreen(DGUSLCD_SCREEN_MAIN);
}
#endif
return IsScreenComplete();
}

60
Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp

@ -47,7 +47,7 @@ const uint16_t VPList_Boot[] PROGMEM = {
};
const uint16_t VPList_Main[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
// VP_M117, for completeness, but it cannot be auto-uploaded.
#if HAS_HOTEND
VP_T_E0_Is, VP_T_E0_Set, VP_E0_STATUS,
#if HOTENDS >= 2
@ -83,7 +83,7 @@ const uint16_t VPList_Temp[] PROGMEM = {
};
const uint16_t VPList_Status[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded */
// VP_M117, for completeness, but it cannot be auto-uploaded
#if HAS_HOTEND
VP_T_E0_Is, VP_T_E0_Set,
#if HOTENDS >= 2
@ -104,7 +104,7 @@ const uint16_t VPList_Status[] PROGMEM = {
};
const uint16_t VPList_Status2[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded */
// VP_M117, for completeness, but it cannot be auto-uploaded
#if HAS_HOTEND
VP_Flowrate_E0,
#if HOTENDS >= 2
@ -292,28 +292,28 @@ const uint16_t VPList_Z_Offset[] PROGMEM = {
};
const struct VPMapping VPMap[] PROGMEM = {
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
{ DGUSLCD_SCREEN_PREHEAT, VPList_Preheat },
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
{ DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset },
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
{ DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
{ DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
{ DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
{ DGUSLCD_SCREEN_BOOT, VPList_Boot },
{ DGUSLCD_SCREEN_MAIN, VPList_Main },
{ DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp },
{ DGUSLCD_SCREEN_STATUS, VPList_Status },
{ DGUSLCD_SCREEN_STATUS2, VPList_Status2 },
{ DGUSLCD_SCREEN_PREHEAT, VPList_Preheat },
{ DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove },
{ DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset },
{ DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude },
{ DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating },
{ DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload },
{ DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload },
{ DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation },
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
{ DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
{ DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting },
{ DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
{ DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
{ DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM },
{ DGUSLCD_SCREEN_PID_E, VPList_PIDE0 },
{ DGUSLCD_SCREEN_PID_BED, VPList_PIDBED },
{ DGUSLCD_SCREEN_INFOS, VPList_Infos },
{ DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList },
{ DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune },
{ DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting },
{ DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat },
{ DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting },
{ DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM },
{ DGUSLCD_SCREEN_PID_E, VPList_PIDE0 },
{ DGUSLCD_SCREEN_PID_BED, VPList_PIDBED },
{ DGUSLCD_SCREEN_INFOS, VPList_Infos },
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
};
@ -395,7 +395,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr),
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
#if ENABLED(PIDTEMP)
#if ENABLED(PIDTEMPBED)
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
@ -445,11 +445,11 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr),
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),

6
Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp

@ -22,7 +22,7 @@
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(DGUS_LCD_UI_HYPRECY)
#if ENABLED(DGUS_LCD_UI_HIPRECY)
#include "../DGUSScreenHandler.h"
@ -42,6 +42,8 @@
#if ENABLED(SDSUPPORT)
static ExtUI::FileList filelist;
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
if (touched_nr > filelist.count()) return;
@ -415,4 +417,4 @@ bool DGUSScreenHandler::loop() {
return IsScreenComplete();
}
#endif // DGUS_LCD_UI_HYPRECY
#endif // DGUS_LCD_UI_HIPRECY

20
Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp

@ -624,25 +624,25 @@ void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_pt
switch (point_value) {
case 0x0001:
enqueue_corner_move(X_MIN_POS + abs(mks_corner_offsets[0].x),
Y_MIN_POS + abs(mks_corner_offsets[0].y), level_speed);
enqueue_corner_move(X_MIN_POS + ABS(mks_corner_offsets[0].x),
Y_MIN_POS + ABS(mks_corner_offsets[0].y), level_speed);
queue.enqueue_now_P(PSTR("G28Z"));
break;
case 0x0002:
enqueue_corner_move(X_MAX_POS - abs(mks_corner_offsets[1].x),
Y_MIN_POS + abs(mks_corner_offsets[1].y), level_speed);
enqueue_corner_move(X_MAX_POS - ABS(mks_corner_offsets[1].x),
Y_MIN_POS + ABS(mks_corner_offsets[1].y), level_speed);
break;
case 0x0003:
enqueue_corner_move(X_MAX_POS - abs(mks_corner_offsets[2].x),
Y_MAX_POS - abs(mks_corner_offsets[2].y), level_speed);
enqueue_corner_move(X_MAX_POS - ABS(mks_corner_offsets[2].x),
Y_MAX_POS - ABS(mks_corner_offsets[2].y), level_speed);
break;
case 0x0004:
enqueue_corner_move(X_MIN_POS + abs(mks_corner_offsets[3].x),
Y_MAX_POS - abs(mks_corner_offsets[3].y), level_speed);
enqueue_corner_move(X_MIN_POS + ABS(mks_corner_offsets[3].x),
Y_MAX_POS - ABS(mks_corner_offsets[3].y), level_speed);
break;
case 0x0005:
enqueue_corner_move(abs(mks_corner_offsets[4].x),
abs(mks_corner_offsets[4].y), level_speed);
enqueue_corner_move(ABS(mks_corner_offsets[4].x),
ABS(mks_corner_offsets[4].y), level_speed);
break;
}

20
Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp

@ -50,7 +50,7 @@ const uint16_t VPList_Boot[] PROGMEM = {
};
const uint16_t VPList_Main[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
// VP_M117, for completeness, but it cannot be auto-uploaded.
0x0000
};
@ -68,7 +68,7 @@ const uint16_t VPList_Temp[] PROGMEM = {
};
const uint16_t VPList_Status[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded */
// VP_M117, for completeness, but it cannot be auto-uploaded
#if HAS_HOTEND
VP_T_E0_Is, VP_T_E0_Set,
#if HOTENDS >= 2
@ -162,8 +162,8 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
// Temperature Data
#if HAS_HOTEND
VPHELPER(VP_T_E0_Is, nullptr, nullptr, SET_VARIABLE(getActualTemp_celsius, E0, long)),
VPHELPER(VP_T_E0_Set, nullptr, GET_VARIABLE(setTargetTemp_celsius, E0), SET_VARIABLE(getTargetTemp_celsius, E0)),
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_Flowrate_E0, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
@ -194,7 +194,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#endif
#endif
#if HAS_HEATED_BED
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr),
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
@ -247,11 +247,11 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr),
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),

22
Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h

@ -24,17 +24,17 @@
#include "../DGUSDisplayDef.h"
enum DGUSLCD_Screens : uint8_t {
DGUSLCD_SCREEN_BOOT = 0,
DGUSLCD_SCREEN_MAIN = 10,
DGUSLCD_SCREEN_TEMPERATURE = 20,
DGUSLCD_SCREEN_STATUS = 30,
DGUSLCD_SCREEN_STATUS2 = 32,
DGUSLCD_SCREEN_MANUALMOVE = 40,
DGUSLCD_SCREEN_MANUALEXTRUDE = 42,
DGUSLCD_SCREEN_FANANDFEEDRATE = 44,
DGUSLCD_SCREEN_FLOWRATES = 46,
DGUSLCD_SCREEN_SDFILELIST = 50,
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 52,
DGUSLCD_SCREEN_BOOT = 0,
DGUSLCD_SCREEN_MAIN = 10,
DGUSLCD_SCREEN_TEMPERATURE = 20,
DGUSLCD_SCREEN_STATUS = 30,
DGUSLCD_SCREEN_STATUS2 = 32,
DGUSLCD_SCREEN_MANUALMOVE = 40,
DGUSLCD_SCREEN_MANUALEXTRUDE = 42,
DGUSLCD_SCREEN_FANANDFEEDRATE = 44,
DGUSLCD_SCREEN_FLOWRATES = 46,
DGUSLCD_SCREEN_SDFILELIST = 50,
DGUSLCD_SCREEN_SDPRINTMANIPULATION = 52,
DGUSLCD_SCREEN_POWER_LOSS = 100,
DGUSLCD_SCREEN_PREHEAT = 120,
DGUSLCD_SCREEN_UTILITY = 110,

7
Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp

@ -85,7 +85,7 @@
case 1: // Pause
GotoScreen(MKSLCD_SCREEN_PAUSE);
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
if (!ExtUI::isPrintingFromMediaPaused()) {
ExtUI::pausePrint();
//ExtUI::mks_pausePrint();
@ -411,9 +411,12 @@ bool DGUSScreenHandler::loop() {
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
booted = true;
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) {
booted = true;
GotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUSLCD_SCREEN_POWER_LOSS : DGUSLCD_SCREEN_MAIN);
}
#endif
return IsScreenComplete();
}

2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp

@ -87,7 +87,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
.tag(13) .button(BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE))
.tag(14) .button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_RESTORE_DEFAULTS))
.colors(action_btn)
.tag(1). button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK));
.tag(1). button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE));
#undef GRID_COLS
#undef GRID_ROWS
}

2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_e.cpp

@ -36,7 +36,7 @@ bool BioConfirmHomeE::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1:
#if defined(AXIS_LEVELING_COMMANDS) && defined(PARK_AND_RELEASE_COMMANDS)
SpinnerDialogBox::enqueueAndWait_P(F(
SpinnerDialogBox::enqueueAndWait(F(
"G28 E\n"
AXIS_LEVELING_COMMANDS "\n"
PARK_AND_RELEASE_COMMANDS

2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_xyz.cpp

@ -36,7 +36,7 @@ bool BioConfirmHomeXYZ::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1:
#ifdef PARK_AND_RELEASE_COMMANDS
SpinnerDialogBox::enqueueAndWait_P(F(
SpinnerDialogBox::enqueueAndWait(F(
"G28\n"
PARK_AND_RELEASE_COMMANDS
));

20
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/main_menu.cpp

@ -54,7 +54,7 @@ void MainMenu::onRedraw(draw_mode_t what) {
.tag(8).button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_ADVANCED_SETTINGS))
.tag(9).button(BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_MENU))
.colors(action_btn)
.tag(1).button(BTN_POS(1,10), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK));
.tag(1).button(BTN_POS(1,10), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE));
}
#undef GRID_COLS
@ -67,17 +67,17 @@ bool MainMenu::onTouchEnd(uint8_t tag) {
const bool e_homed = isAxisPositionKnown(E0);
switch (tag) {
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
case 2: GOTO_SCREEN(BioConfirmHomeXYZ); break;
case 3: SpinnerDialogBox::enqueueAndWait_P(e_homed ? F("G0 E0 F120") : F("G112")); break;
case 4: StatusScreen::unlockMotors(); break;
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
case 2: GOTO_SCREEN(BioConfirmHomeXYZ); break;
case 3: SpinnerDialogBox::enqueueAndWait(e_homed ? F("G0 E0 F120") : F("G112")); break;
case 4: StatusScreen::unlockMotors(); break;
#ifdef AXIS_LEVELING_COMMANDS
case 5: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break;
case 5: SpinnerDialogBox::enqueueAndWait(F(AXIS_LEVELING_COMMANDS)); break;
#endif
case 6: GOTO_SCREEN(TemperatureScreen); break;
case 7: GOTO_SCREEN(InterfaceSettingsScreen); break;
case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
case 9: GOTO_SCREEN(AboutScreen); break;
case 6: GOTO_SCREEN(TemperatureScreen); break;
case 7: GOTO_SCREEN(InterfaceSettingsScreen); break;
case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
case 9: GOTO_SCREEN(AboutScreen); break;
default:
return false;
}

2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp

@ -316,7 +316,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
case 9: GOTO_SCREEN(FilesScreen); break;
case 10: GOTO_SCREEN(MainMenu); break;
case 13: GOTO_SCREEN(BioConfirmHomeE); break;
case 14: SpinnerDialogBox::enqueueAndWait_P(F("G28Z")); break;
case 14: SpinnerDialogBox::enqueueAndWait(F("G28Z")); break;
case 15: GOTO_SCREEN(TemperatureScreen); break;
case 16: fine_motion = !fine_motion; break;
default: return false;

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save