Skip to content

Commit

Permalink
core update to Marlin 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellodum committed Oct 2, 2021
1 parent 7ebe94f commit 3aa127d
Show file tree
Hide file tree
Showing 38 changed files with 1,160 additions and 566 deletions.
4 changes: 2 additions & 2 deletions Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/**
* Marlin release version identifier
*/
//#define SHORT_BUILD_VERSION "2.0.2"
//#define SHORT_BUILD_VERSION "2.0.3"

/**
* Verbose version identifier which should contain a reference to the location
Expand All @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2020-01-27"
//#define STRING_DISTRIBUTION_DATE "2020-01-31"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
52 changes: 17 additions & 35 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,36 +291,36 @@ void quickstop_stepper() {
}

void enable_e_steppers() {
#define _ENA_E(N) enable_E##N();
#define _ENA_E(N) ENABLE_AXIS_E##N();
REPEAT(E_STEPPERS, _ENA_E)
}

void enable_all_steppers() {
#if ENABLED(AUTO_POWER_CONTROL)
powerManager.power_on();
#endif
enable_X();
enable_Y();
enable_Z();
ENABLE_AXIS_X();
ENABLE_AXIS_Y();
ENABLE_AXIS_Z();
enable_e_steppers();
}

void disable_e_steppers() {
#define _DIS_E(N) disable_E##N();
#define _DIS_E(N) DISABLE_AXIS_E##N();
REPEAT(E_STEPPERS, _DIS_E)
}

void disable_e_stepper(const uint8_t e) {
#define _CASE_DIS_E(N) case N: disable_E##N(); break;
#define _CASE_DIS_E(N) case N: DISABLE_AXIS_E##N(); break;
switch (e) {
REPEAT(EXTRUDERS, _CASE_DIS_E)
}
}

void disable_all_steppers() {
disable_X();
disable_Y();
disable_Z();
DISABLE_AXIS_X();
DISABLE_AXIS_Y();
DISABLE_AXIS_Z();
disable_e_steppers();
}

Expand Down Expand Up @@ -461,13 +461,13 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
if (!already_shutdown_steppers) {
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
#if ENABLED(DISABLE_INACTIVE_X)
disable_X();
DISABLE_AXIS_X();
#endif
#if ENABLED(DISABLE_INACTIVE_Y)
disable_Y();
DISABLE_AXIS_Y();
#endif
#if ENABLED(DISABLE_INACTIVE_Z)
disable_Z();
DISABLE_AXIS_Z();
#endif
#if ENABLED(DISABLE_INACTIVE_E)
disable_e_steppers();
Expand Down Expand Up @@ -542,19 +542,19 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
#if ENABLED(SWITCHING_EXTRUDER)
bool oldstatus;
switch (active_extruder) {
default: oldstatus = E0_ENABLE_READ(); enable_E0(); break;
default: oldstatus = E0_ENABLE_READ(); ENABLE_AXIS_E0(); break;
#if E_STEPPERS > 1
case 2: case 3: oldstatus = E1_ENABLE_READ(); enable_E1(); break;
case 2: case 3: oldstatus = E1_ENABLE_READ(); ENABLE_AXIS_E1(); break;
#if E_STEPPERS > 2
case 4: case 5: oldstatus = E2_ENABLE_READ(); enable_E2(); break;
case 4: case 5: oldstatus = E2_ENABLE_READ(); ENABLE_AXIS_E2(); break;
#endif // E_STEPPERS > 2
#endif // E_STEPPERS > 1
}
#else // !SWITCHING_EXTRUDER
bool oldstatus;
switch (active_extruder) {
default:
#define _CASE_EN(N) case N: oldstatus = E##N##_ENABLE_READ(); enable_E##N(); break;
#define _CASE_EN(N) case N: oldstatus = E##N##_ENABLE_READ(); ENABLE_AXIS_E##N(); break;
REPEAT(E_STEPPERS, _CASE_EN);
}
#endif
Expand Down Expand Up @@ -819,8 +819,6 @@ void stop() {
* • Z probe sled
* • status LEDs
*/
void NVIC_SetPriorityGrouping(uint32_t PriorityGroup);
void LCD_Setup();
void setup() {

HAL_init();
Expand Down Expand Up @@ -854,18 +852,6 @@ void setup() {
#error "DISABLE_JTAG is not supported for the selected MCU/Board"
#endif
#endif

NVIC_SetPriorityGrouping(0x3);

//LCD_Setup();

#if PIN_EXISTS(LED)
OUT_WRITE(LED_PIN, LOW);
#endif

#if PIN_EXISTS(USB_CONNECT)
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
#endif

#if HAS_FILAMENT_SENSOR
runout.setup();
Expand Down Expand Up @@ -1136,10 +1122,6 @@ void setup() {
#if ENABLED(PRUSA_MMU2)
mmu2.init();
#endif

#if PIN_EXISTS(USB_CONNECT) // Give OS time to notice
OUT_WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
#endif
}

/**
Expand Down Expand Up @@ -1169,4 +1151,4 @@ void loop() {
|| true // Loop forever on slower (AVR) boards
#endif
);
}
}
25 changes: 18 additions & 7 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,23 @@

#define _AXIS(A) (A##_AXIS)

#define _XMIN_ 100
#define _YMIN_ 200
#define _ZMIN_ 300
#define _XMAX_ 101
#define _YMAX_ 201
#define _ZMAX_ 301
#define _XMIN_ 100
#define _YMIN_ 200
#define _ZMIN_ 300
#define _XMAX_ 101
#define _YMAX_ 201
#define _ZMAX_ 301
#define _XDIAG_ 102
#define _YDIAG_ 202
#define _ZDIAG_ 302
#define _E0DIAG_ 400
#define _E1DIAG_ 401
#define _E2DIAG_ 402
#define _E3DIAG_ 403
#define _E4DIAG_ 404
#define _E5DIAG_ 405
#define _E6DIAG_ 406
#define _E7DIAG_ 407

#define _FORCE_INLINE_ __attribute__((__always_inline__)) __inline__
#define FORCE_INLINE __attribute__((always_inline)) inline
Expand Down Expand Up @@ -445,4 +456,4 @@

// Repeat a macro passing 0...N-1 plus additional arguments.
#define REPEAT2_S(S,N,OP,V...) EVAL(_REPEAT2(S,SUB##S(N),OP,V))
#define REPEAT2(N,OP,V...) REPEAT2_S(0,N,OP,V)
#define REPEAT2(N,OP,V...) REPEAT2_S(0,N,OP,V)
4 changes: 2 additions & 2 deletions Marlin/src/feature/babystep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
#endif

#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
#define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: enable_X(); break; case Y_AXIS: enable_Y(); break; case Z_AXIS: enable_Z(); break; default: break; } }while(0)
#define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: ENABLE_AXIS_X(); break; case Y_AXIS: ENABLE_AXIS_Y(); break; case Z_AXIS: ENABLE_AXIS_Z(); break; default: break; } }while(0)
#else
#define BSA_ENABLE(AXIS) NOOP
#endif
Expand Down Expand Up @@ -127,4 +127,4 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
#endif
}

#endif // BABYSTEPPING
#endif // BABYSTEPPING
4 changes: 2 additions & 2 deletions Marlin/src/feature/binary_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class BinaryStream {
uint8_t protocol() { return (meta >> 4) & 0xF; }
uint8_t type() { return meta & 0xF; }
void reset() { token = 0; sync = 0; meta = 0; size = 0; checksum = 0; }
uint8_t data[1];
uint8_t data[2];
};

union Footer {
Expand Down Expand Up @@ -477,4 +477,4 @@ class BinaryStream {
StreamState stream_state = StreamState::PACKET_RESET;
};

extern BinaryStream binaryStream[NUM_SERIAL];
extern BinaryStream binaryStream[NUM_SERIAL];
6 changes: 3 additions & 3 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
#endif

// Re-enable the heaters if they timed out
HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e);
HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e);

// Wait for the heaters to reach the target temperatures
ensure_safe_temperature();
Expand Down Expand Up @@ -633,7 +633,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
bool nozzle_timed_out = false;
HOTEND_LOOP() {
nozzle_timed_out |= thermalManager.hotend_idle[e].timed_out;
thermalManager.reset_heater_idle_timer(e);
thermalManager.reset_hotend_idle_timer(e);
}

if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament
Expand Down Expand Up @@ -709,4 +709,4 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
#endif
}

#endif // ADVANCED_PAUSE_FEATURE
#endif // ADVANCED_PAUSE_FEATURE
8 changes: 4 additions & 4 deletions Marlin/src/feature/probe_temp_compensation.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class ProbeTempComp {
public:

static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
{ 30, 10, 5, 30 + 10 * 5 }, // Probe
{ 60, 10, 5, 60 + 10 * 5 }, // Bed
{ 10, 5, 30, 30 + 10 * 5 }, // Probe
{ 10, 5, 60, 60 + 10 * 5 }, // Bed
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
{ 180, 5, 20, 180 + 5 * 20 } // Extruder
{ 20, 5, 180, 180 + 5 * 20 } // Extruder
#endif
};
static const temp_calib_t cali_info[TSI_COUNT];
Expand Down Expand Up @@ -113,4 +113,4 @@ class ProbeTempComp {
static bool linear_regression(const TempSensorID tsi, float &k, float &d);
};

extern ProbeTempComp temp_comp;
extern ProbeTempComp temp_comp;
18 changes: 9 additions & 9 deletions Marlin/src/feature/prusa_MMU2/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ void MMU2::tool_change(uint8_t index) {

if (index != extruder) {

disable_E0();
DISABLE_AXIS_E0();
ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1));

command(MMU_CMD_T0 + index);
Expand All @@ -459,7 +459,7 @@ void MMU2::tool_change(uint8_t index) {
extruder = index; //filament change is finished
active_extruder = 0;

enable_E0();
ENABLE_AXIS_E0();

SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, int(extruder));
Expand Down Expand Up @@ -497,13 +497,13 @@ void MMU2::tool_change(const char* special) {
case 'x': {
planner.synchronize();
uint8_t index = mmu2_choose_filament();
disable_E0();
DISABLE_AXIS_E0();
command(MMU_CMD_T0 + index);
manage_response(true, true);
command(MMU_CMD_C0);
mmu_loop();

enable_E0();
ENABLE_AXIS_E0();
extruder = index;
active_extruder = 0;
} break;
Expand Down Expand Up @@ -697,7 +697,7 @@ void MMU2::filament_runout() {

LCD_MESSAGEPGM(MSG_MMU2_EJECTING_FILAMENT);

enable_E0();
ENABLE_AXIS_E0();
current_position.e -= MMU2_FILAMENTCHANGE_EJECT_FEED;
line_to_current_position(2500 / 60);
planner.synchronize();
Expand Down Expand Up @@ -731,7 +731,7 @@ void MMU2::filament_runout() {

BUZZ(200, 404);

disable_E0();
DISABLE_AXIS_E0();

return true;
}
Expand Down Expand Up @@ -776,7 +776,7 @@ void MMU2::filament_runout() {
void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) {

planner.synchronize();
enable_E0();
ENABLE_AXIS_E0();

const E_Step* step = sequence;

Expand All @@ -794,9 +794,9 @@ void MMU2::filament_runout() {
step++;
}

disable_E0();
DISABLE_AXIS_E0();
}

#endif // HAS_LCD_MENU && MMU2_MENUS

#endif // PRUSA_MMU2
#endif // PRUSA_MMU2
10 changes: 5 additions & 5 deletions Marlin/src/gcode/calibrate/G76_M871.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void GcodeSuite::G76() {

// Initialize temperatures
uint16_t target_bed = temp_comp.probe_calib_bed_temp,
target_probe = temp_comp.cali_info_init[TSI_BED].start_temp;
target_probe = temp_comp.cali_info_init[TSI_PROBE].start_temp;
thermalManager.setTargetBed(target_bed);
SERIAL_ECHOLNPGM("Waiting for bed and probe temperature.");
while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1f
Expand Down Expand Up @@ -332,13 +332,13 @@ void GcodeSuite::G76() {
else
SERIAL_ECHOLNPAIR_F("Measured: ", measured_z);

if (target_probe == temp_comp.cali_info_init[TSI_BED].start_temp)
if (target_probe == temp_comp.cali_info_init[TSI_PROBE].start_temp)
temp_comp.prepare_new_calibration(measured_z);
else
temp_comp.push_back_new_measurement(TSI_PROBE, measured_z);

target_probe += temp_comp.cali_info_init[TSI_BED].temp_res;
if (target_probe > temp_comp.cali_info_init[TSI_BED].end_temp) break;
target_probe += temp_comp.cali_info_init[TSI_PROBE].temp_res;
if (target_probe > temp_comp.cali_info_init[TSI_PROBE].end_temp) break;
}

SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
Expand Down Expand Up @@ -404,4 +404,4 @@ void GcodeSuite::M871() {
temp_comp.print_offsets();
}

#endif // PROBE_TEMP_COMPENSATION
#endif // PROBE_TEMP_COMPENSATION
5 changes: 4 additions & 1 deletion Marlin/src/gcode/calibrate/M48.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
*
* This function requires the machine to be homed before invocation.
*/

extern const char SP_Y_STR[];

void GcodeSuite::M48() {

if (axis_unhomed_error()) return;
Expand Down Expand Up @@ -267,4 +270,4 @@ void GcodeSuite::M48() {
report_current_position();
}

#endif // Z_MIN_PROBE_REPEATABILITY_TEST
#endif // Z_MIN_PROBE_REPEATABILITY_TEST
Loading

0 comments on commit 3aa127d

Please sign in to comment.