Skip to content

Commit

Permalink
Merge pull request MarlinFirmware#15 from MarlinFirmware/bugfix-2.0.x
Browse files Browse the repository at this point in the history
Bugfix 2.0.x
  • Loading branch information
makerbase-mks committed Jul 1, 2020
2 parents 8c42e50 + e5bc9d3 commit 626ed70
Show file tree
Hide file tree
Showing 85 changed files with 4,174 additions and 1,930 deletions.
15 changes: 11 additions & 4 deletions Marlin/Configuration.h
Expand Up @@ -1638,9 +1638,9 @@
* Select the language to display on the LCD. These languages are available:
*
* en, an, bg, ca, cz, da, de, el, el_gr, es, eu, fi, fr, gl, hr, hu, it,
* jp_kana, ko_KR, nl, pl, pt, pt_br, ru, sk, tr, uk, vi, zh_CN, zh_TW, test
* jp_kana, ko_KR, nl, pl, pt, pt_br, ro ru, sk, tr, uk, vi, zh_CN, zh_TW, test
*
* :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el_gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'hu':'Hungarian', 'it':'Italian', 'jp_kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt_br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'vi':'Vietnamese', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' }
* :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el_gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'hu':'Hungarian', 'it':'Italian', 'jp_kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt_br':'Portuguese (Brazilian)', 'ro':'Romanian', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'vi':'Vietnamese', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' }
*/
#define LCD_LANGUAGE en

Expand Down Expand Up @@ -2121,6 +2121,10 @@
//
//#define EXTENSIBLE_UI

#if ENABLED(EXTENSIBLE_UI)
//#define EXTUI_LOCAL_BEEPER // Enables use of local Beeper pin with external display
#endif

//=============================================================================
//=============================== Graphical TFTs ==============================
//=============================================================================
Expand All @@ -2131,9 +2135,12 @@
//#define FSMC_GRAPHICAL_TFT

//
// TFT Little VGL UI
// TFT LVGL UI
//
// Default MKS icons and fonts: https://git.io/JJvzK
// Copy mks_pic and mks_font folders to the root of your SD
//
//#define TFT_LITTLE_VGL_UI
//#define TFT_LVGL_UI

//=============================================================================
//============================ Other Controllers ============================
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/HAL/STM32F1/HAL.cpp
Expand Up @@ -277,9 +277,8 @@ void HAL_clear_reset_source() { }

/**
* TODO: Check this and change or remove.
* currently returns 1 that's equal to poweron reset.
*/
uint8_t HAL_get_reset_source() { return 1; }
uint8_t HAL_get_reset_source() { return RST_POWER_ON; }

void _delay_ms(const int delay_ms) { delay(delay_ms); }

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_fsmc.cpp
Expand Up @@ -291,7 +291,7 @@ uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
return uint32_t(data);
}

#if ENABLED(LCD_USE_DMA_FSMC)
#ifdef LCD_USE_DMA_FSMC

void LCD_IO_WriteMultiple(uint16_t color, uint32_t count) {
while (count > 0) {
Expand Down
21 changes: 11 additions & 10 deletions Marlin/src/MarlinCore.cpp
Expand Up @@ -59,7 +59,7 @@
#include "gcode/parser.h"
#include "gcode/queue.h"

#if ENABLED(TFT_LITTLE_VGL_UI)
#if ENABLED(TFT_LVGL_UI)
#include "lvgl.h"
#include "lcd/extui/lib/mks_ui/tft_lvgl_configuration.h"
#include "lcd/extui/lib/mks_ui/draw_ui.h"
Expand Down Expand Up @@ -743,7 +743,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
// Direct Stepping
TERN_(DIRECT_STEPPING, page_manager.write_responses());

#if ENABLED(TFT_LITTLE_VGL_UI)
#if ENABLED(TFT_LVGL_UI)
LV_TASK_HANDLER();
#endif
}
Expand Down Expand Up @@ -936,11 +936,11 @@ void setup() {

// Check startup - does nothing if bootloader sets MCUSR to 0
const byte mcu = HAL_get_reset_source();
if (mcu & 1) SERIAL_ECHOLNPGM(STR_POWERUP);
if (mcu & 2) SERIAL_ECHOLNPGM(STR_EXTERNAL_RESET);
if (mcu & 4) SERIAL_ECHOLNPGM(STR_BROWNOUT_RESET);
if (mcu & 8) SERIAL_ECHOLNPGM(STR_WATCHDOG_RESET);
if (mcu & 32) SERIAL_ECHOLNPGM(STR_SOFTWARE_RESET);
if (mcu & RST_POWER_ON) SERIAL_ECHOLNPGM(STR_POWERUP);
if (mcu & RST_EXTERNAL) SERIAL_ECHOLNPGM(STR_EXTERNAL_RESET);
if (mcu & RST_BROWN_OUT) SERIAL_ECHOLNPGM(STR_BROWNOUT_RESET);
if (mcu & RST_WATCHDOG) SERIAL_ECHOLNPGM(STR_WATCHDOG_RESET);
if (mcu & RST_SOFTWARE) SERIAL_ECHOLNPGM(STR_SOFTWARE_RESET);
HAL_clear_reset_source();

serialprintPGM(GET_TEXT(MSG_MARLIN));
Expand Down Expand Up @@ -1136,7 +1136,7 @@ void setup() {
#endif

#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
SETUP_RUN(init_closedloop());
SETUP_RUN(closedloop.init());
#endif

#ifdef STARTUP_COMMANDS
Expand Down Expand Up @@ -1180,7 +1180,8 @@ void setup() {
SETUP_RUN(page_manager.init());
#endif

#if ENABLED(TFT_LITTLE_VGL_UI)
#if ENABLED(TFT_LVGL_UI)
if (!card.isMounted()) SETUP_RUN(card.mount()); // Mount SD to load graphics and fonts
SETUP_RUN(tft_lvgl_init());
#endif

Expand Down Expand Up @@ -1216,7 +1217,7 @@ void loop() {

endstops.event_handler();

TERN_(TFT_LITTLE_VGL_UI, printer_state_polling());
TERN_(TFT_LVGL_UI, printer_state_polling());

} while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
}
1 change: 1 addition & 0 deletions Marlin/src/core/language.h
Expand Up @@ -65,6 +65,7 @@
// pl Polish
// pt Portuguese
// pt_br Portuguese (Brazilian)
// ro Romanian
// ru Russian
// sk Slovak
// tr Turkish
Expand Down
6 changes: 4 additions & 2 deletions Marlin/src/feature/closedloop.cpp
Expand Up @@ -29,12 +29,14 @@

#include "closedloop.h"

void init_closedloop() {
ClosedLoop closedloop;

void ClosedLoop::init() {
OUT_WRITE(CLOSED_LOOP_ENABLE_PIN, LOW);
SET_INPUT_PULLUP(CLOSED_LOOP_MOVE_COMPLETE_PIN);
}

void set_closedloop(const byte val) {
void ClosedLoop::set(const byte val) {
OUT_WRITE(CLOSED_LOOP_ENABLE_PIN, val);
}

Expand Down
11 changes: 9 additions & 2 deletions Marlin/src/feature/closedloop.h
Expand Up @@ -21,5 +21,12 @@
*/
#pragma once

void init_closedloop();
void set_closedloop(const byte val);
class ClosedLoop {
public:
static void init();
static void set(const byte val);
};

extern ClosedLoop closedloop;

#define CLOSED_LOOP_WAITING() (READ(CLOSED_LOOP_ENABLE_PIN) && !READ(CLOSED_LOOP_MOVE_COMPLETE_PIN))
15 changes: 13 additions & 2 deletions Marlin/src/feature/runout.cpp
Expand Up @@ -40,6 +40,7 @@ bool FilamentMonitorBase::enabled = true,
#endif

#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
//#define DEBUG_TOOLCHANGE_MIGRATION_FEATURE
#include "../module/tool_change.h"
#endif

Expand Down Expand Up @@ -80,8 +81,18 @@ void event_filament_runout() {
if (TERN0(ADVANCED_PAUSE_FEATURE, did_pause_print)) return; // Action already in progress. Purge triggered repeated runout.

#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
if (migration.in_progress) return; // Action already in progress. Purge triggered repeated runout.
if (migration.automode) { extruder_migration(); return; }
if (migration.in_progress) {
#if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
SERIAL_ECHOLN("Migration Already In Progress");
#endif
return; // Action already in progress. Purge triggered repeated runout.
}
if (migration.automode) {
#if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
SERIAL_ECHOLN("Migration Starting");
#endif
if (extruder_migration()) return;
}
#endif

TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getActiveTool()));
Expand Down
56 changes: 29 additions & 27 deletions Marlin/src/feature/touch/xpt2046.cpp
Expand Up @@ -101,39 +101,41 @@ void XPT2046::init() {
#include "../../lcd/ultralcd.h" // For EN_C bit mask

uint8_t XPT2046::read_buttons() {
int16_t tsoffsets[4] = { 0 };

if (tsoffsets[0] + tsoffsets[1] == 0) {
// Not yet set, so use defines as fallback...
tsoffsets[0] = XPT2046_X_CALIBRATION;
tsoffsets[1] = XPT2046_X_OFFSET;
tsoffsets[2] = XPT2046_Y_CALIBRATION;
tsoffsets[3] = XPT2046_Y_OFFSET;
}
#ifdef HAS_SPI_LCD
int16_t tsoffsets[4] = { 0 };

if (tsoffsets[0] + tsoffsets[1] == 0) {
// Not yet set, so use defines as fallback...
tsoffsets[0] = XPT2046_X_CALIBRATION;
tsoffsets[1] = XPT2046_X_OFFSET;
tsoffsets[2] = XPT2046_Y_CALIBRATION;
tsoffsets[3] = XPT2046_Y_OFFSET;
}

// We rely on XPT2046 compatible mode to ADS7843, hence no Z1 and Z2 measurements possible.
// We rely on XPT2046 compatible mode to ADS7843, hence no Z1 and Z2 measurements possible.

if (!isTouched()) return 0;
const uint16_t x = uint16_t(((uint32_t(getInTouch(XPT2046_X))) * tsoffsets[0]) >> 16) + tsoffsets[1],
y = uint16_t(((uint32_t(getInTouch(XPT2046_Y))) * tsoffsets[2]) >> 16) + tsoffsets[3];
if (!isTouched()) return 0; // Fingers must still be on the TS for a valid read.
if (!isTouched()) return 0;
const uint16_t x = uint16_t(((uint32_t(getInTouch(XPT2046_X))) * tsoffsets[0]) >> 16) + tsoffsets[1],
y = uint16_t(((uint32_t(getInTouch(XPT2046_Y))) * tsoffsets[2]) >> 16) + tsoffsets[3];
if (!isTouched()) return 0; // Fingers must still be on the TS for a valid read.

// 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;
// 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;

if (x > TOUCH_SCREEN_WIDTH || !WITHIN(y, SCREEN_START_TOP, SCREEN_START_TOP + SCREEN_HEIGHT)) return 0;
if (x > TOUCH_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),
row = (y - (SCREEN_START_TOP)) * (LCD_HEIGHT) / (TOUCHABLE_Y_HEIGHT);
// Column and row above BUTTON_AREA_TOP
int8_t col = (x - (SCREEN_START_LEFT)) * (LCD_WIDTH) / (TOUCHABLE_X_WIDTH),
row = (y - (SCREEN_START_TOP)) * (LCD_HEIGHT) / (TOUCHABLE_Y_HEIGHT);

// Send the touch to the UI (which will simulate the encoder wheel)
MarlinUI::screen_click(row, col, x, y);
// Send the touch to the UI (which will simulate the encoder wheel)
MarlinUI::screen_click(row, col, x, y);
#endif
return 0;
}

Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/gcode/calibrate/M12.cpp
Expand Up @@ -28,9 +28,12 @@
#include "../../feature/closedloop.h"

void GcodeSuite::M12() {

planner.synchronize();

if (parser.seenval('S'))
set_closedloop(parser.value_int()); // Force a CLC set
closedloop.set(parser.value_int()); // Force a CLC set

}

#endif
8 changes: 7 additions & 1 deletion Marlin/src/gcode/calibrate/M665.cpp
Expand Up @@ -38,8 +38,11 @@
* R = delta radius
* S = segments per second
* X = Alpha (Tower 1) angle trim
* Y = Beta (Tower 2) angle trim
* Y = Beta (Tower 2) angle trim
* Z = Gamma (Tower 3) angle trim
* A = Alpha (Tower 1) digonal rod trim
* B = Beta (Tower 2) digonal rod trim
* C = Gamma (Tower 3) digonal rod trim
*/
void GcodeSuite::M665() {
if (parser.seen('H')) delta_height = parser.value_linear_units();
Expand All @@ -49,6 +52,9 @@
if (parser.seen('X')) delta_tower_angle_trim.a = parser.value_float();
if (parser.seen('Y')) delta_tower_angle_trim.b = parser.value_float();
if (parser.seen('Z')) delta_tower_angle_trim.c = parser.value_float();
if (parser.seen('A')) delta_diagonal_rod_trim.a = parser.value_float();
if (parser.seen('B')) delta_diagonal_rod_trim.b = parser.value_float();
if (parser.seen('C')) delta_diagonal_rod_trim.c = parser.value_float();
recalc_delta_settings();
}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/config/M217.cpp
Expand Up @@ -49,7 +49,7 @@ void M217_report(const bool eeprom=false) {
" G", toolchange_settings.fan_time);

#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
SERIAL_ECHOPAIR(" N", int(migration.automode));
SERIAL_ECHOPAIR(" A", int(migration.automode));
SERIAL_ECHOPAIR(" L", LINEAR_UNIT(migration.last));
#endif

Expand Down

0 comments on commit 626ed70

Please sign in to comment.