Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' into PR/STM32_1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
sjasonsmith committed Aug 18, 2020
2 parents 09d65b9 + c55f477 commit 354e930
Show file tree
Hide file tree
Showing 23 changed files with 124 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:

- name: Install PlatformIO
run: |
pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
pip install -U https://github.com/platformio/platformio-core/archive/master.zip
platformio update
- name: Check out the PR
Expand Down
1 change: 1 addition & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2354,6 +2354,7 @@
#define NEOPIXEL_PIN 4 // LED driving pin
//#define NEOPIXEL2_TYPE NEOPIXEL_TYPE
//#define NEOPIXEL2_PIN 5
#define NEOPIXEL2_INSERIES false // The default behaviour is 'false' with neopixel2 in parallel
#define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip, larger of 2 strips if 2 neopixel strips are used
#define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.
#define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255)
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/HAL/AVR/ServoTimers.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
//#define _useTimer1
#define _useTimer3
#define _useTimer4
#if !HAS_MOTOR_CURRENT_PWM
#define _useTimer5 // Timer 5 is used for motor current PWM and can't be used for servos.
#if NUM_SERVOS > SERVOS_PER_TIMER
#define _useTimer4
#if !HAS_MOTOR_CURRENT_PWM && SERVOS > 2 * SERVOS_PER_TIMER
#define _useTimer5 // Timer 5 is used for motor current PWM and can't be used for servos.
#endif
#endif
#elif defined(__AVR_ATmega32U4__)
#define _useTimer3
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/HAL/AVR/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
* Sanity checks for Spindle / Laser PWM
*/
#if ENABLED(SPINDLE_LASER_PWM)
#include "../ServoTimers.h" // Needed to check timer availability (_useTimer3)
#if SPINDLE_LASER_PWM_PIN == 4 || WITHIN(SPINDLE_LASER_PWM_PIN, 11, 13)
#error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by a system interrupt."
#elif NUM_SERVOS > 0 && (WITHIN(SPINDLE_LASER_PWM_PIN, 2, 3) || SPINDLE_LASER_PWM_PIN == 5)
#elif NUM_SERVOS > 0 && defined(_useTimer3) && (WITHIN(SPINDLE_LASER_PWM_PIN, 2, 3) || SPINDLE_LASER_PWM_PIN == 5)
#error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by the servo system."
#endif
#elif defined(SPINDLE_LASER_FREQUENCY)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/leds/neopixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Marlin_NeoPixel neo;
int8_t Marlin_NeoPixel::neoindex;

Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIXEL_TYPE + NEO_KHZ800)
#if MULTIPLE_NEOPIXEL_TYPES
#if EITHER(MULTIPLE_NEOPIXEL_TYPES, NEOPIXEL2_INSERIES)
, Marlin_NeoPixel::adaneo2(NEOPIXEL_PIXELS, NEOPIXEL2_PIN, NEOPIXEL2_TYPE + NEO_KHZ800)
#endif
;
Expand Down
27 changes: 20 additions & 7 deletions Marlin/src/feature/leds/neopixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
class Marlin_NeoPixel {
private:
static Adafruit_NeoPixel adaneo1
#if MULTIPLE_NEOPIXEL_TYPES
#if EITHER(MULTIPLE_NEOPIXEL_TYPES, NEOPIXEL2_INSERIES)
, adaneo2
#endif
;
Expand All @@ -82,23 +82,36 @@ class Marlin_NeoPixel {

static inline void begin() {
adaneo1.begin();
TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.begin());
#if ENABLED(NEOPIXEL2_INSERIES)
adaneo2.begin();
#else
TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.begin());
#endif
}

static inline void set_pixel_color(const uint16_t n, const uint32_t c) {
adaneo1.setPixelColor(n, c);
TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.setPixelColor(n, c));
#if ENABLED(NEOPIXEL2_INSERIES)
if (n >= NEOPIXEL_PIXELS) adaneo2.setPixelColor(n - (NEOPIXEL_PIXELS), c);
else adaneo1.setPixelColor(n, c);
#else
adaneo1.setPixelColor(n, c);
TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.setPixelColor(n, c));
#endif
}

static inline void set_brightness(const uint8_t b) {
adaneo1.setBrightness(b);
TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.setBrightness(b));
#if ENABLED(NEOPIXEL2_INSERIES)
adaneo2.setBrightness(b);
#else
TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.setBrightness(b));
#endif
}

static inline void show() {
adaneo1.show();
#if PIN_EXISTS(NEOPIXEL2)
#if MULTIPLE_NEOPIXEL_TYPES
#if EITHER(MULTIPLE_NEOPIXEL_TYPES, NEOPIXEL2_INSERIES)
adaneo2.show();
#else
adaneo1.setPin(NEOPIXEL2_PIN);
Expand All @@ -113,7 +126,7 @@ class Marlin_NeoPixel {
#endif

// Accessors
static inline uint16_t pixels() { return adaneo1.numPixels(); }
static inline uint16_t pixels() { TERN(NEOPIXEL2_INSERIES, return adaneo1.numPixels() * 2, return adaneo1.numPixels()); }
static inline uint8_t brightness() { return adaneo1.getBrightness(); }
static inline uint32_t Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
return adaneo1.Color(r, g, b, w);
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le

TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_RESUME));

// Check Temperature before moving hotend
ensure_safe_temperature();

// Retract to prevent oozing
unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));

Expand All @@ -594,8 +597,6 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
// Unretract
unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));

ensure_safe_temperature();

// Intelligent resuming
#if ENABLED(FWRETRACT)
// If retracted before goto pause
Expand Down
16 changes: 7 additions & 9 deletions Marlin/src/gcode/control/M80_M81.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@
*/

#include "../gcode.h"

#include "../../module/temperature.h"
#include "../../module/stepper.h"
#include "../../module/printcounter.h" // for print_job_timer
#include "../../module/planner.h" // for planner.finish_and_disable
#include "../../module/printcounter.h" // for print_job_timer.stop
#include "../../lcd/ultralcd.h" // for LCD_MESSAGEPGM_P

#include "../../inc/MarlinConfig.h"

#if HAS_LCD_MENU
#include "../../lcd/ultralcd.h"
#endif

#if HAS_SUICIDE
#include "../../MarlinCore.h"
#endif
Expand All @@ -39,6 +37,8 @@

#if ENABLED(AUTO_POWER_CONTROL)
#include "../../feature/power.h"
#else
void restore_stepper_drivers();
#endif

// Could be moved to a feature, but this is all the data
Expand Down Expand Up @@ -108,7 +108,5 @@ void GcodeSuite::M81() {
PSU_OFF();
#endif

#if HAS_LCD_MENU
LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF "."));
#endif
LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF "."));
}
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@
//

// Is an endstop plug used for extra Z endstops or the probe?
#define IS_PROBE_PIN(A,M) (HAS_CUSTOM_PROBE_PIN && Z_MIN_PROBE_PIN == P)
#define IS_PROBE_PIN(A,M) (HAS_CUSTOM_PROBE_PIN && Z_MIN_PROBE_PIN == A##_##M##_PIN)
#define IS_X2_ENDSTOP(A,M) (ENABLED(X_DUAL_ENDSTOPS) && X2_USE_ENDSTOP == _##A##M##_)
#define IS_Y2_ENDSTOP(A,M) (ENABLED(Y_DUAL_ENDSTOPS) && Y2_USE_ENDSTOP == _##A##M##_)
#define IS_Z2_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && Z2_USE_ENDSTOP == _##A##M##_)
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-13"
#define STRING_DISTRIBUTION_DATE "2020-08-18"
#endif

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ static const uint16_t ili9328_init[] = {
static const uint16_t ili9341_init[] = {
ESC_REG(0x0010), ESC_DELAY(10),
ESC_REG(0x0001), ESC_DELAY(200),
ESC_REG(0x0036), TERN(GRAPHICAL_TFT_ROTATE_180, 0x00E8, 0x0028),
ESC_REG(0x0036), TERN(GRAPHICAL_TFT_ROTATE_180, 0x0028, 0x00E8),
ESC_REG(0x003A), 0x0055,
ESC_REG(0x002A), 0x0000, 0x0000, 0x0001, 0x003F,
ESC_REG(0x002B), 0x0000, 0x0000, 0x0000, 0x00EF,
Expand Down Expand Up @@ -658,6 +658,9 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
setWindow = setWindow_ili9328;
break;
case 0x9341: // ILI9341
WRITE_ESC_SEQUENCE(ili9341_init);
setWindow = setWindow_st7789v;
break;
case 0x8066: // Anycubic / TronXY TFTs (480x320)
WRITE_ESC_SEQUENCE(ili9488_init);
setWindow = setWindow_st7789v;
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/lcd/dwin/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,8 @@ void Goto_PrintProcess(void) {

// Copy into filebuf string before entry
char * const name = card.longest_filename();
DWIN_Draw_String(false, false, font8x16, White, Background_black, (DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2, 60, name);
const int8_t npos = _MAX(0, DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2;
DWIN_Draw_String(false, false, font8x16, White, Background_black, npos, 60, name);

DWIN_ICON_Show(ICON, ICON_PrintTime, 17, 193);
DWIN_ICON_Show(ICON, ICON_RemainTime, 150, 191);
Expand Down Expand Up @@ -1523,7 +1524,7 @@ inline void make_name_without_ext(char *dst, char *src, int maxlen=MENU_CHAR_LIM
if (!card.flag.filenameIsDir)
while (pos && src[pos] != '.') pos--; // find last '.' (stop at 0)

int len = pos; // nul or '.'
size_t len = pos; // nul or '.'
if (len > maxlen) { // Keep the name short
pos = len = maxlen; // move nul down
dst[--pos] = '.'; // insert dots
Expand Down Expand Up @@ -3436,7 +3437,8 @@ void EachMomentUpdate(void) {
Popup_Window_Resume();
draw_first_option(false);
char * const name = card.longest_filename();
DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, (DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2, 252, name);
const int8_t npos = _MAX(0, DWIN_WIDTH - strlen(name) * (MENU_CHR_W)) / 2;
DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, npos, 252, name);
DWIN_UpdateLCD();
break;
}
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ namespace ExtUI {

void setAxisSteps_per_mm(const float value, const extruder_t extruder) {
UNUSED_E(extruder);
planner.settings.axis_steps_per_mm[E_AXIS_N(axis - E0)] = value;
planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)] = value;
}

feedRate_t getAxisMaxFeedrate_mm_s(const axis_t axis) {
Expand All @@ -557,7 +557,7 @@ namespace ExtUI {

feedRate_t getAxisMaxFeedrate_mm_s(const extruder_t extruder) {
UNUSED_E(extruder);
return planner.settings.max_feedrate_mm_s[E_AXIS_N(axis - E0)];
return planner.settings.max_feedrate_mm_s[E_AXIS_N(extruder - E0)];
}

void setAxisMaxFeedrate_mm_s(const feedRate_t value, const axis_t axis) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/fontutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ int pf_bsearch_r(void *userdata, size_t num_data, pf_bsearch_cb_comp_t cb_comp,
/* Get the character, decoding multibyte UTF8 characters and returning a pointer to the start of the next UTF8 character */
uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval);

/* Returns lenght of string in CHARACTERS, NOT BYTES */
/* Returns length of string in CHARACTERS, NOT BYTES */
uint8_t utf8_strlen(const char *pstart);
uint8_t utf8_strlen_P(PGM_P pstart);
13 changes: 8 additions & 5 deletions Marlin/src/lcd/touch/xpt2046.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ uint8_t XPT2046::read_buttons() {
// Touch within the button area simulates an encoder button
if (y > BUTTON_AREA_TOP && y < BUTTON_AREA_BOT)
return WITHIN(x, 14, 77) ? EN_D
: WITHIN(x, 90, 153) ? EN_A
: WITHIN(x, 166, 229) ? EN_B
: WITHIN(x, 242, 305) ? EN_C
: 0;
: WITHIN(x, 90, 153) ? EN_A
: WITHIN(x, 166, 229) ? EN_B
: WITHIN(x, 242, 305) ? EN_C
: 0;

if (x > TOUCH_SENSOR_WIDTH || !WITHIN(y, SCREEN_START_TOP, SCREEN_START_TOP + SCREEN_HEIGHT)) return 0;
if ( !WITHIN(x, SCREEN_START_LEFT, SCREEN_START_LEFT + SCREEN_WIDTH)
|| !WITHIN(y, SCREEN_START_TOP, SCREEN_START_TOP + SCREEN_HEIGHT)
) return 0;

// Column and row above BUTTON_AREA_TOP
int8_t col = (x - (SCREEN_START_LEFT)) * (LCD_WIDTH) / (TOUCHABLE_X_WIDTH),
Expand All @@ -161,6 +163,7 @@ bool XPT2046::isTouched() {
}

#if ENABLED(TOUCH_BUTTONS_HW_SPI)

#include <SPI.h>

static void touch_spi_init(uint8_t spiRate) {
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,12 @@ void MarlinSettings::postprocess() {
#endif
EEPROM_WRITE(home_offset);
#endif
}

//
// Hotend Offsets, if any
//
{
#if HAS_HOTEND_OFFSET
// Skip hotend 0 which must be 0
LOOP_S_L_N(e, 1, HOTENDS)
Expand Down Expand Up @@ -1521,6 +1526,8 @@ void MarlinSettings::postprocess() {
_FIELD_TEST(runout_sensor_enabled);
EEPROM_READ(runout_sensor_enabled);

TERN_(HAS_FILAMENT_SENSOR, if (runout.enabled) runout.reset());

float runout_distance_mm;
EEPROM_READ(runout_distance_mm);
#if HAS_FILAMENT_RUNOUT_DISTANCE
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/stepper/indirection.h
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define ENABLE_AXIS_Z() do{ ENABLE_STEPPER_Z(); ENABLE_STEPPER_Z2(); ENABLE_STEPPER_Z3(); ENABLE_STEPPER_Z4(); }while(0)

#ifdef Z_AFTER_DEACTIVATE
#define Z_RESET() do{ current_position.z = Z_AFTER_DEACTIVATE; planner.sync_plan_position(); }while(0)
#define Z_RESET() do{ current_position.z = Z_AFTER_DEACTIVATE; sync_plan_position(); }while(0)
#else
#define Z_RESET()
#endif
Expand Down
24 changes: 24 additions & 0 deletions Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,30 @@
#define LCD_PINS_ENABLE P1_23
#define LCD_PINS_D4 P1_21

#elif ENABLED(ENDER2_STOCKDISPLAY)

/** Creality Ender-2 display pinout
* _____
* 5V | 1 2 | GND
* (MOSI) 1.23 | 3 4 | 1.22 (LCD_RS)
* (LCD_A0) 1.21 | 5 6 | 1.20 (BTN_EN2)
* RESET 1.19 | 7 8 | 1.18 (BTN_EN1)
* (BTN_ENC) 0.28 | 9 10| 1.30 (SCK)
* -----
* EXP1
*/

#define BTN_EN1 P1_18
#define BTN_EN2 P1_20
#define BTN_ENC P0_28

#define DOGLCD_CS P1_22
#define DOGLCD_A0 P1_21
#define DOGLCD_SCK P1_30
#define DOGLCD_MOSI P1_23
#define FORCE_SOFT_SPI
#define LCD_BACKLIGHT_PIN -1

#else

#define BTN_ENC P0_28 // (58) open-drain
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/pins/stm32f1/pins_CREALITY_V4.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@
#define ONBOARD_SD_CS_PIN PA4 // SDSS
#define SDIO_SUPPORT

#if ENABLED(CR10_STOCKDISPLAY) && NONE(RET6_12864_LCD, VET6_12864_LCD)
#error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for CR10_STOCKDISPLAY with the Creality V4 controller."
#endif

#if ENABLED(RET6_12864_LCD)

/* RET6 12864 LCD */
Expand All @@ -146,6 +150,7 @@
#define BTN_EN2 PB14

#define BEEPER_PIN PC6

#elif ENABLED(VET6_12864_LCD)

/* VET6 12864 LCD */
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
#define DOGLCD_MOSI -1 // Prevent auto-define by Conditionals_post.h
#define DOGLCD_SCK -1

#define FSMC_UPSCALE 2
#define LCD_FULL_PIXEL_WIDTH 320
#define LCD_FULL_PIXEL_HEIGHT 240
#define LCD_PIXEL_OFFSET_X 32
#define LCD_PIXEL_OFFSET_Y 32

/**
* Note: Alfawise U20/U30 boards DON'T use SPI2, as the hardware designer
* mixed up MOSI and MISO pins. SPI is managed in SW, and needs pins
Expand Down
Loading

0 comments on commit 354e930

Please sign in to comment.