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

* 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin: (29 commits)
  More MKS UI prelim. cleanup
  MKS WiFi for TFT_LVGL_UI (MarlinFirmware#20191)
  [cron] Bump distribution date (2021-01-14)
  Ignore M22 during SD print
  Move WRITE_FAN
  whitespace
  MKS UI prelim. cleanup (MarlinFirmware#20763)
  Rotary encoder cleanup (MarlinFirmware#20753)
  Fix comments (MarlinFirmware#20759)
  [cron] Bump distribution date (2021-01-13)
  Ok to use C++11 'auto'
  Multi-platform DWIN_CREALITY_LCD support (MarlinFirmware#20738)
  [cron] Bump distribution date (2021-01-12)
  Fix TMC220x short circuit (MarlinFirmware#20731)
  Fixes for TFTGLCD (MarlinFirmware#20734)
  NO_SD_DETECT option (MarlinFirmware#20741)
  Fix joystick include
  Tweak STM32F1 pin r/w/t
  Clean up some includes
  Update Slovak glyphs
  ...
  • Loading branch information
Susis Strolch committed Jan 14, 2021
2 parents a4d7736 + c753fc6 commit 2cd20da
Show file tree
Hide file tree
Showing 195 changed files with 2,861 additions and 2,726 deletions.
4 changes: 4 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2696,6 +2696,10 @@
//#define TFT_COLOR_UI
//#define TFT_LVGL_UI

#if ENABLED(TFT_LVGL_UI)
//#define MKS_WIFI_MODULE // MKS WiFi module
#endif

/**
* TFT Rotation. Set to one of the following values:
*
Expand Down
9 changes: 8 additions & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1437,13 +1437,16 @@
* Set this option to one of the following (or the board's defaults apply):
*
* LCD - Use the SD drive in the external LCD controller.
* ONBOARD - Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.)
* ONBOARD - Use the SD drive on the control board.
* CUSTOM_CABLE - Use a custom cable to access the SD (as defined in a pins file).
*
* :[ 'LCD', 'ONBOARD', 'CUSTOM_CABLE' ]
*/
//#define SDCARD_CONNECTION LCD

// Enable if SD detect is rendered useless (e.g., by using an SD extender)
//#define NO_SD_DETECT

#endif // SDSUPPORT

/**
Expand Down Expand Up @@ -3104,6 +3107,10 @@
#define SPEED_POWER_MAX 100 // (%) 0-100
#define SPEED_POWER_STARTUP 80 // (%) M3/M4 speed/power default (with no arguments)

// Define the minimum and maximum test pulse time values for a laser test fire function
#define LASER_TEST_PULSE_MIN 1 // Used with Laser Control Menu
#define LASER_TEST_PULSE_MAX 999 // Caution: Menu may not show more than 3 characters

/**
* Enable inline laser power to be handled in the planner / stepper routines.
* Inline power is specified by the I (inline) flag in an M3 command (e.g., M3 S20 I)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/LPC1768/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#elif HAS_WIRED_LCD
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
#error "Serial port pins (1) conflict with Encoder Buttons!"
#elif ANY_TX(1, SD_SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK) \
#elif ANY_TX(1, SD_SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK_PIN) \
|| ANY_RX(1, LCD_SDSS, LCD_PINS_RS, SD_MISO_PIN, DOGLCD_A0, SD_SS_PIN, LCD_SDSS, DOGLCD_CS, LCD_RESET_PIN, LCD_BACKLIGHT_PIN)
#error "Serial port pins (1) conflict with LCD pins!"
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/fastio.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void FastIO_init(); // Must be called before using fast io macros
#endif

#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->IDR, _BV32(STM_PIN(digitalPinToPinName(IO)))))
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->ODR ^= _BV32(STM_PIN(digitalPinToPinName(IO))))
#define _TOGGLE(IO) TBI32(FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->ODR, STM_PIN(digitalPinToPinName(IO)))

#define _GET_MODE(IO)
#define _SET_MODE(IO,M) pinMode(IO, M)
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/HAL/STM32/tft/tft_fsmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class TFT_FSMC {
}
};


#ifdef STM32F1xx
#define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE)
#elif defined(STM32F4xx)
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/HAL/STM32F1/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@
#else
#error "LCD_SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration."
#endif

#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
#endif
#endif

// Set interrupt grouping for this MCU
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/STM32F1/fastio.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

#include <libmaple/gpio.h>

#define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << ((V) ? 0 : 16))
#define TOGGLE(IO) (PIN_MAP[IO].gpio_device->regs->ODR = PIN_MAP[IO].gpio_device->regs->ODR ^ (1U << PIN_MAP[IO].gpio_bit))
#define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & _BV32(PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = _BV32(PIN_MAP[IO].gpio_bit) << ((V) ? 0 : 16))
#define TOGGLE(IO) TBI32(PIN_MAP[IO].gpio_device->regs->ODR, PIN_MAP[IO].gpio_bit)

#define _GET_MODE(IO) gpio_get_mode(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit)
#define _SET_MODE(IO,M) gpio_set_mode(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit, M)
Expand Down
5 changes: 2 additions & 3 deletions Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ static bool isDataProc(uint32_t instr) {
}

UnwResult UnwStartArm(UnwState * const state) {
bool found = false;
uint16_t t = UNW_MAX_INSTR_COUNT;

do {
for (;;) {
uint32_t instr;

/* Attempt to read the instruction */
Expand Down Expand Up @@ -527,7 +526,7 @@ UnwResult UnwStartArm(UnwState * const state) {

if (--t == 0) return UNWIND_EXHAUSTED;

} while (!found);
}

return UNWIND_UNSUPPORTED;
}
Expand Down
5 changes: 2 additions & 3 deletions Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ static int32_t signExtend11(const uint16_t value) {
}

UnwResult UnwStartThumb(UnwState * const state) {
bool found = false;
uint16_t t = UNW_MAX_INSTR_COUNT;
uint32_t lastJumpAddr = 0; // Last JUMP address, to try to detect infinite loops
bool loopDetected = false; // If a loop was detected

do {
for (;;) {
uint16_t instr;

/* Attempt to read the instruction */
Expand Down Expand Up @@ -1059,7 +1058,7 @@ UnwResult UnwStartThumb(UnwState * const state) {

if (--t == 0) return UNWIND_EXHAUSTED;

} while (!found);
}

return UNWIND_SUCCESS;
}
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,8 +995,9 @@ void setup() {
#endif

MYSERIAL0.begin(BAUDRATE);
uint32_t serial_connect_timeout = millis() + 1000UL;
millis_t serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }

#if HAS_MULTI_SERIAL && !HAS_ETHERNET
MYSERIAL1.begin(BAUDRATE);
serial_connect_timeout = millis() + 1000UL;
Expand Down
5 changes: 2 additions & 3 deletions Marlin/src/feature/encoder_i2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include "encoder_i2c.h"

#include "../module/temperature.h"
#include "../module/stepper.h"
#include "../gcode/parser.h"

Expand Down Expand Up @@ -85,7 +84,7 @@ void I2CPositionEncoder::update() {
* the encoder would be re-enabled.
*/

/*
#if 0
// If the magnetic strength has been good for a certain time, start trusting the module again

if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) {
Expand All @@ -111,7 +110,7 @@ void I2CPositionEncoder::update() {
SERIAL_ECHOLNPGM(")");
#endif
}
*/
#endif
return;
}

Expand Down
1 change: 0 additions & 1 deletion Marlin/src/feature/joystick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

#include "../inc/MarlinConfig.h" // for pins
#include "../module/planner.h"
#include "../module/temperature.h"

Joystick joystick;

Expand Down
1 change: 0 additions & 1 deletion Marlin/src/feature/joystick.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include "../inc/MarlinConfigPre.h"
#include "../core/types.h"
#include "../core/macros.h"
#include "../module/temperature.h"

class Joystick {
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/feature/mmu/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ void MMU2::init() {
set_runout_valid(false);

#if PIN_EXISTS(MMU2_RST)
// TODO use macros for this
WRITE(MMU2_RST_PIN, HIGH);
SET_OUTPUT(MMU2_RST_PIN);
#endif
Expand Down Expand Up @@ -955,7 +954,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
/**
* Load filament to nozzle of multimaterial printer
*
* This function is used only only after T? (user select filament) and M600 (change filament).
* This function is used only after T? (user select filament) and M600 (change filament).
* It is not used after T0 .. T4 command (select filament), in such case, gcode is responsible for loading
* filament to nozzle.
*/
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void Power::power_off() {
#ifdef PSU_POWEROFF_GCODE
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWEROFF_GCODE));
#endif
PSU_PIN_OFF();
PSU_PIN_OFF();
}
}

Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/feature/spindle_laser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@

SpindleLaser cutter;
uint8_t SpindleLaser::power;
#if ENABLED(LASER_FEATURE)
cutter_test_pulse_t SpindleLaser::testPulse = 50; // Test fire Pulse time ms value.
#endif
bool SpindleLaser::isReady; // Ready to apply power setting from the UI to OCR
cutter_power_t SpindleLaser::menuPower, // Power set via LCD menu in PWM, PERCENT, or RPM
SpindleLaser::unitPower; // LCD status power in PWM, PERCENT, or RPM
Expand Down
24 changes: 23 additions & 1 deletion Marlin/src/feature/spindle_laser.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

#include "spindle_laser_types.h"

#if USE_BEEPER
#include "../libs/buzzer.h"
#endif

#if ENABLED(LASER_POWER_INLINE)
#include "../module/planner.h"
#endif
Expand Down Expand Up @@ -90,6 +94,10 @@ class SpindleLaser {
static const cutter_power_t mpower_min() { return cpwr_to_upwr(SPEED_POWER_MIN); }
static const cutter_power_t mpower_max() { return cpwr_to_upwr(SPEED_POWER_MAX); }

#if ENABLED(LASER_FEATURE)
static cutter_test_pulse_t testPulse; // Test fire Pulse ms value
#endif

static bool isReady; // Ready to apply power setting from the UI to OCR
static uint8_t power;

Expand Down Expand Up @@ -230,7 +238,21 @@ class SpindleLaser {
}
#endif

#endif
#if ENABLED(LASER_FEATURE)
/**
* Test fire the laser using the testPulse ms duration
* Also fires with any PWM power that was previous set
* If not set defaults to 80% power
*/
static inline void test_fire_pulse() {
enable_forward(); // Turn Laser on (Spindle speak but same funct)
TERN_(USE_BEEPER, buzzer.tone(30, 3000));
delay(testPulse); // Delay for time set by user in pulse ms menu screen.
disable(); // Turn laser off
}
#endif

#endif // HAS_LCD_MENU

#if ENABLED(LASER_POWER_INLINE)
/**
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/feature/spindle_laser_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ typedef IF<(SPEED_POWER_MAX > 255), uint16_t, uint8_t>::type cutter_cpower_t;
#endif
#endif

#if ENABLED(LASER_FEATURE)
typedef uint16_t cutter_test_pulse_t;
#define CUTTER_MENU_PULSE_TYPE uint16_3
#endif

#if ENABLED(MARLIN_DEV_MODE)
typedef uint16_t cutter_frequency_t;
#define CUTTER_MENU_FREQUENCY_TYPE uint16_5
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/tmc_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

static TMC_driver_data get_driver_data(TMC2208Stepper &st) {
constexpr uint8_t OTPW_bp = 0, OT_bp = 1;
constexpr uint8_t S2G_bm = 0b11110; // 2..5
constexpr uint8_t S2G_bm = 0b111100; // 2..5
TMC_driver_data data;
const auto ds = data.drv_status = st.DRV_STATUS();
data.is_otpw = TEST(ds, OTPW_bp);
Expand Down Expand Up @@ -291,7 +291,7 @@
bool should_step_down = false;

if (need_update_error_counters) {
if (data.is_ot /* | data.s2ga | data.s2gb*/) st.error_count++;
if (data.is_ot | data.is_s2g) st.error_count++;
else if (st.error_count > 0) st.error_count--;

#if ENABLED(STOP_ON_ERROR)
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/feature/tramming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ PGMSTR(point_name_3, TRAMMING_POINT_NAME_3);
PGMSTR(point_name_4, TRAMMING_POINT_NAME_4);
#ifdef TRAMMING_POINT_NAME_5
PGMSTR(point_name_5, TRAMMING_POINT_NAME_5);
#ifdef TRAMMING_POINT_NAME_6
PGMSTR(point_name_6, TRAMMING_POINT_NAME_6);
#endif
#endif
#endif

Expand All @@ -45,6 +48,9 @@ PGM_P const tramming_point_name[] PROGMEM = {
, point_name_4
#ifdef TRAMMING_POINT_NAME_5
, point_name_5
#ifdef TRAMMING_POINT_NAME_6
, point_name_6
#endif
#endif
#endif
};
Expand Down
11 changes: 9 additions & 2 deletions Marlin/src/feature/tramming.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@
constexpr xy_pos_t screws_tilt_adjust_pos[] = TRAMMING_POINT_XY;

#define G35_PROBE_COUNT COUNT(screws_tilt_adjust_pos)
static_assert(G35_PROBE_COUNT >= 3, "TRAMMING_POINT_XY requires at least 3 XY positions.");
static_assert(WITHIN(G35_PROBE_COUNT, 3, 6), "TRAMMING_POINT_XY requires between 3 and 6 XY positions.");

#define VALIDATE_TRAMMING_POINT(N) static_assert(N >= G35_PROBE_COUNT || Probe::build_time::can_reach(screws_tilt_adjust_pos[N]), \
"TRAMMING_POINT_XY point " STRINGIFY(N) " is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
VALIDATE_TRAMMING_POINT(0); VALIDATE_TRAMMING_POINT(1); VALIDATE_TRAMMING_POINT(2); VALIDATE_TRAMMING_POINT(3); VALIDATE_TRAMMING_POINT(4);
VALIDATE_TRAMMING_POINT(0); VALIDATE_TRAMMING_POINT(1); VALIDATE_TRAMMING_POINT(2); VALIDATE_TRAMMING_POINT(3); VALIDATE_TRAMMING_POINT(4); VALIDATE_TRAMMING_POINT(5);

extern const char point_name_1[], point_name_2[], point_name_3[]
#ifdef TRAMMING_POINT_NAME_4
, point_name_4[]
#ifdef TRAMMING_POINT_NAME_5
, point_name_5[]
#ifdef TRAMMING_POINT_NAME_6
, point_name_6[]
#endif
#endif
#endif
;
Expand All @@ -56,6 +59,10 @@ extern const char point_name_1[], point_name_2[], point_name_3[]
#ifdef TRAMMING_POINT_NAME_5
#undef _NR_TRAM_NAMES
#define _NR_TRAM_NAMES 5
#ifdef TRAMMING_POINT_NAME_6
#undef _NR_TRAM_NAMES
#define _NR_TRAM_NAMES 6
#endif
#endif
#endif
#endif
Expand Down
Loading

0 comments on commit 2cd20da

Please sign in to comment.