Skip to content

Commit

Permalink
Creality CR-6 source code dump from CR-6 SE -source code V1.0.3.6.rar
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
Sebazzz committed Sep 20, 2020
1 parent 25a7cea commit f3876e8
Show file tree
Hide file tree
Showing 40 changed files with 3,510 additions and 176 deletions.
165 changes: 96 additions & 69 deletions Marlin/Configuration.h

Large diffs are not rendered by default.

35 changes: 19 additions & 16 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
* THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD
*/
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius

//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
Expand All @@ -157,21 +157,21 @@
* and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set
* below 2.
*/
#define WATCH_TEMP_PERIOD 20 // Seconds
#define WATCH_TEMP_PERIOD 60 // Seconds
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius
#endif

/**
* Thermal Protection parameters for the bed are just as above for hotends.
*/
#if ENABLED(THERMAL_PROTECTION_BED)
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_BED_PERIOD 180 // Seconds
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius

/**
* As described above, except for the bed (M140/M190/M303).
*/
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
#define WATCH_BED_TEMP_PERIOD 180 // Seconds
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
#endif

Expand Down Expand Up @@ -355,7 +355,7 @@
*
* Define one or both of these to override the default 0-255 range.
*/
//#define FAN_MIN_PWM 50
#define FAN_MIN_PWM 50
//#define FAN_MAX_PWM 128

/**
Expand Down Expand Up @@ -608,7 +608,7 @@

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

/**
* Settings for BLTouch Smart 3.0 and 3.1
Expand Down Expand Up @@ -902,8 +902,9 @@
// Change values more rapidly when the encoder is rotated faster
#define ENCODER_RATE_MULTIPLIER
#if ENABLED(ENCODER_RATE_MULTIPLIER)
#define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed
#define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed
#define ENCODER_5X_STEPS_PER_SEC 30
#define ENCODER_10X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 10x speed
#define ENCODER_100X_STEPS_PER_SEC 130 // (steps/s) Encoder rate for 100x speed
#endif

// Play a beep when the feedrate is changed from the Status Screen
Expand Down Expand Up @@ -998,7 +999,7 @@

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

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

/**
* Continue after Power-Loss (Creality3D)
Expand All @@ -1008,7 +1009,7 @@
* an option on the LCD screen to continue the print from the last-known
* point in the file.
*/
//#define POWER_LOSS_RECOVERY
#define POWER_LOSS_RECOVERY
#if ENABLED(POWER_LOSS_RECOVERY)
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
Expand Down Expand Up @@ -1366,12 +1367,12 @@
*
* Warning: Does not respect endstops!
*/
//#define BABYSTEPPING
#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
//#define BABYSTEP_WITHOUT_HOMING
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
#define BABYSTEP_MULTIPLICATOR_Z 1 // Babysteps are very small. Increase for faster motion.
#define BABYSTEP_MULTIPLICATOR_Z 40 // Babysteps are very small. Increase for faster motion.
#define BABYSTEP_MULTIPLICATOR_XY 1

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

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

//#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
#if HAS_BED_PROBE
#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
#endif
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
//#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
//#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
Expand Down Expand Up @@ -1488,7 +1491,7 @@
//
// G2/G3 Arc Support
//
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
// #define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
Expand Down Expand Up @@ -1529,8 +1532,8 @@
*
* Override the default value based on the driver type set in Configuration.h.
*/
//#define MINIMUM_STEPPER_POST_DIR_DELAY 650
//#define MINIMUM_STEPPER_PRE_DIR_DELAY 650
// #define MINIMUM_STEPPER_POST_DIR_DELAY 30
// #define MINIMUM_STEPPER_PRE_DIR_DELAY 30

/**
* Minimum stepper driver pulse width (in µs)
Expand Down
16 changes: 10 additions & 6 deletions Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@
// VENDOR VERSION EXAMPLE //
////////////////////////////

#define MACHINE_SIZE "235x235x250"
#define CORP_WEBSITE_C "www.cxsw3d.com"
#define CORP_WEBSITE_E "www.creality.com"

/**
* Marlin release version identifier
*/
//#define SHORT_BUILD_VERSION "bugfix-2.0.x"
#define SHORT_BUILD_VERSION "Ver 1.0.3.6"

/**
* Verbose version identifier which should contain a reference to the location
* from where the binary was downloaded or the source code was compiled.
*/
//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (Github)"
#define DETAILED_BUILD_VERSION "Creality 3D"

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

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

/**
* Default generic printer UUID.
*/
//#define DEFAULT_MACHINE_UUID "cede2a2f-41a2-4748-9b12-c55c62f367ff"
#define DEFAULT_MACHINE_UUID "cede2a2f-41a2-4748-9b12-c55c62f367ff"

/**
* The WEBSITE_URL is the location where users can get more information such as
* documentation about a specific Marlin release.
*/
//#define WEBSITE_URL "http://marlinfw.org"
#define WEBSITE_URL "www.creality.com"

/**
* Set the vendor info the serial USB interface, if changable
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_STM32F1/sdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
#define SDIO_DATA_TIMEOUT 100U /* Read data transfer timeout */
#define SDIO_WRITE_TIMEOUT 200U /* Write data transfer timeout */

#define SDIO_CLOCK 18000000 /* 18 MHz */
#define SDIO_CLOCK 6000000 /* 18 MHz */

// ------------------------
// Types
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_STM32F1/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef uint16_t hal_timer_t;
#define HAL_TIMER_RATE uint32_t(F_CPU) // frequency of timers peripherals

#define STEP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
#define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
#define TEMP_TIMER_CHAN 4 // Channel of the timer to use for compare and interrupts

/**
* Note: Timers may be used by platforms and libraries
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_STM32F1/watchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void watchdogSetup() {
* @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)
*/
void watchdog_init() {
//iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
}

#endif // USE_WATCHDOG
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_STM32F1/watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* 625 reload value (counts down to 0)
* use 1250 for 8 seconds
*/
#define STM32F1_WD_RELOAD 625
#define STM32F1_WD_RELOAD 1250

// Arduino STM32F1 core now has watchdog support

Expand Down
103 changes: 93 additions & 10 deletions Marlin/src/Marlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@

#include "Marlin.h"

#ifdef DWIN_LCDDISPLAY
// DWIN file
#include "lcd/dwin/dwin.h"
#include "lcd/dwin/dwin_lcd.h"
#include "lcd/dwin/rotary_encoder.h"
#include "lcd/dwin/i2c_eeprom.h"
#elif ENABLED(RTS_AVAILABLE)
#include "lcd/dwin/LCD_RTS.h"
#include "lcd/dwin/i2c_eeprom.h"
#endif

#include "core/utility.h"
#include "lcd/ultralcd.h"
#include "module/motion.h"
Expand Down Expand Up @@ -442,7 +453,15 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
if (max_inactive_time && ELAPSED(ms, gcode.previous_move_ms + max_inactive_time)) {
SERIAL_ERROR_START();
SERIAL_ECHOLNPAIR(MSG_KILL_INACTIVE_TIME, parser.command_ptr);
kill();
#ifdef RTS_AVAILABLE
waitway = 0;
rtscheck.RTS_SndData(ExchangePageBase + 62, ExchangepageAddr);
change_page_font = 62;
rtscheck.RTS_SndData(Error_201, ABNORMAL_TEXT_VP);
errorway = 1;
#else
kill();
#endif
}

// Prevent steppers timing-out in the middle of M600
Expand All @@ -455,7 +474,9 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
if (stepper_inactive_time) {
static bool already_shutdown_steppers; // = false
if (planner.has_blocks_queued())
{
gcode.reset_stepper_timeout();
}
else if (MOVE_AWAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
if (!already_shutdown_steppers) {
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
Expand Down Expand Up @@ -653,7 +674,30 @@ void idle(
max7219.idle_tasks();
#endif

ui.update();
#ifdef DWIN_LCDDISPLAY
DWIN_Update();
#elif ENABLED(RTS_AVAILABLE)
RTSUpdate();
#else
ui.update();
#endif
#if ENABLED(FIX_MOUNTED_PROBE)
if((IS_SD_PRINTING() == true) && home_flag == false) // printing and no homing
{
endstops.enable_z_probe(false);
}
#endif

#if ENABLED(FIX_MOUNTED_PROBE)
if((0 == READ(OPTO_SWITCH_PIN)) && (home_flag == true))
{
endstops.enable_z_probe(true);
delay(100);
WRITE(COM_PIN, 0);
delay(200);
WRITE(COM_PIN, 1);
}
#endif

#if ENABLED(HOST_KEEPALIVE_FEATURE)
gcode.host_keepalive();
Expand Down Expand Up @@ -932,9 +976,17 @@ void setup() {
leds.setup();
#endif

ui.init();
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
ui.show_bootscreen();
#ifdef DWIN_LCDDISPLAY
delay(800); // wait stabillze dalay
if(DWIN_ShakeHand()) SERIAL_ECHOLN("\r\nDwin shake hand ok.");
else SERIAL_ECHOLN("\r\nDwin shake hand error.");
DWIN_Frame_SetDir(1);
DWIN_UpdateLCD(); // show bootscreen ( first picture )
#else
ui.init();
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
ui.show_bootscreen();
#endif
#endif

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

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

ui.reset_status(); // Print startup message after print statistics are loaded
// ui.reset_status(); // Print startup message after print statistics are loaded

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

Expand Down Expand Up @@ -1086,10 +1138,6 @@ void setup() {
est_init();
#endif

#if ENABLED(POWER_LOSS_RECOVERY)
recovery.check();
#endif

#if ENABLED(USE_WATCHDOG)
watchdog_init(); // Reinit watchdog after HAL_get_reset_source call
#endif
Expand Down Expand Up @@ -1117,6 +1165,41 @@ void setup() {
#if ENABLED(PRUSA_MMU2)
mmu2.init();
#endif

#if HAS_COLOR_LEDS
leds.set_color(LEDColorWhite());
#endif

#ifdef MYI2C_EEPROM
BL24CXX_Init();
if(BL24CXX_Check()) // no found I2C_EEPROM
SERIAL_ECHOLN("I2C_EEPROM Check Failed!");
else
SERIAL_ECHOLN("I2C_EEPROM Check Successed!");
#endif

#if ENABLED(POWER_LOSS_RECOVERY)
recovery.check();
#endif

#ifdef DWIN_LCDDISPLAY

// dwin init
Encoder_Configuration();
HMI_Init();
HMI_StartFrame();

#elif ENABLED(RTS_AVAILABLE)

rtscheck.RTS_Init();
#ifdef FIX_MOUNTED_PROBE
OUT_WRITE(COM_PIN, 1);
SET_INPUT(CHECK_MATWEIAL);
SET_INPUT(OPTO_SWITCH_PIN);
OUT_WRITE(LED_CONTROL_PIN, 0);
#endif

#endif
}

/**
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
#define BOARD_FYSETC_CHEETAH 4016 // FYSETC Cheetah
#define BOARD_FYSETC_CHEETAH_V12 4017 // FYSETC Cheetah V1.2
#define BOARD_LONGER3D_LK 4018 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
#define BOARD_CREALITY 4019 // Creality (STM32F103RE)

//
// ARM Cortex-M4F
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extern uint8_t marlin_debug_flags;
#define _PORT_RESTORE(n) RESTORE(n)
#define SERIAL_OUT(WHAT, V...) do{ \
if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(V); \
if ( serial_port_index) (void)MYSERIAL1.WHAT(V); \
if ( serial_port_index) (void)MYSERIAL0.WHAT(V); \
}while(0)
#define SERIAL_ASSERT(P) if(serial_port_index!=(P)){ debugger(); }
#else
Expand Down
Loading

0 comments on commit f3876e8

Please sign in to comment.