Skip to content

Commit f3876e8

Browse files
committed
Creality CR-6 source code dump from CR-6 SE -source code V1.0.3.6.rar
As downloadable currently from Creality.com. It appears the source code has been based on 25a7cea. Using a cycle of 'git reset', 'git clean', copying over the files, doing a normalize (because the line endings were messed up), then checking for the origin of the changes, I could not trace it back much farther than this commit. This commit is like e95395f but with the odd files like the .github files excluded. It is almost like Creality took the latest 1.x source codes files and half plastered their changes over it - or they might have backported specific changes from the latest Marlin sources back to this code?
1 parent 25a7cea commit f3876e8

40 files changed

+3510
-176
lines changed

Marlin/Configuration.h

Lines changed: 96 additions & 69 deletions
Large diffs are not rendered by default.

Marlin/Configuration_adv.h

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
* THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD
138138
*/
139139
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
140-
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
140+
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
141141
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
142142

143143
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
@@ -157,21 +157,21 @@
157157
* and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set
158158
* below 2.
159159
*/
160-
#define WATCH_TEMP_PERIOD 20 // Seconds
160+
#define WATCH_TEMP_PERIOD 60 // Seconds
161161
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius
162162
#endif
163163

164164
/**
165165
* Thermal Protection parameters for the bed are just as above for hotends.
166166
*/
167167
#if ENABLED(THERMAL_PROTECTION_BED)
168-
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
168+
#define THERMAL_PROTECTION_BED_PERIOD 180 // Seconds
169169
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
170170

171171
/**
172172
* As described above, except for the bed (M140/M190/M303).
173173
*/
174-
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
174+
#define WATCH_BED_TEMP_PERIOD 180 // Seconds
175175
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
176176
#endif
177177

@@ -355,7 +355,7 @@
355355
*
356356
* Define one or both of these to override the default 0-255 range.
357357
*/
358-
//#define FAN_MIN_PWM 50
358+
#define FAN_MIN_PWM 50
359359
//#define FAN_MAX_PWM 128
360360

361361
/**
@@ -608,7 +608,7 @@
608608

609609
// Feature: Switch into SW mode after a deploy. It makes the output pulse longer. Can be useful
610610
// in special cases, like noisy or filtered input configurations.
611-
//#define BLTOUCH_FORCE_SW_MODE
611+
// #define BLTOUCH_FORCE_SW_MODE
612612

613613
/**
614614
* Settings for BLTouch Smart 3.0 and 3.1
@@ -902,8 +902,9 @@
902902
// Change values more rapidly when the encoder is rotated faster
903903
#define ENCODER_RATE_MULTIPLIER
904904
#if ENABLED(ENCODER_RATE_MULTIPLIER)
905-
#define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed
906-
#define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed
905+
#define ENCODER_5X_STEPS_PER_SEC 30
906+
#define ENCODER_10X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 10x speed
907+
#define ENCODER_100X_STEPS_PER_SEC 130 // (steps/s) Encoder rate for 100x speed
907908
#endif
908909

909910
// Play a beep when the feedrate is changed from the Status Screen
@@ -998,7 +999,7 @@
998999

9991000
//#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files
10001001

1001-
#define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27")
1002+
#define EVENT_GCODE_SD_STOP "G28XY\nM84" // G-code to run on Stop Print (e.g., "G28XY" or "G27")
10021003

10031004
/**
10041005
* Continue after Power-Loss (Creality3D)
@@ -1008,7 +1009,7 @@
10081009
* an option on the LCD screen to continue the print from the last-known
10091010
* point in the file.
10101011
*/
1011-
//#define POWER_LOSS_RECOVERY
1012+
#define POWER_LOSS_RECOVERY
10121013
#if ENABLED(POWER_LOSS_RECOVERY)
10131014
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
10141015
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
@@ -1366,12 +1367,12 @@
13661367
*
13671368
* Warning: Does not respect endstops!
13681369
*/
1369-
//#define BABYSTEPPING
1370+
#define BABYSTEPPING
13701371
#if ENABLED(BABYSTEPPING)
13711372
//#define BABYSTEP_WITHOUT_HOMING
13721373
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
13731374
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
1374-
#define BABYSTEP_MULTIPLICATOR_Z 1 // Babysteps are very small. Increase for faster motion.
1375+
#define BABYSTEP_MULTIPLICATOR_Z 40 // Babysteps are very small. Increase for faster motion.
13751376
#define BABYSTEP_MULTIPLICATOR_XY 1
13761377

13771378
//#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
@@ -1387,7 +1388,9 @@
13871388

13881389
//#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28
13891390

1390-
//#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
1391+
#if HAS_BED_PROBE
1392+
#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
1393+
#endif
13911394
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
13921395
//#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
13931396
//#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
@@ -1488,7 +1491,7 @@
14881491
//
14891492
// G2/G3 Arc Support
14901493
//
1491-
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
1494+
// #define ARC_SUPPORT // Disable this feature to save ~3226 bytes
14921495
#if ENABLED(ARC_SUPPORT)
14931496
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
14941497
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
@@ -1529,8 +1532,8 @@
15291532
*
15301533
* Override the default value based on the driver type set in Configuration.h.
15311534
*/
1532-
//#define MINIMUM_STEPPER_POST_DIR_DELAY 650
1533-
//#define MINIMUM_STEPPER_PRE_DIR_DELAY 650
1535+
// #define MINIMUM_STEPPER_POST_DIR_DELAY 30
1536+
// #define MINIMUM_STEPPER_PRE_DIR_DELAY 30
15341537

15351538
/**
15361539
* Minimum stepper driver pulse width (in µs)

Marlin/Version.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,20 @@
2525
// VENDOR VERSION EXAMPLE //
2626
////////////////////////////
2727

28+
#define MACHINE_SIZE "235x235x250"
29+
#define CORP_WEBSITE_C "www.cxsw3d.com"
30+
#define CORP_WEBSITE_E "www.creality.com"
31+
2832
/**
2933
* Marlin release version identifier
3034
*/
31-
//#define SHORT_BUILD_VERSION "bugfix-2.0.x"
35+
#define SHORT_BUILD_VERSION "Ver 1.0.3.6"
3236

3337
/**
3438
* Verbose version identifier which should contain a reference to the location
3539
* from where the binary was downloaded or the source code was compiled.
3640
*/
37-
//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (Github)"
41+
#define DETAILED_BUILD_VERSION "Creality 3D"
3842

3943
/**
4044
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
@@ -46,26 +50,26 @@
4650
/**
4751
* Defines a generic printer name to be output to the LCD after booting Marlin.
4852
*/
49-
//#define MACHINE_NAME "3D Printer"
53+
#define MACHINE_NAME "CR-6 SE"
5054

5155
/**
5256
* The SOURCE_CODE_URL is the location where users will find the Marlin Source
5357
* Code which is installed on the device. In most cases —unless the manufacturer
5458
* has a distinct Github fork— the Source Code URL should just be the main
5559
* Marlin repository.
5660
*/
57-
//#define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin"
61+
#define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin"
5862

5963
/**
6064
* Default generic printer UUID.
6165
*/
62-
//#define DEFAULT_MACHINE_UUID "cede2a2f-41a2-4748-9b12-c55c62f367ff"
66+
#define DEFAULT_MACHINE_UUID "cede2a2f-41a2-4748-9b12-c55c62f367ff"
6367

6468
/**
6569
* The WEBSITE_URL is the location where users can get more information such as
6670
* documentation about a specific Marlin release.
6771
*/
68-
//#define WEBSITE_URL "http://marlinfw.org"
72+
#define WEBSITE_URL "www.creality.com"
6973

7074
/**
7175
* Set the vendor info the serial USB interface, if changable

Marlin/src/HAL/HAL_STM32F1/sdio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
#define SDIO_DATA_TIMEOUT 100U /* Read data transfer timeout */
101101
#define SDIO_WRITE_TIMEOUT 200U /* Write data transfer timeout */
102102

103-
#define SDIO_CLOCK 18000000 /* 18 MHz */
103+
#define SDIO_CLOCK 6000000 /* 18 MHz */
104104

105105
// ------------------------
106106
// Types

Marlin/src/HAL/HAL_STM32F1/timers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ typedef uint16_t hal_timer_t;
4545
#define HAL_TIMER_RATE uint32_t(F_CPU) // frequency of timers peripherals
4646

4747
#define STEP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
48-
#define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
48+
#define TEMP_TIMER_CHAN 4 // Channel of the timer to use for compare and interrupts
4949

5050
/**
5151
* Note: Timers may be used by platforms and libraries

Marlin/src/HAL/HAL_STM32F1/watchdog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void watchdogSetup() {
5252
* @details The watchdog clock is 40Khz. We need a 4 seconds interval, so use a /256 preescaler and 625 reload value (counts down to 0)
5353
*/
5454
void watchdog_init() {
55-
//iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
55+
iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
5656
}
5757

5858
#endif // USE_WATCHDOG

Marlin/src/HAL/HAL_STM32F1/watchdog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* 625 reload value (counts down to 0)
3333
* use 1250 for 8 seconds
3434
*/
35-
#define STM32F1_WD_RELOAD 625
35+
#define STM32F1_WD_RELOAD 1250
3636

3737
// Arduino STM32F1 core now has watchdog support
3838

Marlin/src/Marlin.cpp

Lines changed: 93 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030

3131
#include "Marlin.h"
3232

33+
#ifdef DWIN_LCDDISPLAY
34+
// DWIN file
35+
#include "lcd/dwin/dwin.h"
36+
#include "lcd/dwin/dwin_lcd.h"
37+
#include "lcd/dwin/rotary_encoder.h"
38+
#include "lcd/dwin/i2c_eeprom.h"
39+
#elif ENABLED(RTS_AVAILABLE)
40+
#include "lcd/dwin/LCD_RTS.h"
41+
#include "lcd/dwin/i2c_eeprom.h"
42+
#endif
43+
3344
#include "core/utility.h"
3445
#include "lcd/ultralcd.h"
3546
#include "module/motion.h"
@@ -442,7 +453,15 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
442453
if (max_inactive_time && ELAPSED(ms, gcode.previous_move_ms + max_inactive_time)) {
443454
SERIAL_ERROR_START();
444455
SERIAL_ECHOLNPAIR(MSG_KILL_INACTIVE_TIME, parser.command_ptr);
445-
kill();
456+
#ifdef RTS_AVAILABLE
457+
waitway = 0;
458+
rtscheck.RTS_SndData(ExchangePageBase + 62, ExchangepageAddr);
459+
change_page_font = 62;
460+
rtscheck.RTS_SndData(Error_201, ABNORMAL_TEXT_VP);
461+
errorway = 1;
462+
#else
463+
kill();
464+
#endif
446465
}
447466

448467
// Prevent steppers timing-out in the middle of M600
@@ -455,7 +474,9 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
455474
if (stepper_inactive_time) {
456475
static bool already_shutdown_steppers; // = false
457476
if (planner.has_blocks_queued())
477+
{
458478
gcode.reset_stepper_timeout();
479+
}
459480
else if (MOVE_AWAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
460481
if (!already_shutdown_steppers) {
461482
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
@@ -653,7 +674,30 @@ void idle(
653674
max7219.idle_tasks();
654675
#endif
655676

656-
ui.update();
677+
#ifdef DWIN_LCDDISPLAY
678+
DWIN_Update();
679+
#elif ENABLED(RTS_AVAILABLE)
680+
RTSUpdate();
681+
#else
682+
ui.update();
683+
#endif
684+
#if ENABLED(FIX_MOUNTED_PROBE)
685+
if((IS_SD_PRINTING() == true) && home_flag == false) // printing and no homing
686+
{
687+
endstops.enable_z_probe(false);
688+
}
689+
#endif
690+
691+
#if ENABLED(FIX_MOUNTED_PROBE)
692+
if((0 == READ(OPTO_SWITCH_PIN)) && (home_flag == true))
693+
{
694+
endstops.enable_z_probe(true);
695+
delay(100);
696+
WRITE(COM_PIN, 0);
697+
delay(200);
698+
WRITE(COM_PIN, 1);
699+
}
700+
#endif
657701

658702
#if ENABLED(HOST_KEEPALIVE_FEATURE)
659703
gcode.host_keepalive();
@@ -932,9 +976,17 @@ void setup() {
932976
leds.setup();
933977
#endif
934978

935-
ui.init();
936-
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
937-
ui.show_bootscreen();
979+
#ifdef DWIN_LCDDISPLAY
980+
delay(800); // wait stabillze dalay
981+
if(DWIN_ShakeHand()) SERIAL_ECHOLN("\r\nDwin shake hand ok.");
982+
else SERIAL_ECHOLN("\r\nDwin shake hand error.");
983+
DWIN_Frame_SetDir(1);
984+
DWIN_UpdateLCD(); // show bootscreen ( first picture )
985+
#else
986+
ui.init();
987+
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
988+
ui.show_bootscreen();
989+
#endif
938990
#endif
939991

940992
#if ENABLED(SDSUPPORT)
@@ -961,7 +1013,7 @@ void setup() {
9611013

9621014
print_job_timer.init(); // Initial setup of print job timer
9631015

964-
ui.reset_status(); // Print startup message after print statistics are loaded
1016+
// ui.reset_status(); // Print startup message after print statistics are loaded
9651017

9661018
endstops.init(); // Init endstops and pullups
9671019

@@ -1086,10 +1138,6 @@ void setup() {
10861138
est_init();
10871139
#endif
10881140

1089-
#if ENABLED(POWER_LOSS_RECOVERY)
1090-
recovery.check();
1091-
#endif
1092-
10931141
#if ENABLED(USE_WATCHDOG)
10941142
watchdog_init(); // Reinit watchdog after HAL_get_reset_source call
10951143
#endif
@@ -1117,6 +1165,41 @@ void setup() {
11171165
#if ENABLED(PRUSA_MMU2)
11181166
mmu2.init();
11191167
#endif
1168+
1169+
#if HAS_COLOR_LEDS
1170+
leds.set_color(LEDColorWhite());
1171+
#endif
1172+
1173+
#ifdef MYI2C_EEPROM
1174+
BL24CXX_Init();
1175+
if(BL24CXX_Check()) // no found I2C_EEPROM
1176+
SERIAL_ECHOLN("I2C_EEPROM Check Failed!");
1177+
else
1178+
SERIAL_ECHOLN("I2C_EEPROM Check Successed!");
1179+
#endif
1180+
1181+
#if ENABLED(POWER_LOSS_RECOVERY)
1182+
recovery.check();
1183+
#endif
1184+
1185+
#ifdef DWIN_LCDDISPLAY
1186+
1187+
// dwin init
1188+
Encoder_Configuration();
1189+
HMI_Init();
1190+
HMI_StartFrame();
1191+
1192+
#elif ENABLED(RTS_AVAILABLE)
1193+
1194+
rtscheck.RTS_Init();
1195+
#ifdef FIX_MOUNTED_PROBE
1196+
OUT_WRITE(COM_PIN, 1);
1197+
SET_INPUT(CHECK_MATWEIAL);
1198+
SET_INPUT(OPTO_SWITCH_PIN);
1199+
OUT_WRITE(LED_CONTROL_PIN, 0);
1200+
#endif
1201+
1202+
#endif
11201203
}
11211204

11221205
/**

Marlin/src/core/boards.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@
278278
#define BOARD_FYSETC_CHEETAH 4016 // FYSETC Cheetah
279279
#define BOARD_FYSETC_CHEETAH_V12 4017 // FYSETC Cheetah V1.2
280280
#define BOARD_LONGER3D_LK 4018 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
281+
#define BOARD_CREALITY 4019 // Creality (STM32F103RE)
281282

282283
//
283284
// ARM Cortex-M4F

Marlin/src/core/serial.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extern uint8_t marlin_debug_flags;
5353
#define _PORT_RESTORE(n) RESTORE(n)
5454
#define SERIAL_OUT(WHAT, V...) do{ \
5555
if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(V); \
56-
if ( serial_port_index) (void)MYSERIAL1.WHAT(V); \
56+
if ( serial_port_index) (void)MYSERIAL0.WHAT(V); \
5757
}while(0)
5858
#define SERIAL_ASSERT(P) if(serial_port_index!=(P)){ debugger(); }
5959
#else

0 commit comments

Comments
 (0)