Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin
Browse files Browse the repository at this point in the history
… into bugfix-2.0.x
  • Loading branch information
crysxd committed Aug 11, 2020
2 parents 1f7193f + 9590fcd commit a503f25
Show file tree
Hide file tree
Showing 13 changed files with 151 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,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_ABORT "G28XY" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")

#if ENABLED(PRINTER_EVENT_LEDS)
#define PE_LEDS_COMPLETED_TIME (30*60) // (seconds) Time to keep the LED "done" color before restoring normal illumination
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ void startOrResumeJob() {
#endif
wait_for_heatup = false;
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
#ifdef EVENT_GCODE_SD_STOP
queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
#ifdef EVENT_GCODE_SD_ABORT
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
#endif

TERN_(PASSWORD_AFTER_SD_PRINT_ABORT, password.lock_machine());
Expand Down
6 changes: 4 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@
#error "TOUCH_BUTTONS is now TOUCH_SCREEN. Please update your Configuration.h."
#elif defined(ANYCUBIC_TFT_MODEL)
#error "ANYCUBIC_TFT_MODEL is now ANYCUBIC_LCD_I3MEGA. Please update your Configuration.h."
#elif defined(EVENT_GCODE_SD_STOP)
#error "EVENT_GCODE_SD_STOP is now EVENT_GCODE_SD_ABORT. Please update your Configuration.h."
#endif

#ifdef FIL_RUNOUT_INVERTING
Expand Down Expand Up @@ -742,8 +744,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#endif

#if defined(EVENT_GCODE_SD_STOP) && DISABLED(NOZZLE_PARK_FEATURE)
static_assert(nullptr == strstr(EVENT_GCODE_SD_STOP, "G27"), "NOZZLE_PARK_FEATURE is required to use G27 in EVENT_GCODE_SD_STOP.");
#if defined(EVENT_GCODE_SD_ABORT) && DISABLED(NOZZLE_PARK_FEATURE)
static_assert(nullptr == strstr(EVENT_GCODE_SD_ABORT, "G27"), "NOZZLE_PARK_FEATURE is required to use G27 in EVENT_GCODE_SD_ABORT.");
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-08-10"
#define STRING_DISTRIBUTION_DATE "2020-08-11"
#endif

/**
Expand Down
20 changes: 12 additions & 8 deletions Marlin/src/lcd/dwin/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
#include "../../module/motion.h"
#include "../../module/planner.h"

#if ENABLED(HOST_ACTION_COMMANDS)
#include "../../feature/host_actions.h"
#endif

#if HAS_LEVELING
#include "../../feature/bedlevel/bedlevel.h"
#endif
Expand Down Expand Up @@ -124,7 +128,7 @@ constexpr uint16_t TROWS = 6, MROWS = TROWS - 1, // Total rows, and other

#define MBASE(L) (49 + (L)*MLINE)

#define BABY_Z_VAR TERN(HAS_LEVELING, probe.offset.z, zprobe_zoffset)
#define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, zprobe_zoffset)

/* Value Init */
HMI_value_t HMI_ValueStruct;
Expand Down Expand Up @@ -1116,11 +1120,11 @@ void HMI_Zoffset(void) {

if (HMI_ValueStruct.show_mode == -4) {
checkkey = Prepare;
show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(4 + MROWS - index_prepare), TERN(HAS_LEVELING, probe.offset.z * 100, HMI_ValueStruct.offset_value));
show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(4 + MROWS - index_prepare), TERN(HAS_BED_PROBE, probe.offset.z * 100, HMI_ValueStruct.offset_value));
}
else {
checkkey = Tune;
show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(5 + MROWS - index_tune), TERN(HAS_LEVELING, probe.offset.z * 100, HMI_ValueStruct.offset_value));
show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(5 + MROWS - index_tune), TERN(HAS_BED_PROBE, probe.offset.z * 100, HMI_ValueStruct.offset_value));
}
DWIN_UpdateLCD();
return;
Expand Down Expand Up @@ -1484,7 +1488,7 @@ void update_variable(void) {
DWIN_Draw_IntValue(true, true, 0, STAT_FONT, White, Background_black, 3, 33 + 2 * STAT_CHR_W, 429, feedrate_percentage);
last_speed = feedrate_percentage;
}
#if HAS_LEVELING
#if HAS_BED_PROBE
if (last_probe_zoffset != probe.offset.z) {
show_plus_or_minus(STAT_FONT, Background_black, 2, 2, 178 + STAT_CHR_W, 429, probe.offset.z * 100);
last_probe_zoffset = probe.offset.z;
Expand Down Expand Up @@ -2068,9 +2072,9 @@ void HMI_PauseOrStop(void) {
#ifdef ACTION_ON_CANCEL
host_action_cancel();
#endif
#ifdef EVENT_GCODE_SD_STOP
#ifdef EVENT_GCODE_SD_ABORT
Popup_Window_Home();
queue.inject_P(PSTR(EVENT_GCODE_SD_STOP)); // For Ender 3 "G28 X Y"
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
#endif
abort_flag = true;
#endif
Expand Down Expand Up @@ -2188,7 +2192,7 @@ void HMI_Prepare(void) {
Popup_Window_Home();
break;
case 4: // Z-offset
#if HAS_LEVELING
#if HAS_BED_PROBE
checkkey = Homeoffset;
HMI_ValueStruct.show_mode = -4;
HMI_ValueStruct.offset_value = probe.offset.z * 100;
Expand Down Expand Up @@ -3390,7 +3394,7 @@ void EachMomentUpdate(void) {
else if (abort_flag && !HMI_flag.home_flag) { // Print Stop
abort_flag = 0;
HMI_ValueStruct.print_speed = feedrate_percentage = 100;
zprobe_zoffset = TERN(HAS_LEVELING, probe.offset.z, 0);
zprobe_zoffset = TERN(HAS_BED_PROBE, probe.offset.z, 0);

planner.finish_and_disable();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,15 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::

const float scale_z = ((val_max == val_min) ? 1 : 1/(val_max - val_min)) * autoscale_max;

// These equations determine the appearance of the grid on the screen.
/**
* The 3D points go through a 3D graphics pipeline to determine the final 2D point on the screen.
* This is written out as a stack of macros that each apply an affine transformation to the point.
* At compile time, the compiler should be able to reduce these expressions.
*
* The last transformation in the chain (TRANSFORM_5) is initially set to a no-op so we can measure
* the dimensions of the grid, but is later replaced with a scaling transform that scales the grid
* to fit.
*/

#define TRANSFORM_5(X,Y,Z) (X), (Y) // No transform
#define TRANSFORM_4(X,Y,Z) TRANSFORM_5((X)/(Z),(Y)/-(Z), 0) // Perspective
Expand Down Expand Up @@ -119,16 +127,19 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::
const float center_x = x + w/2;
const float center_y = y + h/2;

// Now replace the last transformation in the chain with a scaling operation.

#undef TRANSFORM_5
#define TRANSFORM_5(X,Y,Z) center_x + (X - grid_cx) * scale_x, center_y + (Y - grid_cy) * scale_y // Fit to bounds
#define TRANSFORM_6(X,Y,Z) (X)*16, (Y)*16 // Scale to 1/16 pixel units
#define TRANSFORM_5(X,Y,Z) TRANSFORM_6( center_x + ((X) - grid_cx) * scale_x, \
center_y + ((Y) - grid_cy) * scale_y, 0) // Scale to bounds

// Draw the grid

const uint16_t basePointSize = min(w,h) / max(cols,rows);

CommandProcessor cmd;
cmd.cmd(SAVE_CONTEXT())
.cmd(VERTEX_FORMAT(0))
.cmd(TAG_MASK(false))
.cmd(SAVE_CONTEXT());

Expand Down
8 changes: 6 additions & 2 deletions Marlin/src/lcd/tft/ili9341.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
#define ILI9341_ORIENTATION_LEFT ILI9341_MADCTL_MY | ILI9341_MADCTL_MX | ILI9341_MADCTL_MV // 320x240 ; Cable on the left side
#define ILI9341_ORIENTATION_DOWN ILI9341_MADCTL_MX // 240x320 ; Cable on the upper side

#define ILI9341_COLOR_BGR
#define ILI9341_ORIENTATION ILI9341_ORIENTATION_LEFT
#ifndef ILI9341_COLOR_RGB
#define ILI9341_COLOR_BGR
#endif
#ifndef ILI9341_ORIENTATION
#define ILI9341_ORIENTATION ILI9341_ORIENTATION_LEFT
#endif
#define ILI9341_MADCTL_DATA (ILI9341_ORIENTATION | TERN(ILI9341_COLOR_BGR, ILI9341_MADCTL_BGR, ILI9341_MADCTL_RGB))

#define ILI9341_NOP 0x00 // No Operation
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/tft/ili9488.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
#define ILI9488_ORIENTATION_LEFT ILI9488_MADCTL_MY | ILI9488_MADCTL_MX | ILI9488_MADCTL_MV // 480x320 ; Cable on the left side
#define ILI9488_ORIENTATION_DOWN ILI9488_MADCTL_MX // 320x480 ; Cable on the upper side

#define ILI9488_COLOR_BGR
#ifndef ILI9488_COLOR_RGB
#define ILI9488_COLOR_BGR
#endif
#ifndef ILI9488_ORIENTATION
#define ILI9488_ORIENTATION ILI9488_ORIENTATION_LEFT
#endif
Expand Down
128 changes: 87 additions & 41 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,33 @@
#pragma once

/**
* MKS Robin MINI (STM32F130VET6) board pin assignments
* MKS Robin mini (STM32F130VET6) board pin assignments
*/

#ifndef __STM32F1__
#error "Oops! Select an STM32F1 board in 'Tools > Board.'"
#elif HOTENDS > 1 || E_STEPPERS > 1
#error "MKS Robin mini supports up to 1 hotends / E-steppers. Comment out this line to continue."
#error "MKS Robin mini only supports 1 hotend / E-stepper. Comment out this line to continue."
#endif

#define BOARD_INFO_NAME "MKS Robin mini"
#define BOARD_INFO_NAME "MKS Robin Mini"

//
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
//
#define DISABLE_DEBUG

//
// EEPROM
//
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
// 2K in a AT24C16N
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#endif

//
// Note: MKS Robin mini board is using SPI2 interface.
//
#define SPI_MODULE 2
#define ENABLE_SPI2

//
// Limit Switches
Expand Down Expand Up @@ -82,6 +81,15 @@
#define E0_STEP_PIN PD6
#define E0_DIR_PIN PD3


// Motor current PWM pins
#define MOTOR_CURRENT_PWM_XY_PIN PA6
#define MOTOR_CURRENT_PWM_Z_PIN PA7
#define MOTOR_CURRENT_PWM_E_PIN PB0
#define MOTOR_CURRENT_PWM_RANGE 1500 // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp
#ifndef DEFAULT_PWM_MOTOR_CURRENT
#define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 }
#endif
//
// Temperature Sensors
//
Expand All @@ -91,64 +99,102 @@
//
// Heaters / Fans
//
#define HEATER_0_PIN PC3 // HEATER1
#define HEATER_BED_PIN PA0 // HOT BED
#define HEATER_0_PIN PC3
#define HEATER_BED_PIN PA0

#define FAN_PIN PB1 // FAN

//
// Thermocouples
//
//#define MAX6675_SS_PIN PE5 // TC1 - CS1
//#define MAX6675_SS_PIN PE6 // TC2 - CS2

//
// Misc. Functions
//
#define POWER_LOSS_PIN PA2 // PW_DET
#define PS_ON_PIN PA3 // PW_OFF

//#define LED_PIN PB2
#define SERVO0_PIN PA8 // Enable BLTOUCH support on IO0 (WIFI connector)

#define MT_DET_1_PIN PA4
#define MT_DET_PIN_INVERTING false

#define WIFI_IO0_PIN PC13

//
// SD Card
//
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif

#define SDIO_SUPPORT
#define SDIO_CLOCK 4500000 // 4.5 MHz
#define SD_DETECT_PIN PD12
#define ONBOARD_SD_CS_PIN PC11

//
// LCD / Controller
//
#define BEEPER_PIN PC5
#define SD_DETECT_PIN PD12

/**
* Note: MKS Robin TFT screens use various TFT controllers.
* If the screen stays white, disable 'LCD_RESET_PIN'
* to let the bootloader init the screen.
*/
#define XPT2046_X_CALIBRATION 12033
#define XPT2046_Y_CALIBRATION -9047
#define XPT2046_X_OFFSET -30
#define XPT2046_Y_OFFSET 254

#if ENABLED(FSMC_GRAPHICAL_TFT)

#define FSMC_CS_PIN PD7 // NE4
#define FSMC_RS_PIN PD11 // A0

#define LCD_RESET_PIN PC6
#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
#define FSMC_DMA_DEV DMA2
#define FSMC_DMA_CHANNEL DMA_CH5

#define LCD_RESET_PIN PC6 // FSMC_RST
#define LCD_BACKLIGHT_PIN PD13

#if NEED_TOUCH_PINS
#define TOUCH_CS_PIN PC2
#define TOUCH_SCK_PIN PB13
#define TOUCH_MOSI_PIN PB15
#define TOUCH_MISO_PIN PB14
#define TOUCH_CS_PIN PC2 // SPI2_NSS
#define TOUCH_SCK_PIN PB13 // SPI2_SCK
#define TOUCH_MISO_PIN PB14 // SPI2_MISO
#define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
#endif

#elif ENABLED(TFT_320x240) //TFT32/28

#define TFT_RESET_PIN PC6
#define TFT_BACKLIGHT_PIN PD13

#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
#define FSMC_CS_PIN PD7
#define FSMC_RS_PIN PD11
#define FSMC_DMA_DEV DMA2
#define FSMC_DMA_CHANNEL DMA_CH5

#define TOUCH_CS_PIN PC2 // SPI2_NSS
#define TOUCH_SCK_PIN PB13 // SPI2_SCK
#define TOUCH_MISO_PIN PB14 // SPI2_MISO
#define TOUCH_MOSI_PIN PB15 // SPI2_MOSI

#define TFT_DRIVER ILI9341
#define TFT_BUFFER_SIZE 14400

// YV for normal screen mounting
#define ILI9341_ORIENTATION ILI9341_MADCTL_MY | ILI9341_MADCTL_MV
// XV for 180° rotated screen mounting
//#define ILI9341_ORIENTATION ILI9341_MADCTL_MX | ILI9341_MADCTL_MV

#define ILI9341_COLOR_RGB
#endif

// Motor current PWM pins
#define MOTOR_CURRENT_PWM_XY_PIN PA6
#define MOTOR_CURRENT_PWM_Z_PIN PA7
#define MOTOR_CURRENT_PWM_E_PIN PB0
#define MOTOR_CURRENT_PWM_RANGE 1500 // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp
#define DEFAULT_PWM_MOTOR_CURRENT { 1030, 1030, 1030 } // 1.05Amp per driver, here is XY, Z and E. This values determined empirically.

// This is a kind of workaround in case native marlin "digipot" interface won't work.
// Required to enable related code in STM32F1/HAL.cpp
//#ifndef MKS_ROBIN_MINI_VREF_PWM
// #define MKS_ROBIN_MINI_VREF_PWM
//#endif

//#define VREF_XY_PIN PA6
//#define VREF_Z_PIN PA7
//#define VREF_E1_PIN PB0
#define HAS_SPI_FLASH 1
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#if HAS_SPI_FLASH
#define W25QXX_CS_PIN PB12 // Flash chip-select
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#endif
Loading

0 comments on commit a503f25

Please sign in to comment.