Skip to content

Commit

Permalink
September 2024 (20240917)
Browse files Browse the repository at this point in the history
Preliminary support for CREALITY_CR4NS (GD32F303RET6) board
Sets meshViewer.meshfont on load settings Fix #1291
Sanity check GRID_MAX_POINTS_X/Y
Check hardware compatibility with ProUI libraries
Correction of minor typing errors
  • Loading branch information
mriscoc committed Sep 17, 2024
1 parent 7da6459 commit 404e13a
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 20 deletions.
3 changes: 3 additions & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@
#define BOARD_VOXELAB_AQUILA 5071 // Voxelab Aquila V1.0.0/V1.0.1 (GD32F103RC / N32G455RE / STM32F103RE)
#define BOARD_SPRINGER_CONTROLLER 5072 // ORCA 3D SPRINGER Modular Controller (STM32F103VC)

// Preliminary support for Creality Ender-3 V3 SE
#define BOARD_CREALITY_CR4NS 5099 // Creality CR4NS200320C13 (GD32F303RET6) as found in the Ender-3 V3 SE

//
// ARM Cortex-M4F
//
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ void unified_bed_leveling::shift_mesh_height() {
#endif

#if PROUI_EX
if (proUIEx.quitLeveling()) return TERN(DWIN_LCD_PROIU, dwinLevelingDone(), proUIEx.levelingDone());
if (proUIEx.quitLeveling()) return TERN(DWIN_LCD_PROUI, dwinLevelingDone(), proUIEx.levelingDone());
#endif

// do_furthest is normally false
Expand Down
24 changes: 12 additions & 12 deletions Marlin/src/lcd/e3v2/common/dwin_color.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
*/
#pragma once

#define RGB(R,G,B) (R << 11) | (G << 5) | (B) // R,B: 0..31; G: 0..63
#define RGB(R,G,B) ((R << 11) | (G << 5) | (B)) // R,B: 0..31; G: 0..63
#define GetRColor(color) ((color >> 11) & 0x1F)
#define GetGColor(color) ((color >> 5) & 0x3F)
#define GetBColor(color) ((color >> 0) & 0x1F)

// Default Colors
#define COLOR_WHITE 0xFFFF
#define COLOR_YELLOW RGB(0x1F,0x3F,0x00)
#define COLOR_RED RGB(0x1F,0x00,0x00)
#define COLOR_YELLOW RGB(0x1F, 0x3F, 0x00)
#define COLOR_RED RGB(0x1F, 0x00, 0x00)
#define COLOR_ERROR_RED 0xB000 // Error!
#define COLOR_BG_RED 0xF00F // Red background color
#define COLOR_BG_WINDOW 0x31E8 // Popup background color
Expand All @@ -45,17 +45,17 @@

// Extended Colors
#define COLOR_BLACK 0
#define COLOR_GREEN RGB(0,63,0)
#define COLOR_AQUA RGB(0,63,31)
#define COLOR_BLUE RGB(0,0,31)
#define COLOR_GREEN RGB(0, 63, 0)
#define COLOR_AQUA RGB(0, 63, 31)
#define COLOR_BLUE RGB(0, 0, 31)
#define COLOR_LIGHT_WHITE 0xBDD7
#define COLOR_LIGHT_GREEN 0x3460
#define COLOR_CYAN 0x07FF
#define COLOR_LIGHT_CYAN 0x04F3
#define COLOR_LIGHT_BLUE 0x3A6A
#define COLOR_MAGENTA 0xF81F
#define COLOR_LIGHT_MAGENTA 0x9813
#define COLOR_LIGHT_RED RGB(31,31,15)
#define COLOR_LIGHT_RED RGB(31, 31, 15)
#define COLOR_ORANGE 0xFA20
#define COLOR_LIGHT_ORANGE 0xFBC0
#define COLOR_LIGHT_YELLOW 0x8BE0
Expand All @@ -64,15 +64,15 @@
#define COLOR_GREY 0x18E3

// Default UI Colors
#define defColorBackground RGB( 0, 8, 6)
#define defColorBackground RGB(0, 8, 6)
#define defColorCursor RGB(20, 49, 31)
#define defColorTitleBg RGB( 0, 23, 16)
#define defColorTitleBg RGB(0, 23, 16)
#define defColorTitleTxt COLOR_WHITE
#define defColorText COLOR_WHITE
#define defColorSelected COLOR_SELECT
#define defColorSplitLine RGB( 0, 23, 16)
#define defColorSplitLine RGB(0, 23, 16)
#define defColorHighlight COLOR_WHITE
#define defColorStatusBg RGB( 0, 23, 16)
#define defColorStatusBg RGB(0, 23, 16)
#define defColorStatusTxt COLOR_YELLOW
#define defColorPopupBg COLOR_BG_WINDOW
#define defColorPopupTxt COLOR_POPUP_TEXT
Expand All @@ -82,4 +82,4 @@
#define defColorBarfill COLOR_BARFILL
#define defColorIndicator COLOR_WHITE
#define defColorCoordinate COLOR_WHITE
#define defColorButton RGB( 0, 23, 16)
#define defColorButton RGB(0, 23, 16)
9 changes: 7 additions & 2 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1996,7 +1996,12 @@ void MarlinSettings::postprocess() {
const char proui_data[proUIEx.eeprom_data_size] = { 0 };
_FIELD_TEST(proui_data);
EEPROM_READ(proui_data);
if (!validating) proUIEx.copySettingsFrom(proui_data);
if (!validating) {
proUIEx.copySettingsFrom(proui_data);
#if ALL(DWIN_LCD_PROUI, HAS_MESH)
meshViewer.meshfont = TERN(TJC_DISPLAY, font8x16, font6x12);
#endif
}
#if ALL(DWIN_LCD_PROUI, HAS_MESH)
EEPROM_READ(meshViewer.meshmode);
#endif
Expand Down Expand Up @@ -2058,7 +2063,7 @@ void MarlinSettings::postprocess() {

#if HAS_SCARA_OFFSET
EEPROM_READ(scara_home_offset);
#elsif HAS_HOME_OFFSET
#elif HAS_HOME_OFFSET
EEPROM_READ(home_offset);
#endif
}
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@
#include "gd32f1/pins_VOXELAB_AQUILA.h" // GD32F1, N32G4, STM32F1 env:GD32F103RC_voxelab_maple env:N32G455RE_voxelab_maple env:STM32F103RE_creality_maple env:STM32F103RE_creality env:GD32F103RE_voxelab env:GD32F103RC_voxelab env:GD32F103RE_voxelab_maple
#elif MB(SPRINGER_CONTROLLER)
#include "stm32f1/pins_ORCA_3D_SPRINGER.h" // STM32F1 env:STM32F103VC_orca3d
#elif MB(CREALITY_CR4NS)
#include "stm32f1/pins_CREALITY_CR4NS.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_maple

//
// ARM Cortex-M4F
Expand Down
158 changes: 158 additions & 0 deletions Marlin/src/pins/stm32f1/pins_CREALITY_CR4NS.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once

/**
* Creality CREALITY_CR4NS (GD32F303RET6) board pin assignments
* Sold as "Creality Ender-3 V3 SE CR4NS200320C13 Motherboard"
* Preliminary support for the Professional Firmwware
*/

#include "env_validate.h"

#if HOTENDS > 1 || E_STEPPERS > 1
#error "CR4NS200320C13 only supports one hotend / E-stepper."
#endif

// Is E0_DRIVER_TYPE TMC2208_STANDALONE?
// #if !AXIS_DRIVER_TYPE_X(TMC2208) || !AXIS_DRIVER_TYPE_Y(TMC2208) || !AXIS_DRIVER_TYPE_Z(TMC2208) || !AXIS_DRIVER_TYPE_E0(?)
// #error "This board has onboard TMC2208 drivers for X, Y, Z, and E0."
// #endif

#ifndef BOARD_INFO_NAME
#define BOARD_INFO_NAME "CR4NS200320C13"
#endif
#ifndef DEFAULT_MACHINE_NAME
#define DEFAULT_MACHINE_NAME "Ender-3 V3 SE"
#endif
#define BOARD_WEBSITE_URL "www.creality.com"

#define BOARD_NO_NATIVE_USB

//
// EEPROM
//
//#if NO_EEPROM_SELECTED
#define IIC_BL24CXX_EEPROM // EEPROM on I2C-0
// #define SDCARD_EEPROM_EMULATION
//#endif

#if ENABLED(IIC_BL24CXX_EEPROM)
#define IIC_EEPROM_SDA PA7
#define IIC_EEPROM_SCL PA8
#define MARLIN_EEPROM_SIZE 0x800 // 2Kb (24C16)
#elif ENABLED(SDCARD_EEPROM_EMULATION)
#define MARLIN_EEPROM_SIZE 0x800 // 2Kb
#endif

//
// Servos
//
#ifndef SERVO0_PIN
#define SERVO0_PIN PC13 // BLTouch OUT
#endif

#ifndef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN PC14 // BLTouch IN
#endif

//
// Limit Switches
//
#define X_STOP_PIN PA5
#define Y_STOP_PIN PA6

#ifndef Z_STOP_PIN
#define Z_STOP_PIN PA15
#endif

//
// Filament Runout Sensor
//
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN PC15 // "Pulled-high"
#endif

//
// Heaters / Fans
//
#define HEATER_0_PIN PA1 // HEATER1
#define HEATER_BED_PIN PB2 // HOT BED
#define FAN1_PIN PC1 // extruder fan
// #define FAN2_PIN PB1 // Controller fan FET

//
// Auto fans
//
// #ifndef CONTROLLER_FAN_PIN
// #define CONTROLLER_FAN_PIN FAN2_PIN
// #endif

#if HAS_TMC_UART
// Reduce baud rate to improve software serial reliability
#define TMC_BAUD_RATE 19200

// Software serial
#define X_SERIAL_TX_PIN PB12
#define X_SERIAL_RX_PIN X_SERIAL_TX_PIN

#define Y_SERIAL_TX_PIN PB13
#define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN

#define Z_SERIAL_TX_PIN PB14
#define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN

#endif // HAS_TMC_UART

#if ANY(RET6_12864_LCD, HAS_DWIN_E3V2, IS_DWIN_MARLINUI)

/**
* LCD PIN OUT
* ------
* NC | 1 2 | NC
* RX | 3 4 | TX
* EN 5 6 | BEEP
* B | 7 8 | A
* GND | 9 10 | +5V
* ------
*/
#define EXP3_01_PIN -1
#define EXP3_02_PIN -1
#define EXP3_03_PIN PA2
#define EXP3_04_PIN PA3
#define EXP3_05_PIN PB1
#define EXP3_06_PIN PB0
#define EXP3_07_PIN PA12
#define EXP3_08_PIN PA11

#ifndef BEEPER_PIN
#define BEEPER_PIN EXP1_06_PIN // BEEP
#endif

#define BTN_ENC EXP1_05_PIN // EN
#define BTN_EN1 EXP1_08_PIN // A
#define BTN_EN2 EXP1_07_PIN // B

#endif


#include "pins_CREALITY_V4.h"
10 changes: 9 additions & 1 deletion Marlin/src/prouiex/proui_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#if HAS_PROUI_MAXTEMP && DISABLED(HAS_HOTEND)
#error "HAS_PROUI_MAXTEMP requires HAS_HOTEND."
#endif
#if (GRID_MAX_POINTS_X) > 9 || (GRID_MAX_POINTS_Y) > 9
#error "GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y must be less than 10 for PROUI_EX."
#endif


#include "../core/types.h"

Expand Down Expand Up @@ -126,7 +130,11 @@ typedef struct { // Do not change this data structure
int16_t x_max_pos = DEF_X_MAX_POS;
int16_t y_max_pos = DEF_Y_MAX_POS;
int16_t z_max_pos = DEF_Z_MAX_POS;
float probezfix = TERN0(DEF_PROBEZFIX,DEF_PROBEZFIX);
#ifdef DEF_PROBEZFIX
float probezfix = DEF_PROBEZFIX;
#else
float probezfix = 0;
#endif
uint16_t zprobefeedslow = DEF_Z_PROBE_FEEDRATE_SLOW;
uint8_t multiple_probing = MULTIPLE_PROBING;
bool Invert_E0 = DEF_INVERT_E0_DIR;
Expand Down
14 changes: 11 additions & 3 deletions buildroot/share/PlatformIO/scripts/proui.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ------------------------------------------------------------------------------
# VSCode script for the Professional Firmware
# URL: https://github.com/mriscoc/Marlin_Ender3v2/releases
# Version: 3.1
# Date: 2023/10/28
# Version: 3.2
# Date: 2024/07/17
# Author: Miguel Risco-Castillo
# ------------------------------------------------------------------------------

Expand Down Expand Up @@ -78,4 +78,12 @@ def _GetMarlinEnv(marlinEnv, feature):
#Copy correct library file
if prouiex or dwin:
print('ProUI detected')
shutil.copy(libpath+arch+'libproui_'+lev+'_'+ui+'.a', libfile)
libdestfile = libpath+arch+'libproui_'+lev+'_'+ui+'.a'

if os.path.exists(libdestfile):
shutil.copy(libdestfile, libfile)
else:
print ("Library file not found, possibly unsupported hardware configuration")
exit()


Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C" {
#define PA0 PIN_A0 // | 0 | A0 | | | | |
#define PA1 PIN_A1 // | 1 | A1 | | | | |
#define PA2 PIN_A2 // | 2 | A2 | USART2_TX | | | |
#define PA3 PIN_A3 // | 2 | A2, DAC_OUT1** | USART2_RX | | | |
#define PA3 PIN_A3 // | 3 | A3, DAC_OUT1** | USART2_RX | | | |
#define PA4 PIN_A4 // | 4 | A4, DAC_OUT2** | | | SPI1_SS | |
#define PA5 PIN_A5 // | 5 | A5 | | | SPI1_SCK | |
#define PA6 PIN_A6 // | 6 | A6 | | | SPI1_MISO | |
Expand Down
Binary file removed screenshots/probe-settings-3.jpg
Binary file not shown.

0 comments on commit 404e13a

Please sign in to comment.