Merge branch 'bugfix-2.1.x' into LPC4078
This commit is contained in:
@@ -37,6 +37,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
test-platform:
|
||||
|
||||
|
||||
@@ -3424,7 +3424,9 @@
|
||||
#define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens
|
||||
#define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus
|
||||
|
||||
//#define DISABLE_ENCODER // Disable the click encoder, if any
|
||||
#if ANY(TFT_CLASSIC_UI, TFT_COLOR_UI)
|
||||
//#define NO_BACK_MENU_ITEM // Don't display a top menu item to go back to the parent menu
|
||||
#endif
|
||||
|
||||
#define TOUCH_SCREEN_CALIBRATION
|
||||
|
||||
|
||||
+18
-16
@@ -603,7 +603,9 @@
|
||||
* (Does not work on Sanguinololu with FAN_SOFT_PWM.)
|
||||
*/
|
||||
#define FAN_KICKSTART_TIME 100 // (ms)
|
||||
#define FAN_KICKSTART_POWER 180 // 64-255
|
||||
#define FAN_KICKSTART_POWER 255 // 64-255
|
||||
//#define FAN_KICKSTART_LINEAR // Set kickstart time linearly based on the speed, e.g., for 20% (51) it will be FAN_KICKSTART_TIME * 0.2.
|
||||
// Useful for quick speed up to low speed. Kickstart power must be set to 255.
|
||||
|
||||
// Some coolers may require a non-zero "off" state.
|
||||
//#define FAN_OFF_PWM 1
|
||||
@@ -1331,8 +1333,6 @@
|
||||
//#define CALIBRATION_SCRIPT_PRE "M117 Starting Auto-Calibration\nT0\nG28\nG12\nM117 Calibrating..."
|
||||
//#define CALIBRATION_SCRIPT_POST "M500\nM117 Calibration data saved"
|
||||
|
||||
#define CALIBRATION_MEASUREMENT_RESOLUTION 0.01 // mm
|
||||
|
||||
#define CALIBRATION_FEEDRATE_SLOW 60 // mm/min
|
||||
#define CALIBRATION_FEEDRATE_FAST 1200 // mm/min
|
||||
#define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/min
|
||||
@@ -2329,6 +2329,7 @@
|
||||
*
|
||||
* Control extrusion rate based on instantaneous extruder velocity. Can be used to correct for
|
||||
* underextrusion at high extruder speeds that are otherwise well-behaved (i.e., not skipping).
|
||||
* For better results also enable ADAPTIVE_STEP_SMOOTHING.
|
||||
*/
|
||||
//#define NONLINEAR_EXTRUSION
|
||||
|
||||
@@ -2556,27 +2557,28 @@
|
||||
//#define MINIMUM_STEPPER_PRE_DIR_DELAY 650
|
||||
|
||||
/**
|
||||
* Minimum stepper driver pulse width (in µs)
|
||||
* 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers
|
||||
* 0 : Minimum 500ns for LV8729, adjusted in stepper.h
|
||||
* 1 : Minimum for A4988 and A5984 stepper drivers
|
||||
* 2 : Minimum for DRV8825 stepper drivers
|
||||
* 3 : Minimum for TB6600 stepper drivers
|
||||
* 30 : Minimum for TB6560 stepper drivers
|
||||
* Minimum stepper driver pulse width (in ns)
|
||||
* If undefined, these defaults (from Conditionals_adv.h) apply:
|
||||
* 100 : Minimum for TMC2xxx stepper drivers
|
||||
* 500 : Minimum for LV8729
|
||||
* 1000 : Minimum for A4988 and A5984 stepper drivers
|
||||
* 2000 : Minimum for DRV8825 stepper drivers
|
||||
* 3000 : Minimum for TB6600 stepper drivers
|
||||
* 30000 : Minimum for TB6560 stepper drivers
|
||||
*
|
||||
* Override the default value based on the driver type set in Configuration.h.
|
||||
*/
|
||||
#define MINIMUM_STEPPER_PULSE 10
|
||||
#define MINIMUM_STEPPER_PULSE_NS 3500
|
||||
|
||||
/**
|
||||
* Maximum stepping rate (in Hz) the stepper driver allows
|
||||
* If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE)
|
||||
* If undefined, these defaults (from Conditionals_adv.h) apply:
|
||||
* 5000000 : Maximum for TMC2xxx stepper drivers
|
||||
* 1000000 : Maximum for LV8729 stepper driver
|
||||
* 500000 : Maximum for A4988 stepper driver
|
||||
* 250000 : Maximum for DRV8825 stepper driver
|
||||
* 150000 : Maximum for TB6600 stepper driver
|
||||
* 15000 : Maximum for TB6560 stepper driver
|
||||
* 500000 : Maximum for A4988 stepper driver
|
||||
* 250000 : Maximum for DRV8825 stepper driver
|
||||
* 150000 : Maximum for TB6600 stepper driver
|
||||
* 15000 : Maximum for TB6560 stepper driver
|
||||
*
|
||||
* Override the default value based on the driver type set in Configuration.h.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
//#define STRING_DISTRIBUTION_DATE "2024-05-24"
|
||||
//#define STRING_DISTRIBUTION_DATE "2024-07-07"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
|
||||
@@ -141,7 +141,7 @@ typedef Servo hal_servo_t;
|
||||
#error "LCD_SERIAL_PORT must be from 0 to 3."
|
||||
#endif
|
||||
#define LCD_SERIAL lcdSerial
|
||||
#if HAS_DGUS_LCD
|
||||
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
||||
#endif
|
||||
#endif
|
||||
@@ -159,7 +159,7 @@ typedef Servo hal_servo_t;
|
||||
#define GET_PIN_MAP_INDEX(pin) pin
|
||||
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
||||
|
||||
#define HAL_SENSITIVE_PINS 0, 1,
|
||||
#define HAL_SENSITIVE_PINS 0, 1
|
||||
|
||||
#ifdef __AVR_AT90USB1286__
|
||||
#define JTAG_DISABLE() do{ MCUCR = 0x80; MCUCR = 0x80; }while(0)
|
||||
|
||||
@@ -629,7 +629,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
|
||||
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
|
||||
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
|
||||
|
||||
#if HAS_DGUS_LCD
|
||||
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||
template<typename Cfg>
|
||||
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
|
||||
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
static ring_buffer_pos_t available();
|
||||
static void write(const uint8_t c);
|
||||
static void flushTX();
|
||||
#if HAS_DGUS_LCD
|
||||
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||
static ring_buffer_pos_t get_tx_buffer_free();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -345,6 +345,14 @@ void setup_endstop_interrupts() {
|
||||
pciSetup(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if USE_CALIBRATION
|
||||
#if (digitalPinToInterrupt(CALIBRATION_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(CALIBRATION_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(CALIBRATION_PIN), "CALIBRATION_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
|
||||
pciSetup(CALIBRATION_PIN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// If we arrive here without raising an assertion, each pin has either an EXT-interrupt or a PCI.
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
|
||||
else {
|
||||
if (p == 32 || p == 128) continue; // Skip TIMER2 specific prescalers when not TIMER2
|
||||
const uint16_t rft = (F_CPU) / (p * f_desired);
|
||||
DEBUG_ECHOLNPGM("(Not Timer 2) F_CPU=" STRINGIFY(F_CPU), " prescaler=", p, " f_desired=", f_desired);
|
||||
DEBUG_ECHOLNPGM("(Not Timer 2) F_CPU=", STRINGIFY(F_CPU), " prescaler=", p, " f_desired=", f_desired);
|
||||
res_fast_temp = rft - 1;
|
||||
res_pc_temp = rft / 2;
|
||||
}
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
* Port : E0 E1 E4 E5 G5 E3 H3 H4 H5 H6 B4 B5 B6 B7 J1 J0 H1 H0 D3 D2 D1 D0 A0 A1 A2 A3 A4 A5 A6 A7 C7 C6 C5 C4 C3 C2 C1 C0 D7 G2 G1 G0 L7 L6 L5 L4 L3 L2 L1 L0 B3 B2 B1 B0 F0 F1 F2 F3 F4 F5 F6 F7 K0 K1 K2 K3 K4 K5 K6 K7 | E2 E6 E7 xx xx H2 H7 G3 G4 xx xx xx xx xx D4 D5 D6 xx xx J2 J3 J4 J5 J6 J7 xx xx xx xx xx
|
||||
* Logical Pin : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 78 79 80 xx xx 84 85 71 70 xx xx xx xx xx 81 82 83 xx xx 72 73 75 76 77 74 xx xx xx xx xx
|
||||
* Analog Input : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
*
|
||||
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
|
||||
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
|
||||
*/
|
||||
|
||||
#include "../fastio.h"
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
*
|
||||
* Logical Pin: 38 39 40 41 42 43 44 45 16 10 11 12 06 07 08 09 30 31 32 33 34 35 36 37 17 18 19 20 21 22 23 24 00 01 13 05 02 03 14 15 46 47 48 49 50 51 52 53 25 26 27 28 29 04
|
||||
* Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 G0 G1 G2 G3 G4 G5
|
||||
*
|
||||
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
|
||||
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
|
||||
*/
|
||||
|
||||
#include "../fastio.h"
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
*
|
||||
* Logical Pin: 08 09 10 11 12 13 14 15 16 17 18 19 20 21 00 01 02 03 04 05 06 07
|
||||
* Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
|
||||
*
|
||||
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
|
||||
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
|
||||
*/
|
||||
|
||||
#include "../fastio.h"
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
*
|
||||
* Logical Pin: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
||||
* Port: B0 B1 B2 B3 B4 B5 B6 B7 D0 D1 D2 D3 D4 D5 D6 D7 C0 C1 C2 C3 C4 C5 C6 C7 A7 A6 A5 A4 A3 A2 A1 A0
|
||||
*
|
||||
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
|
||||
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
|
||||
*/
|
||||
|
||||
/** ATMega644
|
||||
|
||||
@@ -27,9 +27,6 @@
|
||||
* Logical Pin: 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07 08 09(46*47)36 37 18 19 38 39 40 41 42 43 44 45
|
||||
* Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7
|
||||
* The logical pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3
|
||||
*
|
||||
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
|
||||
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
|
||||
*/
|
||||
|
||||
#include "../fastio.h"
|
||||
|
||||
@@ -120,7 +120,7 @@ void u8g_spiSend_sw_AVR_mode_3(uint8_t val) {
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
#if ENABLED(FYSETC_MINI_12864)
|
||||
#if U8G_SPI_USE_MODE_3
|
||||
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_3
|
||||
#else
|
||||
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_0
|
||||
@@ -143,9 +143,9 @@ uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ENABLED(FYSETC_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
|
||||
#if U8G_SPI_USE_MODE_3 // 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_com_arduino_digital_write(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ void setup_endstop_interrupts() {
|
||||
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
|
||||
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
|
||||
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
|
||||
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
|
||||
|
||||
@@ -68,16 +68,15 @@
|
||||
* Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time
|
||||
* as the TMC2130 soft SPI the most common setup.
|
||||
*/
|
||||
#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN))
|
||||
|
||||
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
|
||||
#if ENABLED(TMC_USE_SW_SPI)
|
||||
#if DISABLED(SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
|
||||
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."
|
||||
#endif
|
||||
#elif ENABLED(SOFTWARE_SPI)
|
||||
#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN))
|
||||
#if DISABLED(SOFTWARE_SPI) && ENABLED(TMC_USE_SW_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
|
||||
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."
|
||||
#endif
|
||||
#if ENABLED(SOFTWARE_SPI) && DISABLED(TMC_USE_SW_SPI)
|
||||
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
|
||||
#endif
|
||||
#undef _IS_HW_SPI
|
||||
#endif
|
||||
|
||||
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
/**
|
||||
* Define SPI Pins: SCK, MISO, MOSI, SS
|
||||
*
|
||||
* Available chip select pins for HW SPI are 4 10 52 77
|
||||
* Available chip select pins for HW SPI are 4 10 52 77 87
|
||||
*/
|
||||
#if SDSS == 4 || SDSS == 10 || SDSS == 52 || SDSS == 77 || SDSS == 87
|
||||
#if SDSS == 4
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#if ENABLED(FYSETC_MINI_12864)
|
||||
#if U8G_SPI_USE_MODE_3
|
||||
#define SPISEND_SW_DUE u8g_spiSend_sw_DUE_mode_3
|
||||
#else
|
||||
#define SPISEND_SW_DUE u8g_spiSend_sw_DUE_mode_0
|
||||
@@ -96,15 +96,15 @@ uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ENABLED(FYSETC_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_DUE(u8g, U8G_PI_SCK, 1); //set SCK to mode 3 idle state before CS goes active
|
||||
#if U8G_SPI_USE_MODE_3 // 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_DUE(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
else {
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, HIGH);
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 0); //set SCK to mode 0 idle state after CS goes inactive
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
}
|
||||
#else
|
||||
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, !arg_val);
|
||||
|
||||
@@ -11,7 +11,7 @@ if pioutil.is_pio_build():
|
||||
|
||||
if current_OS == 'Windows':
|
||||
|
||||
Import("env")
|
||||
env = pioutil.env
|
||||
|
||||
# Use bossac.exe on Windows
|
||||
env.Replace(
|
||||
|
||||
@@ -59,6 +59,7 @@ void setup_endstop_interrupts() {
|
||||
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
|
||||
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
|
||||
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
|
||||
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
|
||||
|
||||
@@ -101,12 +101,14 @@ void setup_endstop_interrupts() {
|
||||
|
||||
SETUP(Z_MIN_PROBE);
|
||||
|
||||
SETUP(CALIBRATION);
|
||||
|
||||
#undef SETUP
|
||||
}
|
||||
|
||||
// Ensure 1 - 10 IRQs are registered
|
||||
// Disable some endstops if you encounter this error
|
||||
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_X2_MAX, USE_X2_MIN, USE_Y_MAX, USE_Y_MIN, USE_Y2_MAX, USE_Y2_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z4_MAX, USE_Z4_MIN, USE_Z_MIN_PROBE)
|
||||
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_X2_MAX, USE_X2_MIN, USE_Y_MAX, USE_Y_MIN, USE_Y2_MAX, USE_Y2_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z4_MAX, USE_Z4_MIN, USE_Z_MIN_PROBE, USE_CALIBRATION)
|
||||
#if ENDSTOPS_INTERRUPTS_COUNT > 10
|
||||
#error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts."
|
||||
#elif ENDSTOPS_INTERRUPTS_COUNT == 0
|
||||
|
||||
@@ -82,7 +82,7 @@ static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, c
|
||||
}
|
||||
|
||||
static void u8g_sw_spi_shift_out(uint8_t val) {
|
||||
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
|
||||
#if U8G_SPI_USE_MODE_3
|
||||
swSpiTransfer_mode_3(val, SPI_speed);
|
||||
#else
|
||||
swSpiTransfer_mode_0(val, SPI_speed);
|
||||
@@ -116,15 +116,15 @@ uint8_t u8g_com_HAL_HC32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, voi
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864) // This 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
|
||||
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
|
||||
#if U8G_SPI_USE_MODE_3 // This 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
|
||||
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
|
||||
WRITE(DOGLCD_CS, LOW);
|
||||
}
|
||||
else {
|
||||
WRITE(DOGLCD_CS, HIGH);
|
||||
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
}
|
||||
#else
|
||||
WRITE(DOGLCD_CS, !arg_val);
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
// 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
|
||||
|
||||
@@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial;
|
||||
#else
|
||||
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available()
|
||||
#endif
|
||||
#endif
|
||||
@@ -159,7 +159,7 @@ constexpr pin_t GET_PIN_MAP_PIN(const int16_t index) {
|
||||
// Parse a G-code word into a pin index
|
||||
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
|
||||
// P0.6 thru P0.9 are for the onboard SD card
|
||||
#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09,
|
||||
#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09
|
||||
|
||||
// ------------------------
|
||||
// Defines
|
||||
|
||||
@@ -146,6 +146,12 @@ void setup_endstop_interrupts() {
|
||||
#endif
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
#if USE_CALIBRATION
|
||||
#if !LPC1768_PIN_INTERRUPT_M(CALIBRATION_PIN)
|
||||
#error "CALIBRATION_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(CALIBRATION_PIN);
|
||||
#endif
|
||||
#if USE_I_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(I_MAX_PIN)
|
||||
#error "I_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
|
||||
void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
|
||||
if (!LPC176x::pin_is_valid(pin)) return;
|
||||
if (LPC176x::pwm_attach_pin(pin))
|
||||
LPC176x::pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size); // map 1-254 onto PWM range
|
||||
if (LPC176x::pwm_attach_pin(pin)) {
|
||||
const uint32_t duty = map(invert ? v_size - v : v, 0, v_size, 0, LPC176x::pwm_get_period(pin));
|
||||
LPC176x::pwm_write(pin, duty);
|
||||
}
|
||||
}
|
||||
|
||||
void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
#define _WRITE(IO,V) WRITE_PIN(IO,V)
|
||||
|
||||
/// toggle a pin
|
||||
#define _TOGGLE(IO) _WRITE(IO, !READ(IO))
|
||||
#define _TOGGLE(IO) LPC176x::gpio_toggle(IO)
|
||||
|
||||
/// set pin as input
|
||||
#define _SET_INPUT(IO) SET_DIR_INPUT(IO)
|
||||
|
||||
@@ -28,12 +28,13 @@
|
||||
// spiBeginTransaction.
|
||||
#endif
|
||||
|
||||
/** onboard SD card */
|
||||
//#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 */
|
||||
// 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 P0_15
|
||||
#endif
|
||||
|
||||
@@ -132,7 +132,7 @@ uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck
|
||||
static uint8_t SPI_speed = 0;
|
||||
|
||||
static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
|
||||
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
|
||||
#if U8G_SPI_USE_MODE_3
|
||||
swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin);
|
||||
#else
|
||||
swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin);
|
||||
@@ -160,15 +160,15 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ANY(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
|
||||
#if U8G_SPI_USE_MODE_3 // 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
|
||||
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);
|
||||
|
||||
@@ -13,9 +13,9 @@ if pioutil.is_pio_build():
|
||||
target_drive = "REARM"
|
||||
|
||||
import platform
|
||||
|
||||
current_OS = platform.system()
|
||||
Import("env")
|
||||
|
||||
env = pioutil.env
|
||||
|
||||
def print_error(e):
|
||||
print('\nUnable to find destination disk (%s)\n' \
|
||||
|
||||
@@ -131,7 +131,7 @@ static uint8_t swSpiInit(const uint8_t spi_speed, const uint8_t clk_pin, const u
|
||||
}
|
||||
|
||||
static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
|
||||
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
|
||||
#if U8G_SPI_USE_MODE_3
|
||||
swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin);
|
||||
#else
|
||||
swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin);
|
||||
@@ -159,15 +159,15 @@ uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ANY(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
|
||||
#if U8G_SPI_USE_MODE_3 // 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
|
||||
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);
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
|
||||
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
|
||||
#define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN))
|
||||
#define MATCH_CALIBRATION_EILINE(P) TERN0(USE_CALIBRATION, DEFER4(MATCH_EILINE)(P, CALIBRATION_PIN))
|
||||
|
||||
#define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \
|
||||
&& !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \
|
||||
@@ -99,7 +100,8 @@
|
||||
&& !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \
|
||||
&& !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \
|
||||
&& !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \
|
||||
&& !MATCH_Z_MIN_PROBE_EILINE(P) )
|
||||
&& !MATCH_Z_MIN_PROBE_EILINE(P) \
|
||||
&& !MATCH_CALIBRATION_EILINE(P) )
|
||||
|
||||
// One ISR for all EXT-Interrupts
|
||||
void endstop_ISR() { endstops.update(); }
|
||||
@@ -208,6 +210,12 @@ void setup_endstop_interrupts() {
|
||||
#endif
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
#if USE_CALIBRATION
|
||||
#if !AVAILABLE_EILINE(CALIBRATION_PIN)
|
||||
#error "CALIBRATION_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(CALIBRATION_PIN);
|
||||
#endif
|
||||
#if USE_I_MAX
|
||||
#if !AVAILABLE_EILINE(I_MAX_PIN)
|
||||
#error "I_MAX_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
|
||||
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
|
||||
#define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN))
|
||||
#define MATCH_CALIBRATION_EILINE(P) TERN0(USE_CALIBRATION, DEFER4(MATCH_EILINE)(P, CALIBRATION_PIN))
|
||||
|
||||
#define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \
|
||||
&& !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \
|
||||
@@ -98,7 +99,8 @@
|
||||
&& !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \
|
||||
&& !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \
|
||||
&& !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \
|
||||
&& !MATCH_Z_MIN_PROBE_EILINE(P) )
|
||||
&& !MATCH_Z_MIN_PROBE_EILINE(P) \
|
||||
&& !MATCH_CALIBRATION_EILINE(P) )
|
||||
|
||||
// One ISR for all EXT-Interrupts
|
||||
void endstop_ISR() { endstops.update(); }
|
||||
@@ -183,6 +185,12 @@ void setup_endstop_interrupts() {
|
||||
#endif
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
#if USE_CALIBRATION
|
||||
#if !AVAILABLE_EILINE(CALIBRATION_PIN)
|
||||
#error "CALIBRATION_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
#endif
|
||||
_ATTACH(CALIBRATION_PIN);
|
||||
#endif
|
||||
#if USE_I_MAX
|
||||
#if !AVAILABLE_EILINE(I_MAX_PIN)
|
||||
#error "I_MAX_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
#else
|
||||
#error "LCD_SERIAL_PORT must be from 1 to 9, or -1 for Native USB."
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ static SPISettings spiConfig;
|
||||
// Public functions
|
||||
// ------------------------
|
||||
|
||||
#if ENABLED(SOFTWARE_SPI)
|
||||
#if ANY(SOFTWARE_SPI, FORCE_SOFT_SPI)
|
||||
|
||||
// ------------------------
|
||||
// Software SPI
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm / Ryan Power
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ALL(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
|
||||
|
||||
#include <U8glib-HAL.h>
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
#define nop asm volatile ("\tnop\n")
|
||||
|
||||
static inline uint8_t swSpiTransfer_mode_0(uint8_t b) {
|
||||
for (uint8_t i = 0; i < 8; ++i) {
|
||||
const uint8_t state = (b & 0x80) ? HIGH : LOW;
|
||||
WRITE(DOGLCD_SCK, HIGH);
|
||||
WRITE(DOGLCD_MOSI, state);
|
||||
b <<= 1;
|
||||
WRITE(DOGLCD_SCK, LOW);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline uint8_t swSpiTransfer_mode_3(uint8_t b) {
|
||||
for (uint8_t i = 0; i < 8; ++i) {
|
||||
const uint8_t state = (b & 0x80) ? HIGH : LOW;
|
||||
WRITE(DOGLCD_SCK, LOW);
|
||||
WRITE(DOGLCD_MOSI, state);
|
||||
b <<= 1;
|
||||
WRITE(DOGLCD_SCK, HIGH);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
static void u8g_sw_spi_shift_out(uint8_t val) {
|
||||
#if U8G_SPI_USE_MODE_3
|
||||
swSpiTransfer_mode_3(val);
|
||||
#else
|
||||
swSpiTransfer_mode_0(val);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void swSpiInit() {
|
||||
#if PIN_EXISTS(LCD_RESET)
|
||||
SET_OUTPUT(LCD_RESET_PIN);
|
||||
#endif
|
||||
SET_OUTPUT(DOGLCD_A0);
|
||||
OUT_WRITE(DOGLCD_SCK, LOW);
|
||||
OUT_WRITE(DOGLCD_MOSI, LOW);
|
||||
OUT_WRITE(DOGLCD_CS, HIGH);
|
||||
}
|
||||
|
||||
uint8_t u8g_com_HAL_STM32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
switch (msg) {
|
||||
case U8G_COM_MSG_INIT:
|
||||
swSpiInit();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
#if PIN_EXISTS(LCD_RESET)
|
||||
WRITE(LCD_RESET_PIN, arg_val);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if U8G_SPI_USE_MODE_3 // This 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
|
||||
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
|
||||
WRITE(DOGLCD_CS, LOW);
|
||||
nop; // hold SCK high for a few ns
|
||||
nop;
|
||||
}
|
||||
else {
|
||||
WRITE(DOGLCD_CS, HIGH);
|
||||
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
}
|
||||
#else
|
||||
WRITE(DOGLCD_CS, !arg_val);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_sw_spi_shift_out(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(*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_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
} break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
WRITE(DOGLCD_A0, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // HAS_MARLINUI_U8GLIB && FORCE_SOFT_SPI
|
||||
#endif // HAL_STM32
|
||||
@@ -45,6 +45,7 @@ void setup_endstop_interrupts() {
|
||||
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
|
||||
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
|
||||
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
|
||||
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
|
||||
|
||||
@@ -30,6 +30,3 @@
|
||||
#undef F_CPU
|
||||
#define F_CPU BOARD_F_CPU
|
||||
#endif
|
||||
|
||||
// The Sensitive Pins array is not optimizable
|
||||
#define RUNTIME_ONLY_ANALOG_TO_DIGITAL
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
* STM32 LCD-specific defines
|
||||
*/
|
||||
|
||||
uint8_t u8g_com_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
|
||||
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
|
||||
uint8_t u8g_com_HAL_STM32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // u8g_com_stm32duino_swspi.cpp
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32_sw_spi_fn
|
||||
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_std_sw_spi_fn
|
||||
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
#define LCD_SERIAL MSERIAL(1) // dummy port
|
||||
static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
|
||||
#dynamic build flags for generic compile options
|
||||
if __name__ == "__main__":
|
||||
args = " ".join([ "-std=gnu++14",
|
||||
"-Os",
|
||||
"-mcpu=cortex-m3",
|
||||
"-mthumb",
|
||||
|
||||
"-fsigned-char",
|
||||
"-fno-move-loop-invariants",
|
||||
"-fno-strict-aliasing",
|
||||
"-fsingle-precision-constant",
|
||||
|
||||
"--specs=nano.specs",
|
||||
"--specs=nosys.specs",
|
||||
|
||||
"-IMarlin/src/HAL/STM32F1",
|
||||
|
||||
"-MMD",
|
||||
"-MP",
|
||||
"-DTARGET_STM32F1"
|
||||
])
|
||||
|
||||
for i in range(1, len(sys.argv)):
|
||||
args += " " + sys.argv[i]
|
||||
|
||||
print(args)
|
||||
|
||||
# extra script for linker options
|
||||
else:
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
from SCons.Script import DefaultEnvironment
|
||||
env = DefaultEnvironment()
|
||||
env.Append(
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=["-x", "assembler-with-cpp"],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-fabi-version=0",
|
||||
"-fno-use-cxa-atexit",
|
||||
"-fno-threadsafe-statics"
|
||||
],
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-mcpu=cortex-m3",
|
||||
"-ffreestanding",
|
||||
"-mthumb",
|
||||
"--specs=nano.specs",
|
||||
"--specs=nosys.specs",
|
||||
"-u_printf_float",
|
||||
],
|
||||
)
|
||||
@@ -89,7 +89,7 @@ static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, c
|
||||
}
|
||||
|
||||
static void u8g_sw_spi_shift_out(uint8_t val) {
|
||||
#if ENABLED(FYSETC_MINI_12864)
|
||||
#if U8G_SPI_USE_MODE_3
|
||||
swSpiTransfer_mode_3(val, SPI_speed);
|
||||
#else
|
||||
swSpiTransfer_mode_0(val, SPI_speed);
|
||||
@@ -123,15 +123,15 @@ uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ENABLED(FYSETC_MINI_12864) // This 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
|
||||
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
|
||||
#if U8G_SPI_USE_MODE_3 // This 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
|
||||
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
|
||||
WRITE(DOGLCD_CS, LOW);
|
||||
}
|
||||
else {
|
||||
WRITE(DOGLCD_CS, HIGH);
|
||||
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
}
|
||||
#else
|
||||
WRITE(DOGLCD_CS, !arg_val);
|
||||
|
||||
@@ -70,6 +70,7 @@ void setup_endstop_interrupts() {
|
||||
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
|
||||
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
|
||||
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
|
||||
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* STM32F1 (Maple) LCD-specific defines
|
||||
*/
|
||||
|
||||
uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // u8g_com_stm32duino_swspi.cpp
|
||||
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
|
||||
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32F1_sw_spi_fn
|
||||
|
||||
@@ -64,6 +64,7 @@ void setup_endstop_interrupts() {
|
||||
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
|
||||
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
|
||||
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
|
||||
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
|
||||
|
||||
@@ -63,6 +63,7 @@ void setup_endstop_interrupts() {
|
||||
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
|
||||
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
|
||||
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
|
||||
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
|
||||
|
||||
@@ -63,6 +63,7 @@ void setup_endstop_interrupts() {
|
||||
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
|
||||
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
|
||||
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
|
||||
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
|
||||
|
||||
@@ -36,13 +36,13 @@
|
||||
typedef uint32_t hal_timer_t;
|
||||
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFE
|
||||
|
||||
#define GPT_TIMER_RATE F_BUS_ACTUAL // 150MHz
|
||||
#define GPT_TIMER_RATE (F_CPU / 4) // 150MHz (Can't use F_BUS_ACTUAL because it's extern volatile)
|
||||
|
||||
#define GPT1_TIMER_PRESCALE 2
|
||||
#define GPT2_TIMER_PRESCALE 10
|
||||
|
||||
#define GPT1_TIMER_RATE (GPT_TIMER_RATE / GPT1_TIMER_PRESCALE) // 75MHz
|
||||
#define GPT2_TIMER_RATE (GPT_TIMER_RATE / GPT2_TIMER_PRESCALE) // 15MHz
|
||||
#define GPT1_TIMER_RATE (GPT_TIMER_RATE / GPT1_TIMER_PRESCALE) // 150MHz / 2 = 75MHz
|
||||
#define GPT2_TIMER_RATE (GPT_TIMER_RATE / GPT2_TIMER_PRESCALE) // 150MHz / 10 = 15MHz
|
||||
|
||||
#ifndef MF_TIMER_STEP
|
||||
#define MF_TIMER_STEP 0 // Timer Index for Stepper
|
||||
@@ -57,7 +57,8 @@ typedef uint32_t hal_timer_t;
|
||||
#define TEMP_TIMER_RATE 1000000
|
||||
#define TEMP_TIMER_FREQUENCY 1000
|
||||
|
||||
#define STEPPER_TIMER_RATE GPT1_TIMER_RATE
|
||||
#define HAL_TIMER_RATE GPT1_TIMER_RATE
|
||||
#define STEPPER_TIMER_RATE HAL_TIMER_RATE
|
||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000)
|
||||
#define STEPPER_TIMER_PRESCALE ((GPT_TIMER_RATE / 1000000) / STEPPER_TIMER_TICKS_PER_US)
|
||||
|
||||
|
||||
+20
-26
@@ -263,7 +263,7 @@
|
||||
|
||||
PGMSTR(M112_KILL_STR, "M112 Shutdown");
|
||||
|
||||
MarlinState marlin_state = MF_INITIALIZING;
|
||||
MarlinState marlin_state = MarlinState::MF_INITIALIZING;
|
||||
|
||||
// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
|
||||
bool wait_for_heatup = false;
|
||||
@@ -308,23 +308,12 @@ bool wait_for_heatup = false;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnarrowing"
|
||||
|
||||
#ifndef RUNTIME_ONLY_ANALOG_TO_DIGITAL
|
||||
template <pin_t ...D>
|
||||
constexpr pin_t OnlyPins<_SP_END, D...>::table[sizeof...(D)];
|
||||
#endif
|
||||
|
||||
bool pin_is_protected(const pin_t pin) {
|
||||
#ifdef RUNTIME_ONLY_ANALOG_TO_DIGITAL
|
||||
static const pin_t sensitive_pins[] PROGMEM = { SENSITIVE_PINS };
|
||||
const size_t pincount = COUNT(sensitive_pins);
|
||||
#else
|
||||
static constexpr size_t pincount = OnlyPins<SENSITIVE_PINS>::size;
|
||||
static const pin_t (&sensitive_pins)[pincount] PROGMEM = OnlyPins<SENSITIVE_PINS>::table;
|
||||
#endif
|
||||
for (uint8_t i = 0; i < pincount; ++i) {
|
||||
const pin_t * const pptr = &sensitive_pins[i];
|
||||
if (pin == (sizeof(pin_t) == 2 ? (pin_t)pgm_read_word(pptr) : (pin_t)pgm_read_byte(pptr))) return true;
|
||||
}
|
||||
#define pgm_read_pin(P) (sizeof(pin_t) == 2 ? (pin_t)pgm_read_word(P) : (pin_t)pgm_read_byte(P))
|
||||
for (uint8_t i = 0; i < COUNT(sensitive_dio); ++i)
|
||||
if (pin == pgm_read_pin(&sensitive_dio[i])) return true;
|
||||
for (uint8_t i = 0; i < COUNT(sensitive_aio); ++i)
|
||||
if (pin == analogInputToDigitalPin(pgm_read_pin(&sensitive_dio[i]))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -388,8 +377,8 @@ void startOrResumeJob() {
|
||||
}
|
||||
|
||||
inline void finishSDPrinting() {
|
||||
if (queue.enqueue_one(F("M1001"))) { // Keep trying until it gets queued
|
||||
marlin_state = MF_RUNNING; // Signal to stop trying
|
||||
if (queue.enqueue_one(F("M1001"))) { // Keep trying until it gets queued
|
||||
marlin_state = MarlinState::MF_RUNNING; // Signal to stop trying
|
||||
TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
|
||||
TERN_(DGUS_LCD_UI_MKS, screen.sdPrintingFinished());
|
||||
}
|
||||
@@ -784,7 +773,7 @@ void idle(const bool no_stepper_sleep/*=false*/) {
|
||||
TERN_(MAX7219_DEBUG, max7219.idle_tasks());
|
||||
|
||||
// Return if setup() isn't completed
|
||||
if (marlin_state == MF_INITIALIZING) goto IDLE_DONE;
|
||||
if (marlin_state == MarlinState::MF_INITIALIZING) goto IDLE_DONE;
|
||||
|
||||
// TODO: Still causing errors
|
||||
TERN_(TOOL_SENSOR, (void)check_tool_sensor_stats(active_extruder, true));
|
||||
@@ -970,7 +959,7 @@ void stop() {
|
||||
SERIAL_ERROR_MSG(STR_ERR_STOPPED);
|
||||
LCD_MESSAGE(MSG_STOPPED);
|
||||
safe_delay(350); // allow enough time for messages to get out before stopping
|
||||
marlin_state = MF_STOPPED;
|
||||
marlin_state = MarlinState::MF_STOPPED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1330,18 +1319,23 @@ void setup() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ALL(HAS_MEDIA, SDCARD_EEPROM_EMULATION)
|
||||
#if HAS_MEDIA && ANY(SDCARD_EEPROM_EMULATION, POWER_LOSS_RECOVERY)
|
||||
SETUP_RUN(card.mount()); // Mount media with settings before first_load
|
||||
#endif
|
||||
|
||||
SETUP_RUN(settings.first_load()); // Load data from EEPROM if available (or use defaults)
|
||||
// This also updates variables in the planner, elsewhere
|
||||
// Prepare some LCDs to display early
|
||||
#if HAS_EARLY_LCD_SETTINGS
|
||||
SETUP_RUN(settings.load_lcd_state());
|
||||
#endif
|
||||
|
||||
#if ALL(HAS_WIRED_LCD, SHOW_BOOTSCREEN)
|
||||
SETUP_RUN(ui.show_bootscreen());
|
||||
const millis_t bootscreen_ms = millis();
|
||||
#endif
|
||||
|
||||
SETUP_RUN(settings.first_load()); // Load data from EEPROM if available (or use defaults)
|
||||
// This also updates variables in the planner, elsewhere
|
||||
|
||||
#if ENABLED(PROBE_TARE)
|
||||
SETUP_RUN(probe.tare_init());
|
||||
#endif
|
||||
@@ -1652,7 +1646,7 @@ void setup() {
|
||||
SETUP_RUN(ftMotion.init());
|
||||
#endif
|
||||
|
||||
marlin_state = MF_RUNNING;
|
||||
marlin_state = MarlinState::MF_RUNNING;
|
||||
|
||||
#ifdef STARTUP_TUNE
|
||||
// Play a short startup tune before continuing.
|
||||
@@ -1684,7 +1678,7 @@ void loop() {
|
||||
|
||||
#if HAS_MEDIA
|
||||
if (card.flag.abort_sd_printing) abortSDPrinting();
|
||||
if (marlin_state == MF_SD_COMPLETE) finishSDPrinting();
|
||||
if (marlin_state == MarlinState::MF_SD_COMPLETE) finishSDPrinting();
|
||||
#endif
|
||||
|
||||
queue.advance();
|
||||
|
||||
@@ -42,7 +42,7 @@ void kill(FSTR_P const lcd_error=nullptr, FSTR_P const lcd_component=nullptr, co
|
||||
void minkill(const bool steppers_off=false);
|
||||
|
||||
// Global State of the firmware
|
||||
enum MarlinState : uint8_t {
|
||||
enum class MarlinState : uint8_t {
|
||||
MF_INITIALIZING = 0,
|
||||
MF_STOPPED,
|
||||
MF_KILLED,
|
||||
@@ -53,8 +53,8 @@ enum MarlinState : uint8_t {
|
||||
};
|
||||
|
||||
extern MarlinState marlin_state;
|
||||
inline bool IsRunning() { return marlin_state >= MF_RUNNING; }
|
||||
inline bool IsStopped() { return marlin_state == MF_STOPPED; }
|
||||
inline bool IsRunning() { return marlin_state >= MarlinState::MF_RUNNING; }
|
||||
inline bool IsStopped() { return marlin_state == MarlinState::MF_STOPPED; }
|
||||
|
||||
bool printingIsActive();
|
||||
bool printJobOngoing();
|
||||
|
||||
@@ -103,7 +103,8 @@
|
||||
|
||||
#define HAS_TRINAMIC HAS_TRINAMIC_CONFIG
|
||||
|
||||
#if ( HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2160_STANDALONE) \
|
||||
#if ( HAS_DRIVER(TMC2100) \
|
||||
|| HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2160_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC2209_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC2660_STANDALONE) || HAS_DRIVER(TMC5130_STANDALONE) \
|
||||
|| HAS_DRIVER(TMC5160_STANDALONE) )
|
||||
|
||||
@@ -355,6 +355,8 @@
|
||||
#define STR_PROBE_EN "probe_en"
|
||||
#define STR_FILAMENT "filament"
|
||||
|
||||
#define STR_CALIBRATION "calibration"
|
||||
|
||||
// General axis names
|
||||
#define STR_X "X"
|
||||
#define STR_Y "Y"
|
||||
|
||||
@@ -55,9 +55,6 @@
|
||||
#define CYCLES_PER_MICROSECOND (F_CPU / 1000000UL) // 16 or 20 on AVR
|
||||
#endif
|
||||
|
||||
// Nanoseconds per cycle
|
||||
#define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)
|
||||
|
||||
// Macros to make a string from a macro
|
||||
#define STRINGIFY_(M) #M
|
||||
#define STRINGIFY(M) STRINGIFY_(M)
|
||||
@@ -197,8 +194,8 @@
|
||||
#define ENABLED(V...) DO(ENA,&&,V)
|
||||
#define DISABLED(V...) DO(DIS,&&,V)
|
||||
#define ANY(V...) !DISABLED(V)
|
||||
#define ALL ENABLED
|
||||
#define NONE DISABLED
|
||||
#define ALL(V...) ENABLED(V)
|
||||
#define NONE(V...) DISABLED(V)
|
||||
#define COUNT_ENABLED(V...) DO(ENA,+,V)
|
||||
#define MANY(V...) (COUNT_ENABLED(V) > 1)
|
||||
|
||||
@@ -630,7 +627,7 @@
|
||||
#define DEFER4(M) M EMPTY EMPTY EMPTY EMPTY()()()()
|
||||
|
||||
// Force define expansion
|
||||
#define EVAL EVAL16
|
||||
#define EVAL(V...) EVAL16(V)
|
||||
#define EVAL4096(V...) EVAL2048(EVAL2048(V))
|
||||
#define EVAL2048(V...) EVAL1024(EVAL1024(V))
|
||||
#define EVAL1024(V...) EVAL512(EVAL512(V))
|
||||
|
||||
@@ -171,13 +171,14 @@ int32_t Backlash::get_applied_steps(const AxisEnum axis) {
|
||||
|
||||
const int32_t residual_error_axis = residual_error[axis];
|
||||
|
||||
// At startup it is assumed the last move was forward.
|
||||
// So the applied steps will always be negative.
|
||||
// At startup, when no steps are applied, it is assumed the last move was backwards.
|
||||
// So the applied steps will always be zero (when moving backwards) or a positive
|
||||
// number (when moving forwards).
|
||||
|
||||
if (forward) return -residual_error_axis;
|
||||
if (!forward) return -residual_error_axis;
|
||||
|
||||
const float f_corr = float(correction) / all_on;
|
||||
const int32_t full_error_axis = -f_corr * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
|
||||
const int32_t full_error_axis = f_corr * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
|
||||
return full_error_axis - residual_error_axis;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ void LEDLights::set_color(const LEDColor &incol
|
||||
void LEDLights::toggle() { if (lights_on) set_off(); else update(); }
|
||||
#endif
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
#if HAS_LED_POWEROFF_TIMEOUT
|
||||
|
||||
millis_t LEDLights::led_off_time; // = 0
|
||||
|
||||
|
||||
@@ -164,11 +164,11 @@ public:
|
||||
#if ENABLED(LED_CONTROL_MENU)
|
||||
static void toggle(); // swap "off" with color
|
||||
#endif
|
||||
#if ANY(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED) || LED_POWEROFF_TIMEOUT > 0
|
||||
#if ANY(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED, HAS_LED_POWEROFF_TIMEOUT)
|
||||
static void update() { set_color(color); }
|
||||
#endif
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
#if HAS_LED_POWEROFF_TIMEOUT
|
||||
private:
|
||||
static millis_t led_off_time;
|
||||
public:
|
||||
|
||||
@@ -205,6 +205,9 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
||||
// info.sdpos and info.current_position are pre-filled from the Stepper ISR
|
||||
|
||||
info.feedrate = uint16_t(MMS_TO_MMM(feedrate_mm_s));
|
||||
info.feedrate_percentage = feedrate_percentage;
|
||||
COPY(info.flow_percentage, planner.flow_percentage);
|
||||
|
||||
info.zraise = zraise;
|
||||
info.flag.raised = raised; // Was Z raised before power-off?
|
||||
|
||||
@@ -216,7 +219,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
info.flag.volumetric_enabled = parser.volumetric_enabled;
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
EXTRUDER_LOOP() info.filament_size[e] = planner.filament_size[e];
|
||||
COPY(info.filament_size, planner.filament_size);
|
||||
#else
|
||||
if (parser.volumetric_enabled) info.filament_size[0] = planner.filament_size[active_extruder];
|
||||
#endif
|
||||
@@ -269,7 +272,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
||||
|
||||
#if POWER_LOSS_RETRACT_LEN
|
||||
// Retract filament now
|
||||
gcode.process_subcommands_now(F("G1 F3000 E-" STRINGIFY(POWER_LOSS_RETRACT_LEN)));
|
||||
const uint16_t old_flow = planner.flow_percentage[active_extruder];
|
||||
planner.set_flow(active_extruder, 100);
|
||||
gcode.process_subcommands_now(F("G1F3000E-" STRINGIFY(POWER_LOSS_RETRACT_LEN)));
|
||||
planner.set_flow(active_extruder, old_flow);
|
||||
#endif
|
||||
|
||||
#if POWER_LOSS_ZRAISE
|
||||
@@ -555,8 +561,12 @@ void PrintJobRecovery::resume() {
|
||||
// Move back down to the saved Z for printing
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F600Z"), p_float_t(z_print, 3)));
|
||||
|
||||
// Restore the feedrate
|
||||
// Restore the feedrate and percentage
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F"), info.feedrate));
|
||||
feedrate_percentage = info.feedrate_percentage;
|
||||
|
||||
// Flowrate percentage
|
||||
EXTRUDER_LOOP() planner.set_flow(e, info.flow_percentage[e]);
|
||||
|
||||
// Restore E position with G92.9
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9E"), p_float_t(resume_pos.e, 3)));
|
||||
@@ -589,7 +599,8 @@ void PrintJobRecovery::resume() {
|
||||
}
|
||||
DEBUG_EOL();
|
||||
|
||||
DEBUG_ECHOLNPGM("feedrate: ", info.feedrate);
|
||||
DEBUG_ECHOLN(F("feedrate: "), info.feedrate, F(" x "), info.feedrate_percentage, '%');
|
||||
EXTRUDER_LOOP() DEBUG_ECHOLN('E', e + 1, F(" flow %: "), info.flow_percentage[e]);
|
||||
|
||||
DEBUG_ECHOLNPGM("zraise: ", info.zraise, " ", info.flag.raised ? "(before)" : "");
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ typedef struct {
|
||||
// Machine state
|
||||
xyze_pos_t current_position;
|
||||
uint16_t feedrate;
|
||||
int16_t feedrate_percentage;
|
||||
uint16_t flow_percentage[EXTRUDERS];
|
||||
|
||||
float zraise;
|
||||
|
||||
|
||||
@@ -181,20 +181,6 @@ inline void park_above_object(measurements_t &m, const float uncertainty) {
|
||||
|
||||
#endif
|
||||
|
||||
#if !PIN_EXISTS(CALIBRATION)
|
||||
#include "../../module/probe.h"
|
||||
#endif
|
||||
|
||||
inline bool read_calibration_pin() {
|
||||
return (
|
||||
#if PIN_EXISTS(CALIBRATION)
|
||||
READ(CALIBRATION_PIN) != CALIBRATION_PIN_INVERTING
|
||||
#else
|
||||
PROBE_TRIGGERED()
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move along axis in the specified dir until the probe value becomes stop_state,
|
||||
* then return the axis value.
|
||||
@@ -205,18 +191,18 @@ inline bool read_calibration_pin() {
|
||||
* fast in - Fast vs. precise measurement
|
||||
*/
|
||||
float measuring_movement(const AxisEnum axis, const int dir, const bool stop_state, const bool fast) {
|
||||
const float step = fast ? 0.25 : CALIBRATION_MEASUREMENT_RESOLUTION;
|
||||
const feedRate_t mms = fast ? MMM_TO_MMS(CALIBRATION_FEEDRATE_FAST) : MMM_TO_MMS(CALIBRATION_FEEDRATE_SLOW);
|
||||
const float limit = fast ? 50 : 5;
|
||||
|
||||
destination = current_position;
|
||||
for (float travel = 0; travel < limit; travel += step) {
|
||||
destination[axis] += dir * step;
|
||||
do_blocking_move_to((xyz_pos_t)destination, mms);
|
||||
planner.synchronize();
|
||||
if (read_calibration_pin() == stop_state) break;
|
||||
}
|
||||
return destination[axis];
|
||||
destination[axis] += dir * limit;
|
||||
endstops.enable_calibration_probe(true, stop_state);
|
||||
do_blocking_move_to((xyz_pos_t)destination, mms);
|
||||
endstops.enable_calibration_probe(false);
|
||||
endstops.hit_on_purpose();
|
||||
set_current_from_steppers_for_axis(axis);
|
||||
sync_plan_position();
|
||||
return current_position[axis];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,9 +112,9 @@ void GcodeSuite::M81() {
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAS_SUICIDE
|
||||
suicide();
|
||||
#elif ENABLED(PSU_CONTROL)
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
powerManager.power_off_soon();
|
||||
#elif HAS_SUICIDE
|
||||
suicide();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* existing command buffer.
|
||||
*/
|
||||
void GcodeSuite::M999() {
|
||||
marlin_state = MF_RUNNING;
|
||||
marlin_state = MarlinState::MF_RUNNING;
|
||||
ui.reset_alert_level();
|
||||
|
||||
if (parser.boolval('S')) return;
|
||||
|
||||
@@ -35,12 +35,12 @@ void GcodeSuite::M592_report(const bool forReplay/*=true*/) {
|
||||
|
||||
/**
|
||||
* M592: Get or set nonlinear extrusion parameters
|
||||
* A<factor> Linear coefficient (default 0.0)
|
||||
* B<factor> Quadratic coefficient (default 0.0)
|
||||
* A<factor> Quadratic coefficient (default 0.0)
|
||||
* B<factor> Linear coefficient (default 0.0)
|
||||
* C<factor> Constant coefficient (default 1.0)
|
||||
*
|
||||
* Adjusts the amount of extrusion based on the instantaneous velocity of extrusion, as a multiplier.
|
||||
* The amount of extrusion is multiplied by max(C, C + A*v + B*v^2) where v is extruder velocity in mm/s.
|
||||
* The amount of extrusion is multiplied by max(C, A*v^2 + B*v + C) where v is extruder velocity in mm/s.
|
||||
* Only adjusts forward extrusions, since those are the ones affected by backpressure.
|
||||
*/
|
||||
void GcodeSuite::M592() {
|
||||
|
||||
@@ -1105,6 +1105,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 1002: M1002(); break; // M1002: [INTERNAL] Tool-change and Relative E Move
|
||||
#endif
|
||||
|
||||
#if ENABLED(ONE_CLICK_PRINT)
|
||||
case 1003: M1003(); break; // M1003: [INTERNAL] Set the current dir to /
|
||||
#endif
|
||||
|
||||
#if ENABLED(UBL_MESH_WIZARD)
|
||||
case 1004: M1004(); break; // M1004: UBL Mesh Wizard
|
||||
#endif
|
||||
|
||||
@@ -1276,6 +1276,10 @@ private:
|
||||
static void M1002();
|
||||
#endif
|
||||
|
||||
#if ENABLED(ONE_CLICK_PRINT)
|
||||
static void M1003();
|
||||
#endif
|
||||
|
||||
#if ENABLED(UBL_MESH_WIZARD)
|
||||
static void M1004();
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "../../feature/probe_temp_comp.h"
|
||||
#endif
|
||||
|
||||
#if ANY(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
|
||||
#if ANY(DWIN_CREALITY_LCD_JYERSUI, EXTENSIBLE_UI)
|
||||
#define VERBOSE_SINGLE_PROBE
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2024 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 ENABLED(ONE_CLICK_PRINT)
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../sd/cardreader.h"
|
||||
|
||||
/**
|
||||
* M1003: Set the current dir to /. Should come after 'M24'.
|
||||
* Prevents the SD menu getting stuck in the newest file's workDir.
|
||||
*/
|
||||
void GcodeSuite::M1003() { card.cdroot(); }
|
||||
|
||||
#endif // ONE_CLICK_PRINT
|
||||
@@ -497,6 +497,8 @@
|
||||
#error "DIGIPOT_I2C is now DIGIPOT_MCP4451 (or DIGIPOT_MCP4018)."
|
||||
#elif defined(TOUCH_BUTTONS)
|
||||
#error "TOUCH_BUTTONS is now TOUCH_SCREEN."
|
||||
#elif defined(DISABLE_ENCODER)
|
||||
#error "DISABLE_ENCODER is now NO_BACK_MENU_ITEM."
|
||||
#elif defined(LCD_FULL_PIXEL_HEIGHT) || defined(LCD_FULL_PIXEL_WIDTH)
|
||||
#error "LCD_FULL_PIXEL_(WIDTH|HEIGHT) is deprecated and should be removed."
|
||||
#elif defined(FSMC_UPSCALE)
|
||||
@@ -641,6 +643,8 @@
|
||||
#error "PROBE_PT_[123]_[XY] is now defined using PROBE_PT_[123] with an array { x, y }."
|
||||
#elif defined(SQUARE_WAVE_STEPPING)
|
||||
#error "SQUARE_WAVE_STEPPING is now EDGE_STEPPING."
|
||||
#elif defined(MINIMUM_STEPPER_PULSE)
|
||||
#error "MINIMUM_STEPPER_PULSE (in µs) is now MINIMUM_STEPPER_PULSE_NS. Multiply old MINIMUM_STEPPER_PULSE x 1000!"
|
||||
#elif defined(FAN_PIN)
|
||||
#error "FAN_PIN is now FAN0_PIN."
|
||||
#elif defined(X_MIN_ENDSTOP_INVERTING) || defined(Y_MIN_ENDSTOP_INVERTING) || defined(Z_MIN_ENDSTOP_INVERTING) \
|
||||
@@ -693,6 +697,8 @@
|
||||
#error "Z_PROBE_END_SCRIPT is now EVENT_GCODE_AFTER_G29."
|
||||
#elif defined(WIFI_SERIAL)
|
||||
#error "WIFI_SERIAL is now WIFI_SERIAL_PORT."
|
||||
#elif defined(CALIBRATION_MEASUREMENT_RESOLUTION)
|
||||
#error "CALIBRATION_MEASUREMENT_RESOLUTION is no longer needed and should be removed."
|
||||
#endif
|
||||
|
||||
// Changes to Probe Temp Compensation (#17392)
|
||||
|
||||
@@ -654,11 +654,11 @@
|
||||
|
||||
#elif ENABLED(ZONESTAR_12864OLED)
|
||||
#define IS_RRD_SC 1
|
||||
#define U8GLIB_SH1106
|
||||
#define U8GLIB_SH1106_SPI
|
||||
|
||||
#elif ENABLED(ZONESTAR_12864OLED_SSD1306)
|
||||
#define IS_RRD_SC 1
|
||||
#define IS_U8GLIB_SSD1306
|
||||
#define U8GLIB_SSD1306_SPI
|
||||
|
||||
#elif ENABLED(RADDS_DISPLAY)
|
||||
#define IS_ULTIPANEL 1
|
||||
@@ -716,7 +716,7 @@
|
||||
|
||||
#elif ENABLED(SAV_3DGLCD)
|
||||
|
||||
#ifdef U8GLIB_SSD1306
|
||||
#if ENABLED(U8GLIB_SSD1306)
|
||||
#define IS_U8GLIB_SSD1306 // Allow for U8GLIB_SSD1306 + SAV_3DGLCD
|
||||
#endif
|
||||
#define IS_NEWPANEL 1
|
||||
@@ -815,6 +815,10 @@
|
||||
|
||||
#endif
|
||||
|
||||
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
|
||||
#define U8G_SPI_USE_MODE_3 1
|
||||
#endif
|
||||
|
||||
// ST7920-based graphical displays
|
||||
#if ANY(IS_RRD_FG_SC, LCD_FOR_MELZI, SILVER_GATE_GLCD_CONTROLLER)
|
||||
#define DOGLCD
|
||||
@@ -853,9 +857,12 @@
|
||||
#define STD_ENCODER_STEPS_PER_MENU_ITEM 1
|
||||
#endif
|
||||
|
||||
// 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106
|
||||
// 128x64 I2C OLED LCDs (SSD1306 / SSD1309 / SH1106)
|
||||
// ...and 128x64 SPI OLED LCDs (SSD1306 / SH1106)
|
||||
#if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106)
|
||||
#define HAS_U8GLIB_I2C_OLED 1
|
||||
#endif
|
||||
#if ANY(HAS_U8GLIB_I2C_OLED, U8GLIB_SSD1306_SPI, U8GLIB_SH1106_SPI)
|
||||
#define HAS_WIRED_LCD 1
|
||||
#define DOGLCD
|
||||
#endif
|
||||
@@ -1095,6 +1102,9 @@
|
||||
* - poweroff (for PSU_CONTROL and HAS_MARLINUI_MENU)
|
||||
*
|
||||
* ...and implements these MarlinUI methods:
|
||||
* - init_lcd
|
||||
* - clear_lcd
|
||||
* - clear_for_drawing
|
||||
* - zoffset_overlay (if BABYSTEP_GFX_OVERLAY or MESH_EDIT_GFX_OVERLAY are supported)
|
||||
* - draw_kill_screen
|
||||
* - kill_screen
|
||||
@@ -1888,6 +1898,10 @@
|
||||
#define NEOPIXEL_BKGD_INDEX_LAST NEOPIXEL_BKGD_INDEX_FIRST
|
||||
#endif
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
#define HAS_LED_POWEROFF_TIMEOUT 1
|
||||
#endif
|
||||
|
||||
#if ALL(SPI_FLASH, HAS_MEDIA, MARLIN_DEV_MODE)
|
||||
#define SPI_FLASH_BACKUP 1
|
||||
#endif
|
||||
|
||||
@@ -1198,21 +1198,21 @@
|
||||
#define MINIMUM_STEPPER_PRE_DIR_DELAY MINIMUM_STEPPER_POST_DIR_DELAY
|
||||
#endif
|
||||
|
||||
#ifndef MINIMUM_STEPPER_PULSE
|
||||
#ifndef MINIMUM_STEPPER_PULSE_NS
|
||||
#if HAS_DRIVER(TB6560)
|
||||
#define MINIMUM_STEPPER_PULSE 30
|
||||
#define MINIMUM_STEPPER_PULSE_NS 30000
|
||||
#elif HAS_DRIVER(TB6600)
|
||||
#define MINIMUM_STEPPER_PULSE 3
|
||||
#define MINIMUM_STEPPER_PULSE_NS 3000
|
||||
#elif HAS_DRIVER(DRV8825)
|
||||
#define MINIMUM_STEPPER_PULSE 2
|
||||
#define MINIMUM_STEPPER_PULSE_NS 2000
|
||||
#elif HAS_DRIVER(A4988) || HAS_DRIVER(A5984)
|
||||
#define MINIMUM_STEPPER_PULSE 1
|
||||
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
|
||||
#define MINIMUM_STEPPER_PULSE 0
|
||||
#define MINIMUM_STEPPER_PULSE_NS 1000
|
||||
#elif HAS_DRIVER(LV8729)
|
||||
#define MINIMUM_STEPPER_PULSE 0
|
||||
#define MINIMUM_STEPPER_PULSE_NS 500
|
||||
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
|
||||
#define MINIMUM_STEPPER_PULSE_NS 100
|
||||
#else
|
||||
#define MINIMUM_STEPPER_PULSE 2
|
||||
// Expecting MAXIMUM_STEPPER_RATE to be defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1230,7 +1230,7 @@
|
||||
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
|
||||
#define MAXIMUM_STEPPER_RATE 5000000
|
||||
#else
|
||||
#define MAXIMUM_STEPPER_RATE 250000
|
||||
// Expecting MINIMUM_STEPPER_PULSE_NS to be defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -557,7 +557,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_SD_DETECT && NONE(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT, IS_DWIN_MARLINUI, EXTENSIBLE_UI, HAS_DWIN_E3V2)
|
||||
#if HAS_SD_DETECT && NONE(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT, IS_DWIN_MARLINUI, EXTENSIBLE_UI, HAS_DWIN_E3V2, HAS_U8GLIB_I2C_OLED)
|
||||
#define REINIT_NOISY_LCD 1 // Have the LCD re-init on SD insertion
|
||||
#endif
|
||||
|
||||
@@ -2200,6 +2200,11 @@
|
||||
#define HAS_Z_PROBE_STATE 1
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(CALIBRATION)
|
||||
#define USE_CALIBRATION 1
|
||||
#define HAS_CALIBRATION_STATE 1
|
||||
#endif
|
||||
|
||||
#undef _ANY_STOP
|
||||
#undef _USE_STOP
|
||||
#undef _HAS_STATE
|
||||
@@ -2752,7 +2757,7 @@
|
||||
|
||||
// Fan Kickstart
|
||||
#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER)
|
||||
#define FAN_KICKSTART_POWER 180
|
||||
#define FAN_KICKSTART_POWER TERN(FAN_KICKSTART_LINEAR, 255, 180)
|
||||
#endif
|
||||
|
||||
// Servos
|
||||
@@ -3379,6 +3384,10 @@
|
||||
#define LCD_HEIGHT TERN(IS_ULTIPANEL, 4, 2)
|
||||
#endif
|
||||
#endif
|
||||
// Prepare the LCD to show the bootscreen early in setup
|
||||
#if ENABLED(SHOW_BOOTSCREEN) && ANY(HAS_LCD_CONTRAST, HAS_LCD_BRIGHTNESS)
|
||||
#define HAS_EARLY_LCD_SETTINGS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BUTTONS_EXIST(EN1, EN2, ENC)
|
||||
|
||||
@@ -837,9 +837,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
||||
* Nonlinear Extrusion requirements
|
||||
*/
|
||||
#if ENABLED(NONLINEAR_EXTRUSION)
|
||||
#if DISABLED(ADAPTIVE_STEP_SMOOTHING)
|
||||
#error "ADAPTIVE_STEP_SMOOTHING is required for NONLINEAR_EXTRUSION."
|
||||
#elif HAS_MULTI_EXTRUDER
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
#error "NONLINEAR_EXTRUSION doesn't currently support multi-extruder setups."
|
||||
#elif DISABLED(CPU_32_BIT)
|
||||
#error "NONLINEAR_EXTRUSION requires a 32-bit CPU."
|
||||
@@ -1011,8 +1009,12 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
||||
#endif
|
||||
|
||||
// Fan Kickstart power
|
||||
#if FAN_KICKSTART_TIME && !WITHIN(FAN_KICKSTART_POWER, 64, 255)
|
||||
#error "FAN_KICKSTART_POWER must be an integer from 64 to 255."
|
||||
#if FAN_KICKSTART_TIME
|
||||
#if ENABLED(FAN_KICKSTART_LINEAR) && FAN_KICKSTART_POWER != 255
|
||||
#error "FAN_KICKSTART_LINEAR requires a FAN_KICKSTART_POWER of 255."
|
||||
#elif !WITHIN(FAN_KICKSTART_POWER, 64, 255)
|
||||
#error "FAN_KICKSTART_POWER must be an integer from 64 to 255."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -2466,6 +2468,51 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
||||
#elif Z_SPI_SENSORLESS && !(AXIS_HAS_SPI(Z2) && (NUM_Z_STEPPERS < 3 || AXIS_HAS_SPI(Z3)) && (NUM_Z_STEPPERS < 4 || AXIS_HAS_SPI(Z4)))
|
||||
#error "All Z Stepper Drivers must be SPI-capable to use SPI Endstops on Z."
|
||||
#endif
|
||||
#if PIN_EXISTS(Z2_STOP)
|
||||
#if X_HOME_TO_MIN && Z2_STOP_PIN == X_MIN_PIN
|
||||
#error "Z2_STOP_PIN can't be the same as X_MIN_PIN when homing to X_MIN"
|
||||
#elif X_HOME_TO_MAX && Z2_STOP_PIN == X_MAX_PIN
|
||||
#error "Z2_STOP_PIN can't be the same as X_MAX_PIN when homing to X_MAX"
|
||||
#elif Y_HOME_TO_MIN && Z2_STOP_PIN == Y_MIN_PIN
|
||||
#error "Z2_STOP_PIN can't be the same as Y_MIN_PIN when homing to Y_MIN"
|
||||
#elif Y_HOME_TO_MAX && Z2_STOP_PIN == Y_MAX_PIN
|
||||
#error "Z2_STOP_PIN can't be the same as Y_MAX_PIN when homing to Y_MAX"
|
||||
#elif Z_HOME_TO_MIN && Z2_STOP_PIN == Z_MIN_PIN
|
||||
#error "Z2_STOP_PIN can't be the same as Z_MIN_PIN when homing to Z_MIN"
|
||||
#elif Z_HOME_TO_MAX && Z2_STOP_PIN == Z_MAX_PIN
|
||||
#error "Z2_STOP_PIN can't be the same as Z_MAX_PIN when homing to Z_MAX"
|
||||
#endif
|
||||
#endif
|
||||
#if PIN_EXISTS(Z3_STOP)
|
||||
#if X_HOME_TO_MIN && Z3_STOP_PIN == X_MIN_PIN
|
||||
#error "Z3_STOP_PIN can't be the same as X_MIN_PIN when homing to X_MIN"
|
||||
#elif X_HOME_TO_MAX && Z3_STOP_PIN == X_MAX_PIN
|
||||
#error "Z3_STOP_PIN can't be the same as X_MAX_PIN when homing to X_MAX"
|
||||
#elif Y_HOME_TO_MIN && Z3_STOP_PIN == Y_MIN_PIN
|
||||
#error "Z3_STOP_PIN can't be the same as Y_MIN_PIN when homing to Y_MIN"
|
||||
#elif Y_HOME_TO_MAX && Z3_STOP_PIN == Y_MAX_PIN
|
||||
#error "Z3_STOP_PIN can't be the same as Y_MAX_PIN when homing to Y_MAX"
|
||||
#elif Z_HOME_TO_MIN && Z3_STOP_PIN == Z_MIN_PIN
|
||||
#error "Z3_STOP_PIN can't be the same as Z_MIN_PIN when homing to Z_MIN"
|
||||
#elif Z_HOME_TO_MAX && Z3_STOP_PIN == Z_MAX_PIN
|
||||
#error "Z3_STOP_PIN can't be the same as Z_MAX_PIN when homing to Z_MAX"
|
||||
#endif
|
||||
#endif
|
||||
#if PIN_EXISTS(Z4_STOP)
|
||||
#if X_HOME_TO_MIN && Z4_STOP_PIN == X_MIN_PIN
|
||||
#error "Z4_STOP_PIN can't be the same as X_MIN_PIN when homing to X_MIN"
|
||||
#elif X_HOME_TO_MAX && Z4_STOP_PIN == X_MAX_PIN
|
||||
#error "Z4_STOP_PIN can't be the same as X_MAX_PIN when homing to X_MAX"
|
||||
#elif Y_HOME_TO_MIN && Z4_STOP_PIN == Y_MIN_PIN
|
||||
#error "Z4_STOP_PIN can't be the same as Y_MIN_PIN when homing to Y_MIN"
|
||||
#elif Y_HOME_TO_MAX && Z4_STOP_PIN == Y_MAX_PIN
|
||||
#error "Z4_STOP_PIN can't be the same as Y_MAX_PIN when homing to Y_MAX"
|
||||
#elif Z_HOME_TO_MIN && Z4_STOP_PIN == Z_MIN_PIN
|
||||
#error "Z4_STOP_PIN can't be the same as Z_MIN_PIN when homing to Z_MIN"
|
||||
#elif Z_HOME_TO_MAX && Z4_STOP_PIN == Z_MAX_PIN
|
||||
#error "Z4_STOP_PIN can't be the same as Z_MAX_PIN when homing to Z_MAX"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ENDSTOP_NOISE_THRESHOLD) && !WITHIN(ENDSTOP_NOISE_THRESHOLD, 2, 7)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
* version was tagged.
|
||||
*/
|
||||
#ifndef STRING_DISTRIBUTION_DATE
|
||||
#define STRING_DISTRIBUTION_DATE "2024-05-24"
|
||||
#define STRING_DISTRIBUTION_DATE "2024-07-07"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -789,7 +789,7 @@
|
||||
* Input Shaping
|
||||
*/
|
||||
#if HAS_ZV_SHAPING
|
||||
#if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
|
||||
#if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX)
|
||||
#warning "Input Shaping for CORE / MARKFORGED kinematic axes is still experimental."
|
||||
#endif
|
||||
#if ENABLED(I2S_STEPPER_STREAM)
|
||||
|
||||
@@ -467,6 +467,7 @@ bool MarlinUI::detected() {
|
||||
#endif
|
||||
|
||||
void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
void MarlinUI::clear_for_drawing() { clear_lcd(); }
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
|
||||
@@ -1515,7 +1516,7 @@ void MarlinUI::draw_status_screen() {
|
||||
lower_right.column = 0;
|
||||
lower_right.row = 0;
|
||||
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
|
||||
x_map_pixels = (HD44780_CHAR_WIDTH) * (MESH_MAP_COLS) - 2; // Minus 2 because we are drawing a box around the map
|
||||
y_map_pixels = (HD44780_CHAR_HEIGHT) * (MESH_MAP_ROWS) - 2;
|
||||
|
||||
@@ -376,6 +376,8 @@ void MarlinUI::clear_lcd() {
|
||||
lcd.clear_buffer();
|
||||
}
|
||||
|
||||
void MarlinUI::clear_for_drawing() { clear_lcd(); }
|
||||
|
||||
#if HAS_LCD_CONTRAST
|
||||
void MarlinUI::_set_contrast() { lcd.setContrast(contrast); }
|
||||
#endif
|
||||
|
||||
@@ -374,12 +374,25 @@ void MarlinUI::draw_kill_screen() {
|
||||
} while (u8g.nextPage());
|
||||
}
|
||||
|
||||
void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
// Erase the LCD contents by drawing an empty box.
|
||||
void MarlinUI::clear_lcd() {
|
||||
u8g.setColorIndex(0);
|
||||
u8g.firstPage();
|
||||
do {
|
||||
u8g.drawBox(0, 0, u8g.getWidth(), u8g.getHeight());
|
||||
} while (u8g.nextPage());
|
||||
u8g.setColorIndex(1);
|
||||
}
|
||||
|
||||
// U8G displays are drawn over multiple loops so must do their own clearing.
|
||||
void MarlinUI::clear_for_drawing() {
|
||||
// Automatically cleared by Picture Loop
|
||||
}
|
||||
|
||||
#if HAS_DISPLAY_SLEEP
|
||||
void MarlinUI::sleep_display(const bool sleep/*=true*/) {
|
||||
static bool asleep = false;
|
||||
if (asleep != sleep){
|
||||
if (asleep != sleep) {
|
||||
sleep ? u8g.sleepOn() : u8g.sleepOff();
|
||||
asleep = sleep;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,11 @@
|
||||
#if ENABLED(ALTERNATIVE_LCD)
|
||||
#define U8G_CLASS U8GLIB_SH1306_128X64_2X // 4 stripes
|
||||
#else
|
||||
#define U8G_CLASS U8GLIB_SH1306_128X64 // 8 stripes
|
||||
#if ENABLED(U8GLIB_SSD1306_SPI)
|
||||
#define U8G_CLASS U8GLIB_SSD1306_128X64_SW_SPI_HAL
|
||||
#else
|
||||
#define U8G_CLASS U8GLIB_SH1306_128X64 // 8 stripes
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif ANY(MKS_12864OLED, ZONESTAR_12864OLED)
|
||||
@@ -168,7 +172,11 @@
|
||||
#if ENABLED(ALTERNATIVE_LCD)
|
||||
#define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes
|
||||
#else
|
||||
#define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes
|
||||
#if ENABLED(U8GLIB_SH1106_SPI)
|
||||
#define U8G_CLASS U8GLIB_SH1106_128X64_SW_SPI_HAL
|
||||
#else
|
||||
#define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif ENABLED(U8GLIB_SH1106_EINSTART)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
// use this file to create the public interface for device drivers that are NOT in the U8G library
|
||||
// Use this file to create the public interface for device drivers that are NOT in the U8G library
|
||||
|
||||
extern u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_sw_spi;
|
||||
extern u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi;
|
||||
@@ -90,6 +90,30 @@ public:
|
||||
void init(uint8_t options = U8G_I2C_OPT_NONE) { U8GLIB::init(&u8g_dev_ssd1306_128x64_2x_i2c_2_wire, options); }
|
||||
};
|
||||
|
||||
#if ENABLED(U8GLIB_SH1106_SPI)
|
||||
extern u8g_dev_t u8g_dev_sh1106_128x64_HAL_sw_spi;
|
||||
class U8GLIB_SH1106_128X64_SW_SPI_HAL : public U8GLIB {
|
||||
public:
|
||||
U8GLIB_SH1106_128X64_SW_SPI_HAL() : U8GLIB() { }
|
||||
U8GLIB_SH1106_128X64_SW_SPI_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE) {init(sck, mosi, cs, reset); }
|
||||
void init(pin_t sck, pin_t mosi, pin_t cs, pin_t reset=U8G_PIN_NONE) {
|
||||
U8GLIB::init(&u8g_dev_sh1106_128x64_HAL_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if ENABLED(U8GLIB_SSD1306_SPI)
|
||||
extern u8g_dev_t u8g_dev_ssd1306_128x64_HAL_sw_spi;
|
||||
class U8GLIB_SSD1306_128X64_SW_SPI_HAL : public U8GLIB {
|
||||
public:
|
||||
U8GLIB_SSD1306_128X64_SW_SPI_HAL() : U8GLIB() { }
|
||||
U8GLIB_SSD1306_128X64_SW_SPI_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE) {init(sck, mosi, cs, reset); }
|
||||
void init(pin_t sck, pin_t mosi, pin_t cs, pin_t reset=U8G_PIN_NONE) {
|
||||
U8GLIB::init(&u8g_dev_ssd1306_128x64_HAL_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Very basic support for 320x240 TFT screen
|
||||
// Tested on MKS Robin TFT_V2.0 with ST7789V controller
|
||||
|
||||
@@ -77,35 +77,34 @@
|
||||
|
||||
uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_seq);
|
||||
|
||||
// The sh1106 is compatible to the ssd1306, but is 132x64. 128x64 display area is centered within
|
||||
// the 132x64.
|
||||
// SH1106 (132x64) is compatible with SSD1306 (128x64) by adding a small margin to the larger display
|
||||
|
||||
#define SH1106_PAGE_ADR(N) (0x20), (N)
|
||||
#define SH1106_COL_ADR(N) (0x10 | ((N) >> 4)), ((N) & 0xFF)
|
||||
#define SH1106_COLUMN_RANGE(N,O) (0x21), (N), (O)
|
||||
#define SH1106_PAGE_RANGE(N,O) (0x22), (N), (O)
|
||||
#define SH1106_SCROLL(N) ((N) ? 0x2F : 0x2E)
|
||||
#define SH1106_START_LINE(N) (0x40 | (N))
|
||||
#define SH1106_CONTRAST(N) (0x81), (N)
|
||||
#define SH1106_CHARGE_PUMP(N) (0x8D), ((N) ? 0x14 : 0x10)
|
||||
#define SH1106_ADC_REVERSE(N) ((N) ? 0xA1 : 0xA0)
|
||||
#define SH1106_ALL_PIX(N) ((N) ? 0xA5 : 0xA4)
|
||||
#define SH1106_INVERTED(N) ((N) ? 0xA7 : 0xA6)
|
||||
#define SH1106_MUX_RATIO(N) (0xA8), (N)
|
||||
#define SH1106_ON(N) ((N) ? 0xAF : 0xAE)
|
||||
#define SH1106_OUT_MODE(N) ((N) ? 0xC8 : 0xC0)
|
||||
#define SH1106_DISP_OFFS(N) (0xD3), (N)
|
||||
#define SH1106_OSC_FREQ(R,F) (0xD5), ((F) << 4 | (R))
|
||||
#define SH1106_CHARGE_PER(P,D) (0xD9), ((D) << 4 | (P))
|
||||
#define SH1106_COM_CONFIG(N) (0xDA), ((N) ? 0x12 : 0x02)
|
||||
#define SH1106_VCOM_DESEL(N) (0xDB), (N)
|
||||
#define SH1106_NOOP() (0xE3)
|
||||
|
||||
static const uint8_t u8g_dev_sh1106_128x64_data_start_2_wire[] PROGMEM = {
|
||||
0x010, // set upper 4 bit of the col adr to 0
|
||||
0x002, // set lower 4 bit of the col adr to 2 (centered display with ssd1306)
|
||||
U8G_ESC_END // end of sequence
|
||||
SH1106_COL_ADR(2), // Column 2 to center 128 pixels in 132 pixels
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
#define SH1106_PAGE_ADR(N) (0x20), (N)
|
||||
#define SH1106_COLUMN_RANGE(N) (0x21), (((N) >> 8) & 0xFF), ((N) & 0xFF)
|
||||
#define SH1106_PAGE_RANGE(N,O) (0x22), (N), (O)
|
||||
#define SH1106_SCROLL(N) ((N) ? 0x2F : 0x2E)
|
||||
#define SH1106_START_LINE(N) (0x40 | (N))
|
||||
#define SH1106_CONTRAST(N) (0x81), (N)
|
||||
#define SH1106_CHARGE_PUMP(N) (0x8D), ((N) ? 0x14 : 0x10)
|
||||
#define SH1106_ADC_REVERSE(N) ((N) ? 0xA1 : 0xA0)
|
||||
#define SH1106_ALL_PIX(N) ((N) ? 0xA5 : 0xA4)
|
||||
#define SH1106_INVERTED(N) ((N) ? 0xA7 : 0xA6)
|
||||
#define SH1106_MUX_RATIO(N) (0xA8), (N)
|
||||
#define SH1106_ON(N) ((N) ? 0xAF : 0xAE)
|
||||
#define SH1106_OUT_MODE(N) ((N) ? 0xC8 : 0xC0)
|
||||
#define SH1106_DISP_OFFS(N) (0xD3), (N)
|
||||
#define SH1106_OSC_FREQ(R,F) (0xD5), ((F) << 4 | (R))
|
||||
#define SH1106_CHARGE_PER(P,D) (0xD9), ((D) << 4 | (P))
|
||||
#define SH1106_COM_CONFIG(N) (0xDA), ((N) ? 0x12 : 0x02)
|
||||
#define SH1106_VCOM_DESEL(N) (0xDB), (N)
|
||||
#define SH1106_NOOP() (0xE3)
|
||||
|
||||
static const uint8_t u8g_dev_sh1106_128x64_init_seq_2_wire[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // Initiate command mode
|
||||
SH1106_ON(0), // Display off, sleep mode
|
||||
@@ -113,19 +112,19 @@ static const uint8_t u8g_dev_sh1106_128x64_init_seq_2_wire[] PROGMEM = {
|
||||
SH1106_DISP_OFFS(0), // Display offset
|
||||
SH1106_START_LINE(0), // Start line
|
||||
SH1106_ADC_REVERSE(1), // Segment remap A0/A1
|
||||
SH1106_OUT_MODE(1), // C0: scan dir normal, C8: reverse
|
||||
SH1106_COM_CONFIG(1), // Com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
|
||||
SH1106_CONTRAST(0xCF), // [2] set contrast control
|
||||
SH1106_PAGE_ADR(0x02), // 2012-05-27: page addressing mode
|
||||
SH1106_COLUMN_RANGE(0x281), // Set column range from 0 through 131
|
||||
SH1106_PAGE_RANGE(0, 7), // Set page range from 0 through 7
|
||||
SH1106_CHARGE_PER(0x1, 0xF), // [2] pre-charge period 0x22/F1
|
||||
SH1106_OUT_MODE(1), // 0: scan dir normal, 1: reverse
|
||||
SH1106_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
|
||||
SH1106_CONTRAST(0xCF), // Set contrast control
|
||||
SH1106_PAGE_ADR(0x02), // page addressing mode
|
||||
SH1106_COLUMN_RANGE(2, 129), // Set column range 2 .. 129
|
||||
SH1106_PAGE_RANGE(0, 7), // Set page range 0 .. 7
|
||||
SH1106_CHARGE_PER(0x1, 0xF), // Pre-charge period
|
||||
SH1106_VCOM_DESEL(0x40), // Vcomh deselect level
|
||||
SH1106_ALL_PIX(0), // Output ram to display
|
||||
SH1106_ALL_PIX(0), // Output RAM to display
|
||||
SH1106_INVERTED(0), // Normal display mode
|
||||
SH1106_OSC_FREQ(0, 8), // Clock divide ratio (0:1) and oscillator frequency (8)
|
||||
SH1106_CHARGE_PUMP(1), // [2] charge pump setting (P62): 0x14 enable, 0x10 disable
|
||||
SH1106_SCROLL(0), // 2012-05-27: Deactivate scroll
|
||||
SH1106_CHARGE_PUMP(1), // Charge pump setting
|
||||
SH1106_SCROLL(0), // Deactivate scroll
|
||||
SH1106_ON(1), // Display on
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
@@ -136,28 +135,24 @@ uint8_t u8g_dev_sh1106_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_init_seq_2_wire);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP: break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT: {
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_SetAddress(u8g, dev, 0); // instruction mode
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
|
||||
u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2)); // select current page
|
||||
u8g_SetAddress(u8g, dev, 1); // data mode
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
u8g_SetAddress(u8g, dev, 0); // instruction mode
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
|
||||
u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2+1)); // select current page
|
||||
u8g_SetAddress(u8g, dev, 1); // data mode
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
return 1;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_SetAddress(u8g, dev, 0); // Instruction mode
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
|
||||
u8g_WriteByte(u8g, dev, 0xB0 | (pb->p.page*2)); // Select current page
|
||||
u8g_SetAddress(u8g, dev, 1); // Data mode
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
u8g_SetAddress(u8g, dev, 0); // Instruction mode
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
|
||||
u8g_WriteByte(u8g, dev, 0xB0 | (pb->p.page*2+1)); // Select current page
|
||||
u8g_SetAddress(u8g, dev, 1); // Data mode
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
} break;
|
||||
case U8G_DEV_MSG_SLEEP_ON: return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF: return 1;
|
||||
}
|
||||
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
@@ -169,33 +164,32 @@ u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c_2_wire = { u8g_dev_sh1106_128x64_2x_2_wir
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static const uint8_t u8g_dev_ssd1306_128x64_data_start_2_wire[] PROGMEM = {
|
||||
0x010, // set upper 4 bit of the col adr to 0
|
||||
0x000, // set lower 4 bit of the col adr to 0
|
||||
U8G_ESC_END // end of sequence
|
||||
SH1106_COL_ADR(0), // Column 0
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd1306_128x64_init_seq_2_wire[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // initiate command mode
|
||||
0x0AE, // display off, sleep mode
|
||||
0x0A8, 0x03F, // mux ratio
|
||||
0x0D3, 0x00, // display offset
|
||||
0x040, // start line
|
||||
0x0A1, // segment remap a0/a1
|
||||
0x0C8, // c0: scan dir normal, c8: reverse
|
||||
0x0DA, 0x012, // com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
|
||||
0x081, 0x0CF, // [2] set contrast control
|
||||
0x020, 0x002, // 2012-05-27: page addressing mode
|
||||
0x21, 0, 0x7F, // set column range from 0 through 127
|
||||
0x22, 0, 7, // set page range from 0 through 7
|
||||
0x0D9, 0x0F1, // [2] pre-charge period 0x022/f1
|
||||
0x0DB, 0x040, // vcomh deselect level
|
||||
0x0A4, // output ram to display
|
||||
0x0A6, // none inverted normal display mode
|
||||
0x0D5, 0x080, // clock divide ratio (0x00=1) and oscillator frequency (0x8)
|
||||
0x08D, 0x014, // [2] charge pump setting (p62): 0x014 enable, 0x010 disable
|
||||
0x02E, // 2012-05-27: Deactivate scroll
|
||||
0x0AF, // display on
|
||||
U8G_ESC_END // end of sequence
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
SH1106_ON(0), // Display off, sleep mode
|
||||
SH1106_MUX_RATIO(0x3F), // Mux ratio
|
||||
SH1106_DISP_OFFS(0), // Display offset
|
||||
SH1106_START_LINE(0), // Start line
|
||||
SH1106_ADC_REVERSE(1), // Segment remap A0/A1
|
||||
SH1106_OUT_MODE(1), // 0: scan dir normal, 1: reverse
|
||||
SH1106_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
|
||||
SH1106_CONTRAST(0xCF), // Set contrast control
|
||||
SH1106_PAGE_ADR(0x02), // page addressing mode
|
||||
SH1106_COLUMN_RANGE(0, 127), // Set column range 0 .. 127
|
||||
SH1106_PAGE_RANGE(0, 7), // Set page range from 0 .. 7
|
||||
SH1106_CHARGE_PER(0x1, 0xF), // Pre-charge period
|
||||
SH1106_VCOM_DESEL(0x40), // Vcomh deselect level
|
||||
SH1106_ALL_PIX(0), // Send RAM to display
|
||||
SH1106_INVERTED(0), // Normal display mode
|
||||
SH1106_OSC_FREQ(0, 8), // Clock divide ratio (0:1) and oscillator frequency (8)
|
||||
SH1106_CHARGE_PUMP(1), // Charge pump setting
|
||||
SH1106_SCROLL(0), // Deactivate scroll
|
||||
SH1106_ON(1), // Display on
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_ssd1306_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
|
||||
@@ -204,28 +198,24 @@ uint8_t u8g_dev_ssd1306_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_init_seq_2_wire);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP: break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT: {
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_SetAddress(u8g, dev, 0); // instruction mode
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
|
||||
u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2)); // select current page
|
||||
u8g_SetAddress(u8g, dev, 1); // data mode
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
u8g_SetAddress(u8g, dev, 0); // instruction mode
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
|
||||
u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2+1)); // select current page
|
||||
u8g_SetAddress(u8g, dev, 1); // data mode
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
return 1;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_SetAddress(u8g, dev, 0); // Instruction mode
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
|
||||
u8g_WriteByte(u8g, dev, 0xB0 | (pb->p.page*2)); // Select current page
|
||||
u8g_SetAddress(u8g, dev, 1); // Data mode
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
u8g_SetAddress(u8g, dev, 0); // Instruction mode
|
||||
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
|
||||
u8g_WriteByte(u8g, dev, 0xB0 | (pb->p.page*2+1)); // Select current page
|
||||
u8g_SetAddress(u8g, dev, 1); // Data mode
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
} break;
|
||||
case U8G_DEV_MSG_SLEEP_ON: return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF: return 1;
|
||||
}
|
||||
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
@@ -236,10 +226,10 @@ u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c_2_wire = { u8g_dev_ssd1306_128x64_2x_2_w
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This routine adds the instruction byte in between the command bytes. This makes the init
|
||||
// sequences a lot easier to read.
|
||||
// This routine adds the instruction byte in between the command bytes.
|
||||
// This makes the init sequences a lot easier to read.
|
||||
|
||||
#define I2C_CMD_MODE 0x080
|
||||
#define I2C_CMD_MODE 0x80
|
||||
|
||||
uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_seq) {
|
||||
uint8_t is_escape = 0;
|
||||
@@ -247,10 +237,8 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
|
||||
uint8_t value = u8g_pgm_read(esc_seq);
|
||||
if (is_escape == 0) {
|
||||
if (value != 255) {
|
||||
if (u8g_WriteByte(u8g, dev, value) == 0 )
|
||||
return 0;
|
||||
if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0 )
|
||||
return 0;
|
||||
if (u8g_WriteByte(u8g, dev, value) == 0) return 0;
|
||||
if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0) return 0;
|
||||
}
|
||||
else {
|
||||
is_escape = 1;
|
||||
@@ -258,16 +246,14 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
|
||||
}
|
||||
else {
|
||||
if (value == 255) {
|
||||
if (u8g_WriteByte(u8g, dev, value) == 0 )
|
||||
return 0;
|
||||
if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0 )
|
||||
return 0;
|
||||
if (u8g_WriteByte(u8g, dev, value) == 0) return 0;
|
||||
if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0) return 0;
|
||||
}
|
||||
else if (value == 254) {
|
||||
break;
|
||||
}
|
||||
else if (value >= 0x0F0) {
|
||||
/* not yet used, do nothing */
|
||||
else if (value >= 0xF0) {
|
||||
// not yet used, do nothing
|
||||
}
|
||||
else if (value >= 0xE0 ) {
|
||||
u8g_SetAddress(u8g, dev, value & 0x0F);
|
||||
@@ -279,13 +265,14 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
|
||||
u8g_SetResetLow(u8g, dev);
|
||||
value &= 0x0F;
|
||||
value <<= 4;
|
||||
value+=2;
|
||||
value += 2;
|
||||
u8g_Delay(value);
|
||||
u8g_SetResetHigh(u8g, dev);
|
||||
u8g_Delay(value);
|
||||
}
|
||||
else if (value >= 0xBE) { /* not yet implemented */
|
||||
/* u8g_SetVCC(u8g, dev, value & 0x01); */
|
||||
else if (value >= 0xBE) {
|
||||
// not yet implemented
|
||||
//u8g_SetVCC(u8g, dev, value & 0x01);
|
||||
}
|
||||
else if (value <= 127) {
|
||||
u8g_Delay(value);
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Based on u8g_dev_ssd1306_128x64.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.
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ALL(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI) && ANY(U8GLIB_SH1106_SPI, U8GLIB_SSD1306_SPI)
|
||||
|
||||
#include "HAL_LCD_com_defines.h"
|
||||
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
#define SH1106_PAGE_ADR(N) (0x20), (N)
|
||||
#define SH1106_COL_ADR(N) (0x10 | ((N) >> 4)), ((N) & 0xFF)
|
||||
#define SH1106_COLUMN_RANGE(N,O) (0x21), (N), (O)
|
||||
#define SH1106_PAGE_RANGE(N,O) (0x22), (N), (O)
|
||||
#define SH1106_SCROLL(N) ((N) ? 0x2F : 0x2E)
|
||||
#define SH1106_START_LINE(N) (0x40 | (N))
|
||||
#define SH1106_CONTRAST(N) (0x81), (N)
|
||||
#define SH1106_CHARGE_PUMP(N) (0x8D), ((N) ? 0x14 : 0x10)
|
||||
#define SH1106_ADC_REVERSE(N) ((N) ? 0xA1 : 0xA0)
|
||||
#define SH1106_ALL_PIX(N) ((N) ? 0xA5 : 0xA4)
|
||||
#define SH1106_INVERTED(N) ((N) ? 0xA7 : 0xA6)
|
||||
#define SH1106_MUX_RATIO(N) (0xA8), (N)
|
||||
#define SH1106_ON(N) ((N) ? 0xAF : 0xAE)
|
||||
#define SH1106_OUT_MODE(N) ((N) ? 0xC8 : 0xC0)
|
||||
#define SH1106_DISP_OFFS(N) (0xD3), (N)
|
||||
#define SH1106_OSC_FREQ(R,F) (0xD5), ((F) << 4 | (R))
|
||||
#define SH1106_CHARGE_PER(P,D) (0xD9), ((D) << 4 | (P))
|
||||
#define SH1106_COM_CONFIG(N) (0xDA), ((N) ? 0x12 : 0x02)
|
||||
#define SH1106_VCOM_DESEL(N) (0xDB), (N)
|
||||
#define SH1106_NOOP() (0xE3)
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_HAL_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
SH1106_ON(0) // Display off
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_HAL_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
SH1106_ON(1), // Display on
|
||||
U8G_ESC_DLY(50), // Delay 50 ms
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
#if ENABLED(U8GLIB_SH1106_SPI)
|
||||
|
||||
// Init sequence Adafruit 128x64 OLED (NOT TESTED). Like Adafruit3, but with page addressing mode.
|
||||
static const uint8_t u8g_dev_sh1106_128x64_HAL_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_RST(1), // Do reset low pulse with (1*16)+2 milliseconds
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
SH1106_ON(0), // Display off, sleep mode
|
||||
SH1106_OSC_FREQ(0, 8), // Clock divide ratio (0:1) and oscillator frequency (8)
|
||||
SH1106_MUX_RATIO(0x3F), // Mux ratio
|
||||
SH1106_DISP_OFFS(0), // Display offset
|
||||
SH1106_START_LINE(0), // Start line
|
||||
SH1106_CHARGE_PUMP(1), // Charge pump setting
|
||||
SH1106_PAGE_ADR(0x02), // page addressing mode
|
||||
SH1106_ADC_REVERSE(1), // Segment remap A0/A1
|
||||
SH1106_OUT_MODE(1), // 0: scan dir normal, 1: reverse
|
||||
SH1106_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
|
||||
SH1106_CONTRAST(0x80), // Set contrast control
|
||||
SH1106_CHARGE_PER(0x1, 0xF), // Pre-charge period
|
||||
SH1106_VCOM_DESEL(0x40), // Vcomh deselect level
|
||||
SH1106_SCROLL(0), // Deactivate scroll
|
||||
SH1106_ALL_PIX(0), // Output RAM to display
|
||||
SH1106_INVERTED(0), // Normal display mode
|
||||
SH1106_ON(1), // Display on
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
// SH1106 (132x64) is compatible with SSD1306 (128x64) by adding a small margin to the larger display
|
||||
static const uint8_t u8g_dev_sh1106_128x64_HAL_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
SH1106_COL_ADR(2), // Column 2 to center 128 pixels in 132 pixels
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_sh1106_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
|
||||
switch(msg) {
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_HAL_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT: {
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_HAL_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); // Select current page (SSD1306)
|
||||
u8g_SetAddress(u8g, dev, 1); // Data mode
|
||||
if (u8g_pb_WriteBuffer(pb, u8g, dev) == 0) return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
} break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_HAL_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_HAL_sleep_off);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); // Instruction mode
|
||||
u8g_WriteByte(u8g, dev, 0x81);
|
||||
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_sh1106_128x64_HAL_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sh1106_128x64_HAL_fn, U8G_COM_HAL_SW_SPI_FN);
|
||||
|
||||
#elif ENABLED(U8GLIB_SSD1306_SPI)
|
||||
|
||||
static const uint8_t u8g_dev_ssd1306_128x64_HAL_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_RST(1), // Do reset low pulse with (1*16)+2 milliseconds
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
SH1106_ON(0), // Display off, sleep mode
|
||||
SH1106_OSC_FREQ(0, 8), // Clock divide ratio (0:1) and oscillator frequency (8)
|
||||
SH1106_MUX_RATIO(0x3F), // Mux ratio
|
||||
SH1106_DISP_OFFS(0), // Display offset
|
||||
SH1106_START_LINE(0), // Start line
|
||||
SH1106_CHARGE_PUMP(1), // Charge pump setting
|
||||
SH1106_PAGE_ADR(0x02), // page addressing mode
|
||||
SH1106_ADC_REVERSE(1), // Segment remap A0/A1
|
||||
SH1106_OUT_MODE(1), // 0: scan dir normal, 1: reverse
|
||||
SH1106_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
|
||||
SH1106_CONTRAST(0x80), // Set contrast control
|
||||
SH1106_CHARGE_PER(0x1, 0xF), // Pre-charge period
|
||||
SH1106_VCOM_DESEL(0x40), // Vcomh deselect level
|
||||
SH1106_SCROLL(0), // Deactivate scroll
|
||||
SH1106_ALL_PIX(0), // Output RAM to display
|
||||
SH1106_INVERTED(0), // Normal display mode
|
||||
SH1106_ON(1), // Display on
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd1306_128x64_HAL_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
SH1106_COL_ADR(0), // Column 0
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_ssd1306_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
|
||||
switch(msg) {
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_HAL_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP: break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT: {
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_HAL_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); // Select current page (SSD1306)
|
||||
u8g_SetAddress(u8g, dev, 1); // Data mode
|
||||
if (u8g_pb_WriteBuffer(pb, u8g, dev) == 0) return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
} break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_HAL_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_HAL_sleep_off);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); // Instruction mode
|
||||
u8g_WriteByte(u8g, dev, 0x81);
|
||||
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_128x64_HAL_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x64_HAL_fn, U8G_COM_HAL_SW_SPI_FN);
|
||||
|
||||
#endif // U8GLIB_SSD1306_SPI
|
||||
#endif // HAS_MARLINUI_U8GLIB
|
||||
@@ -31,61 +31,83 @@
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
#define SSD1309_PAGE_ADR(N) (0x20), (N)
|
||||
#define SSD1309_COL_ADR(N) (0x10 | ((N) >> 4)), ((N) & 0xFF)
|
||||
#define SSD1309_COLUMN_RANGE(N,O) (0x21), (N), (O)
|
||||
#define SSD1309_PAGE_RANGE(N,O) (0x22), (N), (O)
|
||||
#define SSD1309_SCROLL(N) ((N) ? 0x2F : 0x2E)
|
||||
#define SSD1309_START_LINE(N) (0x40 | (N))
|
||||
#define SSD1309_CONTRAST(N) (0x81), (N)
|
||||
#define SSD1309_CHARGE_PUMP(N) (0x8D), ((N) ? 0x14 : 0x10)
|
||||
#define SSD1309_ADC_REVERSE(N) ((N) ? 0xA1 : 0xA0)
|
||||
#define SSD1309_ALL_PIX(N) ((N) ? 0xA5 : 0xA4)
|
||||
#define SSD1309_INVERTED(N) ((N) ? 0xA7 : 0xA6)
|
||||
#define SSD1309_MUX_RATIO(N) (0xA8), (N)
|
||||
#define SSD1309_ON(N) ((N) ? 0xAF : 0xAE)
|
||||
#define SSD1309_OUT_MODE(N) ((N) ? 0xC8 : 0xC0)
|
||||
#define SSD1309_DISP_OFFS(N) (0xD3), (N)
|
||||
#define SSD1309_OSC_FREQ(R,F) (0xD5), ((F) << 4 | (R))
|
||||
#define SSD1309_CHARGE_PER(P,D) (0xD9), ((D) << 4 | (P))
|
||||
#define SSD1309_COM_CONFIG(N) (0xDA), ((N) ? 0x12 : 0x02)
|
||||
#define SSD1309_VCOM_DESEL(N) (0xDB), (N)
|
||||
#define SSD1309_NOOP() (0xE3)
|
||||
#define SSD1309_COMMAND_LOCK(N) (0xFD), ((N) ? 0x16 : 0x12)
|
||||
|
||||
// SSD1309 init sequence
|
||||
static const uint8_t u8g_dev_ssd1309_128x64_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_RST(1), // Do reset low pulse with (1*16)+2 milliseconds
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_RST(1), // Do reset low pulse with (1*16)+2 milliseconds
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
|
||||
0xFD,0x12, // Command Lock
|
||||
0xAE, // Set Display Off
|
||||
0xD5,0xA0, // Set Display Clock Divide Ratio/Oscillator Frequency
|
||||
0xA8,0x3F, // Set Multiplex Ratio
|
||||
0x3D,0x00, // Set Display Offset
|
||||
0x40, // Set Display Start Line
|
||||
0xA1, // Set Segment Re-Map
|
||||
0xC8, // Set COM Output Scan Direction
|
||||
0xDA,0x12, // Set COM Pins Hardware Configuration
|
||||
0x81,0xDF, // Set Current Control
|
||||
0xD9,0x82, // Set Pre-Charge Period
|
||||
0xDB,0x34, // Set VCOMH Deselect Level
|
||||
0xA4, // Set Entire Display On/Off
|
||||
0xA6, // Set Normal/Inverse Display
|
||||
U8G_ESC_VCC(1), // Power up VCC & Stabilized
|
||||
SSD1309_COMMAND_LOCK(0), // Unlock OLED driver IC MCU command interface
|
||||
SSD1309_ON(0),
|
||||
SSD1309_OSC_FREQ(0, 10), // Clock divide ratio (0:1) and oscillator frequency (8)
|
||||
SSD1309_MUX_RATIO(0x3F), // Mux ratio
|
||||
SSD1309_DISP_OFFS(0), // Display offset
|
||||
SSD1309_START_LINE(0), // Start line
|
||||
SSD1309_ADC_REVERSE(1), // Segment remap A0/A1
|
||||
SSD1309_OUT_MODE(1), // 0: scan dir normal, 1: reverse
|
||||
SSD1309_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
|
||||
SSD1309_CONTRAST(0xDF), // Set contrast control
|
||||
SSD1309_CHARGE_PER(0x2, 0x8), // Pre-charge period
|
||||
SSD1309_VCOM_DESEL(0x34), // Vcomh deselect level
|
||||
SSD1309_ALL_PIX(0), // Output RAM to display
|
||||
SSD1309_INVERTED(0), // Normal display mode
|
||||
|
||||
U8G_ESC_VCC(1), // Power up VCC & stabilize
|
||||
U8G_ESC_DLY(50),
|
||||
0xAF, // Set Display On
|
||||
SSD1309_ON(1), // Display on
|
||||
U8G_ESC_DLY(50),
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
// Select one init sequence here
|
||||
#define u8g_dev_ssd1309_128x64_init_seq u8g_dev_ssd1309_128x64_init_seq
|
||||
|
||||
static const uint8_t u8g_dev_ssd1309_128x64_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
0x010, // Set upper 4 bit of the col adr to 0
|
||||
0x000, // Set lower 4 bit of the col adr to 4
|
||||
U8G_ESC_END // End of sequence
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
SSD1309_COL_ADR(0), // Column 0
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
0x0AE, // Display off
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
SSD1309_ON(0), // Display off
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
0x0AF, // Display on
|
||||
U8G_ESC_DLY(50), // Delay 50 ms
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
U8G_ESC_ADR(0), // Instruction mode
|
||||
U8G_ESC_CS(1), // Enable chip
|
||||
SSD1309_ON(1), // Display on
|
||||
U8G_ESC_DLY(50), // Delay 50 ms
|
||||
U8G_ESC_CS(0), // Disable chip
|
||||
U8G_ESC_END // End of sequence
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_ssd1309_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
|
||||
@@ -99,7 +121,7 @@ uint8_t u8g_dev_ssd1309_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
|
||||
case U8G_DEV_MSG_PAGE_NEXT: {
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1309_128x64_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); // Select current page (SSD1306)
|
||||
u8g_WriteByte(u8g, dev, 0xB0 | pb->p.page); // Select current page (SSD1306)
|
||||
u8g_SetAddress(u8g, dev, 1); // Data mode
|
||||
if (u8g_pb_WriteBuffer(pb, u8g, dev) == 0) return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
@@ -108,8 +130,8 @@ uint8_t u8g_dev_ssd1309_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); // Instruction mode
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); // 11 Jul 2015: fixed contrast calculation
|
||||
u8g_WriteByte(u8g, dev, 0x81);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg));
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
|
||||
@@ -130,7 +130,7 @@ static const uint8_t u8g_dev_uc1701_mini12864_HAL_data_start[] PROGMEM = {
|
||||
UC1701_V5_RATIO(3), // set V0 voltage resistor ratio to large
|
||||
UC1701_INDICATOR(0), // indicator disable
|
||||
UC1701_ON(1), // display on
|
||||
UC1701_COLUMN_HI(0), // set upper 4 bit of the col adr to 0
|
||||
UC1701_COLUMN_HI(0), // set upper 4 bits of the col adr to 0
|
||||
U8G_ESC_END, // end of sequence
|
||||
U8G_ESC_DLY(5) // delay 5 ms
|
||||
#else
|
||||
|
||||
@@ -1816,6 +1816,8 @@ void hmiSDCardInit() { card.cdroot(); }
|
||||
// Initialize or re-initialize the LCD
|
||||
void MarlinUI::init_lcd() { dwinStartup(); }
|
||||
|
||||
void MarlinUI::clear_lcd() {}
|
||||
|
||||
void MarlinUI::update() {
|
||||
eachMomentUpdate(); // Status update
|
||||
hmiSDCardUpdate(); // SD card update
|
||||
|
||||
@@ -828,7 +828,7 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) {
|
||||
}
|
||||
if (planner.flow_percentage[0] != flow) {
|
||||
flow = planner.flow_percentage[0];
|
||||
dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]);
|
||||
dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 116 + 2 * STAT_CHR_W, 417, flow);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5155,6 +5155,8 @@ void MarlinUI::init_lcd() {
|
||||
jyersDWIN.redrawScreen();
|
||||
}
|
||||
|
||||
void MarlinUI::clear_lcd() {}
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
|
||||
if (mode != PAUSE_MODE_SAME) pause_mode = mode;
|
||||
|
||||
@@ -90,6 +90,8 @@ void MarlinUI::clear_lcd() {
|
||||
did_first_redraw = false;
|
||||
}
|
||||
|
||||
void MarlinUI::clear_for_drawing() { clear_lcd(); }
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
|
||||
void MarlinUI::show_bootscreen() {
|
||||
@@ -111,7 +113,7 @@ void MarlinUI::clear_lcd() {
|
||||
|
||||
dwinDrawString(false, font10x20, COLOR_YELLOW, COLOR_BG_BLACK, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
|
||||
TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT));
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
|
||||
dwinIconShow(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
|
||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||
@@ -132,7 +134,7 @@ void MarlinUI::clear_lcd() {
|
||||
|
||||
void MarlinUI::bootscreen_completion(const millis_t sofar) {
|
||||
if ((BOOTSCREEN_TIMEOUT) > sofar) safe_delay((BOOTSCREEN_TIMEOUT) - sofar);
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1913,6 +1913,8 @@ void MarlinUI::init_lcd() {
|
||||
dwinJPGCacheTo1(Language_English);
|
||||
}
|
||||
|
||||
void MarlinUI::clear_lcd() {}
|
||||
|
||||
void dwinInitScreen() {
|
||||
dwinSetColorDefaults();
|
||||
hmiInit(); // Draws boot screen
|
||||
|
||||
@@ -195,6 +195,7 @@ namespace ExtUI {
|
||||
void onPIDTuning(const pidresult_t rst) {
|
||||
// Called for temperature PID tuning result
|
||||
switch (rst) {
|
||||
default: break;
|
||||
#if ENABLED(PIDTEMP)
|
||||
case PID_STARTED: dwinPIDTuning(PIDTEMP_START); break;
|
||||
#endif
|
||||
|
||||
@@ -27,20 +27,18 @@
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#define ACDEBUGLEVEL 0 // 0: off, 255: all levels enabled
|
||||
// Bit-masks for selective debug
|
||||
#define AC_INFO 1
|
||||
#define AC_ACTION 2
|
||||
#define AC_FILE 4
|
||||
#define AC_PANEL 8
|
||||
#define AC_MARLIN 16
|
||||
#define AC_SOME 32
|
||||
#define AC_ALL 64
|
||||
//#define ACDEBUGLEVEL AC_MARLIN // 0: off, 255: all levels enabled
|
||||
|
||||
#if ACDEBUGLEVEL
|
||||
// Bit-masks for selective debug:
|
||||
enum ACDebugMask : uint8_t {
|
||||
AC_INFO = 1,
|
||||
AC_ACTION = 2,
|
||||
AC_FILE = 4,
|
||||
AC_PANEL = 8,
|
||||
AC_MARLIN = 16,
|
||||
AC_SOME = 32,
|
||||
AC_ALL = 64
|
||||
};
|
||||
#define ACDEBUG(mask) ( ((mask) & ACDEBUGLEVEL) == mask ) // Debug flag macro
|
||||
#define ACDEBUG(mask) ((mask) & ACDEBUGLEVEL)
|
||||
#else
|
||||
#define ACDEBUG(mask) false
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,8 +29,6 @@
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "../ui_api.h"
|
||||
|
||||
#define MAIN_BOARD_FIRMWARE_VER "V2.4.5"
|
||||
|
||||
#define DATA_BUF_SIZE 64
|
||||
|
||||
/****************** PAGE INDEX***********************/
|
||||
@@ -124,29 +122,29 @@
|
||||
/****************** TXT **************************/
|
||||
|
||||
// MAIN PAGE TXT
|
||||
#define TXT_MAIN_BED 0x2000
|
||||
#define TXT_MAIN_HOTEND 0x2030
|
||||
#define TXT_MAIN_MESSAGE 0x2060
|
||||
#define TXT_MAIN_BED (0x2000+0*0x30)
|
||||
#define TXT_MAIN_HOTEND (0x2000+1*0x30)
|
||||
#define TXT_MAIN_MESSAGE (0x2000+2*0x30)
|
||||
|
||||
// FILE TXT
|
||||
#define TXT_FILE_0 (0x2000+3*0x30)
|
||||
#define TXT_DESCRIPT_0 0x5000 // DESCRIBE ADDRESS
|
||||
#define TXT_FILE_1 (0x2000+4*0x30)
|
||||
#define TXT_DESCRIPT_1 0x5030
|
||||
#define TXT_FILE_2 (0x2000+5*0x30)
|
||||
#define TXT_DESCRIPT_2 0x5060
|
||||
#define TXT_FILE_3 (0x2000+6*0x30)
|
||||
#define TXT_DESCRIPT_3 0x5090
|
||||
#define TXT_FILE_4 (0x2000+7*0x30)
|
||||
#define TXT_DESCRIPT_4 0x50C0
|
||||
#define TXT_FILE_0 (0x2000+3*0x30)
|
||||
#define TXT_DESCRIPT_0 0x5000 // DESCRIBE ADDRESS
|
||||
#define TXT_FILE_1 (0x2000+4*0x30)
|
||||
#define TXT_DESCRIPT_1 0x5030
|
||||
#define TXT_FILE_2 (0x2000+5*0x30)
|
||||
#define TXT_DESCRIPT_2 0x5060
|
||||
#define TXT_FILE_3 (0x2000+6*0x30)
|
||||
#define TXT_DESCRIPT_3 0x5090
|
||||
#define TXT_FILE_4 (0x2000+7*0x30)
|
||||
#define TXT_DESCRIPT_4 0x50C0
|
||||
|
||||
// PRINT TXT
|
||||
#define TXT_PRINT_NAME 0x2000+8*0x30
|
||||
#define TXT_PRINT_SPEED 0x2000+9*0x30
|
||||
#define TXT_PRINT_TIME 0x2000+10*0x30
|
||||
#define TXT_PRINT_PROGRESS 0x2000+11*0x30
|
||||
#define TXT_PRINT_HOTEND 0x2000+12*0x30
|
||||
#define TXT_PRINT_BED 0x2000+13*0x30
|
||||
#define TXT_PRINT_NAME (0x2000+8*0x30)
|
||||
#define TXT_PRINT_SPEED (0x2000+9*0x30)
|
||||
#define TXT_PRINT_TIME (0x2000+10*0x30)
|
||||
#define TXT_PRINT_PROGRESS (0x2000+11*0x30)
|
||||
#define TXT_PRINT_HOTEND (0x2000+12*0x30)
|
||||
#define TXT_PRINT_BED (0x2000+13*0x30)
|
||||
|
||||
// PRINT ADJUST TXT
|
||||
|
||||
@@ -158,8 +156,8 @@
|
||||
|
||||
#define TXT_BED_NOW (0x2000+17*0x30)
|
||||
#define TXT_BED_TARGET (0x2000+18*0x30)
|
||||
#define TXT_HOTEND_NOW (0x2000+19*0x30)
|
||||
#define TXT_HOTEND_TARGET (0x2000+20*0x30)
|
||||
#define TXT_HOTEND_NOW (0x2000+19*0x30)
|
||||
#define TXT_HOTEND_TARGET (0x2000+20*0x30)
|
||||
|
||||
// SPEED SET TXT
|
||||
#define TXT_FAN_SPEED_NOW (0x2000+21*0x30)
|
||||
@@ -171,23 +169,23 @@
|
||||
#define TXT_ABOUT (0x2000+25*0x30)
|
||||
|
||||
// RECORT TXT
|
||||
#define TXT_RECORT_0 (0x2000+26*0x30)
|
||||
#define TXT_RECORT_1 (0x2000+27*0x30)
|
||||
#define TXT_RECORT_2 (0x2000+28*0x30)
|
||||
#define TXT_RECORT_3 (0x2000+29*0x30)
|
||||
#define TXT_RECORT_4 (0x2000+30*0x30)
|
||||
#define TXT_RECORT_5 (0x2000+31*0x30)
|
||||
#define TXT_RECORT_0 (0x2000+26*0x30)
|
||||
#define TXT_RECORT_1 (0x2000+27*0x30)
|
||||
#define TXT_RECORT_2 (0x2000+28*0x30)
|
||||
#define TXT_RECORT_3 (0x2000+29*0x30)
|
||||
#define TXT_RECORT_4 (0x2000+30*0x30)
|
||||
#define TXT_RECORT_5 (0x2000+31*0x30)
|
||||
|
||||
// ADVANCE LEVEL TXT
|
||||
#define TXT_LEVEL_OFFSET (0x2000+32*0x30)
|
||||
#define TXT_LEVEL_OFFSET (0x2000+32*0x30)
|
||||
|
||||
// FILAMENT TXT
|
||||
#define TXT_FILAMENT_TEMP (0x2000+33*0x30)
|
||||
#define TXT_FILAMENT_TEMP (0x2000+33*0x30)
|
||||
|
||||
#define TXT_FINISH_TIME (0x2000+34*0x30)
|
||||
#define TXT_VERSION (0x2000+35*0x30)
|
||||
#define TXT_PREHEAT_HOTEND (0x2000+36*0x30)
|
||||
#define TXT_PREHEAT_BED (0x2000+37*0x30)
|
||||
#define TXT_FINISH_TIME (0x2000+34*0x30)
|
||||
#define TXT_VERSION (0x2000+35*0x30)
|
||||
#define TXT_PREHEAT_HOTEND (0x2000+36*0x30)
|
||||
#define TXT_PREHEAT_BED (0x2000+37*0x30)
|
||||
|
||||
#define TXT_OUTAGE_RECOVERY_FILE 0x2180
|
||||
|
||||
@@ -341,12 +339,11 @@ namespace Anycubic {
|
||||
static uint8_t data_buf[DATA_BUF_SIZE];
|
||||
static uint8_t data_index;
|
||||
static uint16_t page_index_last, page_index_last_2;
|
||||
static uint8_t message_index;
|
||||
static uint8_t pop_up_index;
|
||||
static uint32_t key_value;
|
||||
static uint8_t lcd_txtbox_index;
|
||||
static uint8_t lcd_txtbox_page;
|
||||
static int16_t feedrate_back;
|
||||
static uint16_t feedrate_back;
|
||||
static language_t ui_language;
|
||||
|
||||
public:
|
||||
@@ -364,7 +361,6 @@ namespace Anycubic {
|
||||
static void filamentRunout();
|
||||
static void confirmationRequest(const char * const);
|
||||
static void statusChange(const char * const);
|
||||
static void powerLoss();
|
||||
static void powerLossRecovery();
|
||||
static void homingStart();
|
||||
static void homingComplete();
|
||||
@@ -377,12 +373,16 @@ namespace Anycubic {
|
||||
static void store_changes();
|
||||
|
||||
#if HAS_HOTEND
|
||||
static void send_temperature_hotend(uint32_t addr);
|
||||
static void send_temperature_hotend(const uint16_t address);
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
static void send_temperature_bed(uint32_t addr);
|
||||
static void send_temperature_bed(const uint16_t address);
|
||||
#endif
|
||||
|
||||
static void changePageOfTFT(const uint16_t page_index, const bool no_send=false);
|
||||
static void fakeChangePageOfTFT(const uint16_t page_index);
|
||||
static void debugPage(int page=0);
|
||||
|
||||
typedef void (*p_fun)();
|
||||
static void page1();
|
||||
static void page2();
|
||||
@@ -457,18 +457,25 @@ namespace Anycubic {
|
||||
static void sendFileList(int8_t);
|
||||
static void selectFile();
|
||||
static void processPanelRequest();
|
||||
static void panelInfo(uint8_t);
|
||||
static void panelAction(uint8_t);
|
||||
static void panelProcess(uint8_t);
|
||||
|
||||
static void sendValueToTFT(const uint16_t value, const uint16_t address);
|
||||
static void requestValueFromTFT(const uint16_t address);
|
||||
|
||||
static void sendTxtToTFT(const char *pdata, const uint16_t address);
|
||||
static void sendTxtToTFT_P(PGM_P const pstr, const uint16_t address) {
|
||||
char cstr[32];
|
||||
strlcpy_P(cstr, pstr, sizeof(cstr));
|
||||
sendTxtToTFT(cstr, address);
|
||||
}
|
||||
static void sendTxtToTFT(FSTR_P const fstr, const uint16_t address) {
|
||||
sendTxtToTFT_P(FTOP(fstr), address);
|
||||
}
|
||||
|
||||
static void sendColorToTFT(const uint16_t color, const uint16_t address);
|
||||
static void sendTimeToTFT(const uint32_t minutes, const uint16_t address);
|
||||
static void sendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address);
|
||||
static void changePageOfTFT(const uint16_t page_index, const bool no_send=false);
|
||||
static void fakeChangePageOfTFT(const uint16_t page_index);
|
||||
static void lcdAudioSet(const bool audio_on);
|
||||
static void showAboutPage();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -121,7 +121,6 @@ namespace ExtUI {
|
||||
void onPostprocessSettings() {
|
||||
// Called after loading or resetting stored settings
|
||||
dgus.paramInit();
|
||||
dgus.powerLoss();
|
||||
}
|
||||
|
||||
void onSettingsStored(const bool success) {
|
||||
@@ -160,7 +159,7 @@ namespace ExtUI {
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Called when power-loss is enabled/disabled
|
||||
void onSetPowerLoss(const bool) { dgus.powerLoss(); }
|
||||
void onSetPowerLoss(const bool) { /* nothing to do */ }
|
||||
// Called when power-loss state is detected
|
||||
void onPowerLoss() { /* handled internally */ }
|
||||
// Called on resume from power-loss
|
||||
|
||||
@@ -69,7 +69,7 @@ void MKS_reset_settings() {
|
||||
{ 20, 20 }, { 20, 20 },
|
||||
{ X_CENTER, Y_CENTER }
|
||||
};
|
||||
mks_language_index = MKS_SimpleChinese;
|
||||
mks_language_index = MKS_English;
|
||||
COPY(mks_corner_offsets, init_dgus_level_offsets);
|
||||
mks_park_pos.set(20, 20, 10);
|
||||
mks_min_extrusion_temp = 0;
|
||||
|
||||
@@ -51,42 +51,22 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
if (event != LV_EVENT_RELEASED) return;
|
||||
switch (obj->mks_obj_id) {
|
||||
case ID_C_ADD:
|
||||
if (!editingFlowrate) {
|
||||
if (feedrate_percentage < MAX_EXT_SPEED_PERCENT - uiCfg.stepPrintSpeed)
|
||||
feedrate_percentage += uiCfg.stepPrintSpeed;
|
||||
else
|
||||
feedrate_percentage = MAX_EXT_SPEED_PERCENT;
|
||||
}
|
||||
if (!editingFlowrate)
|
||||
feedrate_percentage = _MIN(MAX_EXT_SPEED_PERCENT, feedrate_percentage + uiCfg.stepPrintSpeed);
|
||||
else {
|
||||
if (planner.flow_percentage[0] < MAX_EXT_SPEED_PERCENT - uiCfg.stepPrintSpeed)
|
||||
planner.flow_percentage[0] += uiCfg.stepPrintSpeed;
|
||||
else
|
||||
planner.flow_percentage[0] = MAX_EXT_SPEED_PERCENT;
|
||||
planner.refresh_e_factor(0);
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = planner.flow_percentage[0];
|
||||
planner.refresh_e_factor(1);
|
||||
#endif
|
||||
const int16_t new_flow = _MIN(MAX_EXT_SPEED_PERCENT, planner.flow_percentage[0] + uiCfg.stepPrintSpeed);
|
||||
planner.set_flow(0, new_flow);
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, new_flow));
|
||||
}
|
||||
disp_print_speed();
|
||||
break;
|
||||
case ID_C_DEC:
|
||||
if (!editingFlowrate) {
|
||||
if (feedrate_percentage > MIN_EXT_SPEED_PERCENT + uiCfg.stepPrintSpeed)
|
||||
feedrate_percentage -= uiCfg.stepPrintSpeed;
|
||||
else
|
||||
feedrate_percentage = MIN_EXT_SPEED_PERCENT;
|
||||
}
|
||||
if (!editingFlowrate)
|
||||
feedrate_percentage = _MAX(MIN_EXT_SPEED_PERCENT, feedrate_percentage + uiCfg.stepPrintSpeed);
|
||||
else {
|
||||
if (planner.flow_percentage[0] > MIN_EXT_SPEED_PERCENT + uiCfg.stepPrintSpeed)
|
||||
planner.flow_percentage[0] -= uiCfg.stepPrintSpeed;
|
||||
else
|
||||
planner.flow_percentage[0] = MIN_EXT_SPEED_PERCENT;
|
||||
planner.refresh_e_factor(0);
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = planner.flow_percentage[0];
|
||||
planner.refresh_e_factor(1);
|
||||
#endif
|
||||
const int16_t new_flow = _MAX(MIN_EXT_SPEED_PERCENT, planner.flow_percentage[0] - uiCfg.stepPrintSpeed);
|
||||
planner.set_flow(0, new_flow);
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, new_flow));
|
||||
}
|
||||
disp_print_speed();
|
||||
break;
|
||||
@@ -101,12 +81,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
disp_print_speed();
|
||||
break;
|
||||
case ID_C_STEP:
|
||||
if (uiCfg.stepPrintSpeed == 1)
|
||||
uiCfg.stepPrintSpeed = 5;
|
||||
else if (uiCfg.stepPrintSpeed == 5)
|
||||
uiCfg.stepPrintSpeed = 10;
|
||||
else
|
||||
uiCfg.stepPrintSpeed = 1;
|
||||
uiCfg.stepPrintSpeed = (uiCfg.stepPrintSpeed == 5) ? 10 : (uiCfg.stepPrintSpeed == 1) ? 5 : 1;
|
||||
disp_speed_step();
|
||||
break;
|
||||
case ID_C_RETURN:
|
||||
|
||||
@@ -102,12 +102,8 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
|
||||
card.openFileRead(cur_name);
|
||||
if (card.isFileOpen()) {
|
||||
feedrate_percentage = 100;
|
||||
planner.flow_percentage[0] = 100;
|
||||
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
|
||||
#endif
|
||||
TERN_(HAS_EXTRUDERS, planner.set_flow(0, 100));
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, 100));
|
||||
card.startOrResumeFilePrinting();
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
once_flag = false;
|
||||
|
||||
@@ -294,7 +294,7 @@ void setProBarRate() {
|
||||
lv_label_set_text(bar1ValueText, public_buf_l);
|
||||
lv_obj_align(bar1ValueText, bar1, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
if (marlin_state == MF_SD_COMPLETE) {
|
||||
if (marlin_state == MarlinState::MF_SD_COMPLETE) {
|
||||
if (once_flag == 0) {
|
||||
stop_print_time();
|
||||
|
||||
@@ -309,7 +309,7 @@ void setProBarRate() {
|
||||
if (gCfgItems.finish_power_off) {
|
||||
gcode.process_subcommands_now(F("M1001"));
|
||||
queue.inject(F("M81"));
|
||||
marlin_state = MF_RUNNING;
|
||||
marlin_state = MarlinState::MF_RUNNING;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -660,12 +660,8 @@ char *creat_title_text() {
|
||||
card.openFileRead(cur_name);
|
||||
if (card.isFileOpen()) {
|
||||
feedrate_percentage = 100;
|
||||
planner.flow_percentage[0] = 100;
|
||||
planner.e_factor[0] = planner.flow_percentage[0] * 0.01;
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01;
|
||||
#endif
|
||||
TERN_(HAS_EXTRUDERS, planner.set_flow(0, 100));
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, 100));
|
||||
card.startOrResumeFilePrinting();
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
once_flag = false;
|
||||
@@ -770,7 +766,7 @@ void GUI_RefreshPage() {
|
||||
disp_print_time();
|
||||
disp_fan_Zpos();
|
||||
}
|
||||
if (printing_rate_update_flag || marlin_state == MF_SD_COMPLETE) {
|
||||
if (printing_rate_update_flag || marlin_state == MarlinState::MF_SD_COMPLETE) {
|
||||
printing_rate_update_flag = false;
|
||||
if (!gcode_preview_over) setProBarRate();
|
||||
}
|
||||
|
||||
@@ -1011,14 +1011,8 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) {
|
||||
if (card.isFileOpen()) {
|
||||
//saved_feedrate_percentage = feedrate_percentage;
|
||||
feedrate_percentage = 100;
|
||||
#if HAS_EXTRUDERS
|
||||
planner.flow_percentage[0] = 100;
|
||||
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
|
||||
#endif
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
|
||||
#endif
|
||||
TERN_(HAS_EXTRUDERS, planner.set_flow(0, 100));
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, 100));
|
||||
card.startOrResumeFilePrinting();
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
once_flag = false;
|
||||
|
||||
@@ -765,6 +765,24 @@ namespace ExtUI {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_SHAPING
|
||||
float getShapingZeta(const axis_t axis) {
|
||||
return stepper.get_shaping_damping_ratio(AxisEnum(axis));
|
||||
}
|
||||
void setShapingZeta(const float zeta, const axis_t axis) {
|
||||
if (!WITHIN(zeta, 0, 1)) return;
|
||||
stepper.set_shaping_damping_ratio(AxisEnum(axis), zeta);
|
||||
}
|
||||
float getShapingFrequency(const axis_t axis) {
|
||||
return stepper.get_shaping_frequency(AxisEnum(axis));
|
||||
}
|
||||
void setShapingFrequency(const float freq, const axis_t axis) {
|
||||
constexpr float min_freq = float(uint32_t(STEPPER_TIMER_RATE) / 2) / shaping_time_t(-2);
|
||||
if (freq == 0.0f || freq > min_freq)
|
||||
stepper.set_shaping_frequency(AxisEnum(axis), freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_JUNCTION_DEVIATION
|
||||
|
||||
float getJunctionDeviation_mm() { return planner.junction_deviation_mm; }
|
||||
@@ -933,6 +951,7 @@ namespace ExtUI {
|
||||
#if HAS_BED_PROBE
|
||||
float getProbeOffset_mm(const axis_t axis) { return probe.offset.pos[axis]; }
|
||||
void setProbeOffset_mm(const_float_t val, const axis_t axis) { probe.offset.pos[axis] = val; }
|
||||
probe_limits_t getBedProbeLimits() { return probe_limits_t({ probe.min_x(), probe.min_y(), probe.max_x(), probe.max_y() }); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
@@ -1200,7 +1219,7 @@ namespace ExtUI {
|
||||
void onSurviveInKilled() {
|
||||
thermalManager.disable_all_heaters();
|
||||
flags.printer_killed = 0;
|
||||
marlin_state = MF_RUNNING;
|
||||
marlin_state = MarlinState::MF_RUNNING;
|
||||
//SERIAL_ECHOLNPGM("survived at: ", millis());
|
||||
}
|
||||
|
||||
@@ -1260,6 +1279,9 @@ namespace ExtUI {
|
||||
#if DISABLED(HAS_DWIN_E3V2)
|
||||
void MarlinUI::init_lcd() { ExtUI::onStartup(); }
|
||||
|
||||
void MarlinUI::clear_lcd() {}
|
||||
void MarlinUI::clear_for_drawing() {}
|
||||
|
||||
void MarlinUI::update() { ExtUI::onIdle(); }
|
||||
|
||||
void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const component) {
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace ExtUI {
|
||||
#if ENABLED(MPC_AUTOTUNE)
|
||||
enum mpcresult_t : uint8_t { MPC_STARTED, MPC_TEMP_ERROR, MPC_INTERRUPTED, MPC_DONE };
|
||||
#endif
|
||||
struct probe_limits_t { float xmin, ymin, xmax, ymax; };
|
||||
|
||||
constexpr uint8_t extruderCount = EXTRUDERS;
|
||||
constexpr uint8_t hotendCount = HOTENDS;
|
||||
@@ -327,6 +328,13 @@ namespace ExtUI {
|
||||
void setLinearAdvance_mm_mm_s(const_float_t, const extruder_t);
|
||||
#endif
|
||||
|
||||
#if HAS_SHAPING
|
||||
float getShapingZeta(const axis_t);
|
||||
void setShapingZeta(const float, const axis_t);
|
||||
float getShapingFrequency(const axis_t);
|
||||
void setShapingFrequency(const float, const axis_t);
|
||||
#endif
|
||||
|
||||
// JD or Jerk Control
|
||||
#if HAS_JUNCTION_DEVIATION
|
||||
float getJunctionDeviation_mm();
|
||||
@@ -367,6 +375,7 @@ namespace ExtUI {
|
||||
#if HAS_BED_PROBE
|
||||
float getProbeOffset_mm(const axis_t);
|
||||
void setProbeOffset_mm(const_float_t, const axis_t);
|
||||
probe_limits_t getBedProbeLimits();
|
||||
#endif
|
||||
|
||||
// Backlash Control
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user