Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix 2.0.x #47

Merged
merged 24 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
03a4102
[cron] Bump distribution date (2021-03-12)
thinkyhead Mar 12, 2021
6e10247
Lerdge-X I²C EEPROM pins, size (#21322)
Evg33 Mar 12, 2021
9dc2712
Undef unused 2nd serial option(s) (#21331)
X-Ryl669 Mar 12, 2021
1affbe2
Clean up, optimize ExtUI/TFT code (#21333)
thinkyhead Mar 12, 2021
8532c2b
Fix MarlinSerial typo
thinkyhead Mar 12, 2021
71f2617
Pause SD queue early on M25 (#21317)
thinkyhead Mar 12, 2021
604c5de
MarlinSerial cleanup
thinkyhead Mar 6, 2021
7f1fa0d
Add M207/8/9 reporting (#21335)
thinkyhead Mar 12, 2021
3107d8a
Tweak opt_set, opt_enable
thinkyhead Mar 12, 2021
11343bb
[cron] Bump distribution date (2021-03-13)
thinkyhead Mar 13, 2021
da84b59
No extra build folder for st/jlink upload (#21341)
rhapsodyv Mar 13, 2021
911cd1a
Custom menu items confirm option (#21338)
InsanityAutomation Mar 13, 2021
36d3b6a
[cron] Bump distribution date (2021-03-14)
thinkyhead Mar 14, 2021
b9b9a31
Update display timing for SKR Pro (#21346)
XDA-Bam Mar 14, 2021
cc3e878
Fix small wired EEPROM (#21337)
thinkyhead Mar 14, 2021
d787cd3
Fix build with Meatpack only on 2nd port (#21336)
X-Ryl669 Mar 14, 2021
4f6910c
Script to generate Marlin TFT Images (#21340)
rhapsodyv Mar 14, 2021
ae8be31
[cron] Bump distribution date (2021-03-15)
thinkyhead Mar 15, 2021
c07f99d
Teensy USB / serial followup (#21316)
X-Ryl669 Mar 15, 2021
1a23ffd
KRATOS32 / K.32 board and LCD controllers (#21334)
KA8888 Mar 15, 2021
5ffa6f3
[cron] Bump distribution date (2021-03-16)
thinkyhead Mar 16, 2021
dc78e0a
Detect extra ENVS in preflight checks (#21361)
thinkyhead Mar 16, 2021
546e56e
[cron] Bump distribution date (2021-03-17)
thinkyhead Mar 17, 2021
60607ed
mftest: usage with error
thinkyhead Mar 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2181,6 +2181,11 @@
//
//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER

//
// K.3D Full Graphic Smart Controller
//
//#define K3D_FULL_GRAPHIC_SMART_CONTROLLER

//
// ReprapWorld Graphical LCD
// https://reprapworld.com/?products_details&products_id/1218
Expand Down Expand Up @@ -2318,7 +2323,7 @@
//#define OLED_PANEL_TINYBOY2

//
// MKS OLED 1.3" 128×64 FULL GRAPHICS CONTROLLER
// MKS OLED 1.3" 128×64 Full Graphics Controller
// https://reprap.org/wiki/MKS_12864OLED
//
// Tiny, but very sharp OLED display
Expand All @@ -2327,7 +2332,7 @@
//#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller

//
// Zonestar OLED 128×64 FULL GRAPHICS CONTROLLER
// Zonestar OLED 128×64 Full Graphics Controller
//
//#define ZONESTAR_12864LCD // Graphical (DOGM) with ST7920 controller
//#define ZONESTAR_12864OLED // 1.3" OLED with SH1106 controller (default)
Expand All @@ -2344,10 +2349,15 @@
//#define OVERLORD_OLED

//
// FYSETC OLED 2.42" 128×64 FULL GRAPHICS CONTROLLER with WS2812 RGB
// FYSETC OLED 2.42" 128×64 Full Graphics Controller with WS2812 RGB
// Where to find : https://www.aliexpress.com/item/4000345255731.html
//#define FYSETC_242_OLED_12864 // Uses the SSD1309 controller

//
// K.3D SSD1309 OLED 2.42" 128×64 Full Graphics Controller
//
//#define K3D_242_OLED_CONTROLLER // Software SPI

//=============================================================================
//========================== Extensible UI Displays ===========================
//=============================================================================
Expand Down
8 changes: 7 additions & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3455,22 +3455,28 @@
//#define CUSTOM_USER_MENU_TITLE "Custom Commands"
#define USER_SCRIPT_DONE "M117 User Script Done"
#define USER_SCRIPT_AUDIBLE_FEEDBACK
//#define USER_SCRIPT_RETURN // Return to status screen after a script
//#define USER_SCRIPT_RETURN // Return to status screen after a script
#define CUSTOM_MENU_ONLY_IDLE // Only show custom menu when the machine is idle

#define USER_DESC_1 "Home & UBL Info"
#define USER_GCODE_1 "G28\nG29W"
//#define USER_CONFIRM_1 // Show a confirmation dialog before this action

#define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL
#define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
//#define USER_CONFIRM_2

#define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL
#define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND)
//#define USER_CONFIRM_3

#define USER_DESC_4 "Heat Bed/Home/Level"
#define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
//#define USER_CONFIRM_4

#define USER_DESC_5 "Home & Info"
#define USER_GCODE_5 "G28\nM503"
//#define USER_CONFIRM_5
#endif

/**
Expand Down
33 changes: 11 additions & 22 deletions Marlin/src/HAL/AVR/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@
template <uint8_t serial>
struct MMU2SerialCfg {
static constexpr int PORT = serial;
static constexpr unsigned int RX_SIZE = 32;
static constexpr unsigned int TX_SIZE = 32;
static constexpr bool XONOFF = false;
static constexpr bool EMERGENCYPARSER = false;
static constexpr bool DROPPED_RX = false;
static constexpr bool RX_FRAMING_ERRORS = false;
static constexpr bool MAX_RX_QUEUED = false;
static constexpr unsigned int RX_SIZE = 32;
static constexpr unsigned int TX_SIZE = 32;
static constexpr bool RX_OVERRUNS = false;
};

Expand All @@ -270,28 +270,17 @@

template <uint8_t serial>
struct LCDSerialCfg {
static constexpr int PORT = serial;
static constexpr bool XONOFF = false;
static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
static constexpr bool DROPPED_RX = false;
static constexpr bool RX_FRAMING_ERRORS = false;
static constexpr bool MAX_RX_QUEUED = false;
#if HAS_DGUS_LCD
static constexpr unsigned int RX_SIZE = DGUS_RX_BUFFER_SIZE;
static constexpr unsigned int TX_SIZE = DGUS_TX_BUFFER_SIZE;
static constexpr bool RX_OVERRUNS = ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS);
#elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
static constexpr unsigned int RX_SIZE = 64;
static constexpr unsigned int TX_SIZE = 128;
static constexpr bool RX_OVERRUNS = false;
#else
static constexpr unsigned int RX_SIZE = 64;
static constexpr unsigned int TX_SIZE = 128;
static constexpr bool RX_OVERRUNS = false
#endif
static constexpr int PORT = serial;
static constexpr unsigned int RX_SIZE = TERN(HAS_DGUS_LCD, DGUS_RX_BUFFER_SIZE, 64);
static constexpr unsigned int TX_SIZE = TERN(HAS_DGUS_LCD, DGUS_TX_BUFFER_SIZE, 128);
static constexpr bool XONOFF = false;
static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
static constexpr bool DROPPED_RX = false;
static constexpr bool RX_FRAMING_ERRORS = false;
static constexpr bool MAX_RX_QUEUED = false;
static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS);
};


typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
extern MSerialT4 lcdSerial;
#endif
Expand Down
6 changes: 0 additions & 6 deletions Marlin/src/HAL/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@

#include HAL_PATH(.,HAL.h)

#ifdef SERIAL_PORT_2
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif

#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)

#ifndef I2C_ADDRESS
Expand Down
6 changes: 5 additions & 1 deletion Marlin/src/HAL/TEENSY31_32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@

#include <Wire.h>

DefaultSerial1 MSerial0(false);
#define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X)
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3)
IMPLEMENT_SERIAL(SERIAL_PORT);
#endif
USBSerialType USBSerial(false, SerialUSB);

uint16_t HAL_adc_result;
Expand Down
10 changes: 8 additions & 2 deletions Marlin/src/HAL/TEENSY31_32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@
#endif

#include "../../core/serial_hook.h"
typedef Serial1Class<decltype(Serial)> DefaultSerial1;
extern DefaultSerial1 MSerial0;

#define Serial0 Serial
#define _DECLARE_SERIAL(X) \
typedef ForwardSerial1Class<decltype(Serial##X)> DefaultSerial##X; \
extern DefaultSerial##X MSerial##X
#define DECLARE_SERIAL(X) _DECLARE_SERIAL(X)

typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
extern USBSerialType USBSerial;

Expand All @@ -62,6 +67,7 @@ extern USBSerialType USBSerial;
#if SERIAL_PORT == -1
#define MYSERIAL1 USBSerial
#elif WITHIN(SERIAL_PORT, 0, 3)
DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/TEENSY35_36/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include <Wire.h>

#define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false)
#define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X)
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3)
IMPLEMENT_SERIAL(SERIAL_PORT);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/TEENSY35_36/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

#define Serial0 Serial
#define _DECLARE_SERIAL(X) \
typedef Serial1Class<decltype(Serial##X)> DefaultSerial##X; \
typedef ForwardSerial1Class<decltype(Serial##X)> DefaultSerial##X; \
extern DefaultSerial##X MSerial##X
#define DECLARE_SERIAL(X) _DECLARE_SERIAL(X)

Expand Down
6 changes: 5 additions & 1 deletion Marlin/src/HAL/TEENSY40_41/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@

#include <Wire.h>

DefaultSerial1 MSerial0(false);
#define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X)
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3)
IMPLEMENT_SERIAL(SERIAL_PORT);
#endif
USBSerialType USBSerial(false, SerialUSB);

uint16_t HAL_adc_result, HAL_adc_select;
Expand Down
9 changes: 7 additions & 2 deletions Marlin/src/HAL/TEENSY40_41/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@
#endif

#include "../../core/serial_hook.h"
typedef Serial1Class<decltype(Serial)> DefaultSerial1;
extern DefaultSerial1 MSerial0;
#define Serial0 Serial
#define _DECLARE_SERIAL(X) \
typedef ForwardSerial1Class<decltype(Serial##X)> DefaultSerial##X; \
extern DefaultSerial##X MSerial##X
#define DECLARE_SERIAL(X) _DECLARE_SERIAL(X)

typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
extern USBSerialType USBSerial;

Expand All @@ -67,6 +71,7 @@ extern USBSerialType USBSerial;
#if SERIAL_PORT == -1
#define MYSERIAL1 SerialUSB
#elif WITHIN(SERIAL_PORT, 0, 8)
DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."
Expand Down
25 changes: 18 additions & 7 deletions Marlin/src/HAL/shared/eeprom_if_i2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,26 @@ void eeprom_init() {

static constexpr uint8_t eeprom_device_address = I2C_ADDRESS(EEPROM_DEVICE_ADDRESS);

void _beginTransmission(const uint16_t memoryAddress) {
if (MARLIN_EEPROM_SIZE > 0x4000) { // Use two-byte addressing for EEPROMs >16kb
Wire.beginTransmission(eeprom_device_address);
Wire.write(memoryAddress >> 8); // Address High Byte
}
else {
const uint8_t addr = eeprom_device_address | byte((memoryAddress >> 8) & 0x07);
Wire.beginTransmission(addr);
}
Wire.write(memoryAddress & 0xFF); // Address Low Byte (or only byte for chips <= 16Kb like 24C02/04/08/16)
}

// ------------------------
// Public functions
// ------------------------

void eeprom_write_byte(uint8_t *pos, unsigned char value) {
const unsigned eeprom_address = (unsigned)pos;

Wire.beginTransmission(eeprom_device_address);
Wire.write(int(eeprom_address >> 8)); // MSB
Wire.write(int(eeprom_address & 0xFF)); // LSB
_beginTransmission(eeprom_address);
Wire.write(value);
Wire.endTransmission();

Expand All @@ -72,11 +82,12 @@ void eeprom_write_byte(uint8_t *pos, unsigned char value) {
uint8_t eeprom_read_byte(uint8_t *pos) {
const unsigned eeprom_address = (unsigned)pos;

Wire.beginTransmission(eeprom_device_address);
Wire.write(int(eeprom_address >> 8)); // MSB
Wire.write(int(eeprom_address & 0xFF)); // LSB
_beginTransmission(eeprom_address);
Wire.endTransmission();
Wire.requestFrom(eeprom_device_address, (byte)1);

// For EEPROMs <=16Kb the lower address bits are used for 2Kb page address
const int addr = eeprom_device_address | (MARLIN_EEPROM_SIZE <= 0x4000 ? byte((eeprom_address >> 8) & 0x07) : byte(0));
Wire.requestFrom(addr, byte(1));
return Wire.available() ? Wire.read() : 0xFF;
}

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 @@ -279,6 +279,7 @@
#define BOARD_ARCHIM2 3024 // UltiMachine Archim2 (with TMC2130 drivers)
#define BOARD_ALLIGATOR 3025 // Alligator Board R2
#define BOARD_CNCONTROLS_15D 3026 // Cartesio CN Controls V15 on DUE
#define BOARD_KRATOS32 3027 // K.3D Kratos32 (Arduino Due Shield)

//
// SAM3X8C ARM Cortex M3
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/bedlevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ TemporaryBedLevelingState::TemporaryBedLevelingState(const bool enable) : saved(

#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)

void set_z_fade_height(const float zfh, const bool do_report/*=true*/) {
void set_z_fade_height(const float &zfh, const bool do_report/*=true*/) {

if (planner.z_fade_height == zfh) return;

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/bedlevel.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void set_bed_leveling_enabled(const bool enable=true);
void reset_bed_level();

#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
void set_z_fade_height(const float zfh, const bool do_report=true);
void set_z_fade_height(const float &zfh, const bool do_report=true);
#endif

#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY)
Expand Down
76 changes: 76 additions & 0 deletions Marlin/src/feature/fwretract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ FWRetract fwretract; // Single instance - this calls the constructor
#include "../module/planner.h"
#include "../module/stepper.h"

#include "../gcode/parser.h"

#if ENABLED(RETRACT_SYNC_MIXING)
#include "mixing.h"
#endif
Expand Down Expand Up @@ -198,4 +200,78 @@ void FWRetract::retract(const bool retracting
//*/
}

//extern const char SP_Z_STR[];

/**
* M207: Set firmware retraction values
*
* S[+units] retract_length
* W[+units] swap_retract_length (multi-extruder)
* F[units/min] retract_feedrate_mm_s
* Z[units] retract_zraise
*/
void FWRetract::M207() {
if (!parser.seen("FSWZ")) return M207_report();
if (parser.seen('S')) settings.retract_length = parser.value_axis_units(E_AXIS);
if (parser.seen('F')) settings.retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
if (parser.seen('Z')) settings.retract_zraise = parser.value_linear_units();
if (parser.seen('W')) settings.swap_retract_length = parser.value_axis_units(E_AXIS);
}

void FWRetract::M207_report(const bool forReplay/*=false*/) {
if (!forReplay) { SERIAL_ECHO_MSG("; Retract: S<length> F<units/m> Z<lift>"); SERIAL_ECHO_START(); }
SERIAL_ECHOLNPAIR_P(
PSTR(" M207 S"), LINEAR_UNIT(settings.retract_length)
, PSTR(" W"), LINEAR_UNIT(settings.swap_retract_length)
, PSTR(" F"), LINEAR_UNIT(MMS_TO_MMM(settings.retract_feedrate_mm_s))
, SP_Z_STR, LINEAR_UNIT(settings.retract_zraise)
);
}

/**
* M208: Set firmware un-retraction values
*
* S[+units] retract_recover_extra (in addition to M207 S*)
* W[+units] swap_retract_recover_extra (multi-extruder)
* F[units/min] retract_recover_feedrate_mm_s
* R[units/min] swap_retract_recover_feedrate_mm_s
*/
void FWRetract::M208() {
if (!parser.seen("FSRW")) return M208_report();
if (parser.seen('S')) settings.retract_recover_extra = parser.value_axis_units(E_AXIS);
if (parser.seen('F')) settings.retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
if (parser.seen('R')) settings.swap_retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
if (parser.seen('W')) settings.swap_retract_recover_extra = parser.value_axis_units(E_AXIS);
}

void FWRetract::M208_report(const bool forReplay/*=false*/) {
if (!forReplay) { SERIAL_ECHO_MSG("; Recover: S<length> F<units/m>"); SERIAL_ECHO_START(); }
SERIAL_ECHOLNPAIR(
" M208 S", LINEAR_UNIT(settings.retract_recover_extra)
, " W", LINEAR_UNIT(settings.swap_retract_recover_extra)
, " F", LINEAR_UNIT(MMS_TO_MMM(settings.retract_recover_feedrate_mm_s))
);
}

#if ENABLED(FWRETRACT_AUTORETRACT)

/**
* M209: Enable automatic retract (M209 S1)
* For slicers that don't support G10/11, reversed extrude-only
* moves will be classified as retraction.
*/
void FWRetract::M209() {
if (!parser.seen('S')) return M209_report();
if (MIN_AUTORETRACT <= MAX_AUTORETRACT)
enable_autoretract(parser.value_bool());
}

void FWRetract::M209_report(const bool forReplay/*=false*/) {
if (!forReplay) { SERIAL_ECHO_MSG("; Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover"); SERIAL_ECHO_START(); }
SERIAL_ECHOLNPAIR(" M209 S", autoretract_enabled);
}

#endif // FWRETRACT_AUTORETRACT


#endif // FWRETRACT
Loading