Skip to content

Commit

Permalink
Merge pull request #3 from MarlinFirmware/bugfix-2.0.x
Browse files Browse the repository at this point in the history
Bugfix 2.0.x
  • Loading branch information
bjh22 authored Apr 27, 2019
2 parents 45222ad + e43afb1 commit 4972bf8
Show file tree
Hide file tree
Showing 210 changed files with 1,589 additions and 680 deletions.
1 change: 1 addition & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,7 @@
// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
// However, control resolution will be halved for each increment;
// at zero value, there are 128 effective control positions.
// :[0,1,2,3,4,5,6,7]
#define SOFT_PWM_SCALE 0

// If SOFT_PWM_SCALE is set to a value higher than 0, dithering can
Expand Down
20 changes: 14 additions & 6 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -995,18 +995,26 @@
//#define MARLIN_INVADERS
//#define MARLIN_SNAKE

// Frivolous Game Options
//#define MARLIN_BRICKOUT
//#define MARLIN_INVADERS
//#define MARLIN_SNAKE

#endif // HAS_GRAPHICAL_LCD

// @section safety

// The hardware watchdog should reset the microcontroller disabling all outputs,
// in case the firmware gets stuck and doesn't do temperature regulation.
/**
* The watchdog hardware timer will do a reset and disable all outputs
* if the firmware gets too overloaded to read the temperature sensors.
*
* If you find that watchdog reboot causes your AVR board to hang forever,
* enable WATCHDOG_RESET_MANUAL to use a custom timer instead of WDTO.
* NOTE: This method is less reliable as it can only catch hangups while
* interrupts are enabled.
*/
#define USE_WATCHDOG

#if ENABLED(USE_WATCHDOG)
// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
// However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
//#define WATCHDOG_RESET_MANUAL
#endif

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void watchdog_init() {
#define WDTO_NS WDTO_4S
#endif
#if ENABLED(WATCHDOG_RESET_MANUAL)
// We enable the watchdog timer, but only for the interrupt.
// Enable the watchdog timer, but only for the interrupt.
// Take care, as this requires the correct order of operation, with interrupts disabled.
// See the datasheet of any AVR chip for details.
wdt_reset();
Expand All @@ -65,7 +65,7 @@ void watchdog_init() {
SERIAL_ERROR_MSG(MSG_WATCHDOG_FIRED);
minkill(); // interrupt-safe final kill and infinite loop
}
#endif // WATCHDOG_RESET_MANUAL
#endif

#endif // USE_WATCHDOG
#endif // __AVR__
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_LPC1768/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
#define HAL_ADC_READY() FilteredADC::finished_conversion()

// A grace period for the ADC readings to stabilize before they start causing thermal protection errors.
#define THERMAL_PROTECTION_GRACE_PERIOD 500
#define THERMAL_PROTECTION_GRACE_PERIOD 800

// Parse a G-code word into a pin index
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/core/debug_out.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
// (or not) in a given .cpp file
//

#undef DEBUG_PRINT_P
#undef DEBUG_ECHO_START
#undef DEBUG_ERROR_START
#undef DEBUG_CHAR
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/core/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@
#define MSG_LCD_N3 " 4"
#define MSG_LCD_N4 " 5"
#define MSG_LCD_N5 " 6"
#define MSG_E0 "E0"
#define MSG_E1 "E1"
#define MSG_E2 "E2"
#define MSG_E3 "E3"
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/feature/bedlevel/abl/abl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../../core/debug_out.h"

#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extensible_ui/ui_api.h"
#endif

int bilinear_grid_spacing[2], bilinear_start[2];
float bilinear_grid_factor[2],
z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/feature/bedlevel/bedlevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../core/debug_out.h"

#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extensible_ui/ui_api.h"
#endif

bool leveling_is_valid() {
return
#if ENABLED(MESH_BED_LEVELING)
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/feature/fwretract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void FWRetract::retract(const bool retracting

// Prevent two swap-retract or recovers in a row
#if EXTRUDERS > 1
// Allow G10 S1 only after G10
// Allow G10 S1 only after G11
if (swapping && retracted_swap[active_extruder] == retracting) return;
// G11 priority to recover the long retract if activated
if (!retracting) swapping = retracted_swap[active_extruder];
Expand All @@ -114,8 +114,8 @@ void FWRetract::retract(const bool retracting
/* // debugging
SERIAL_ECHOLNPAIR(
"retracting ", retracting,
"swapping ", swapping
"active extruder ", active_extruder
" swapping ", swapping,
" active extruder ", active_extruder
);
for (uint8_t i = 0; i < EXTRUDERS; ++i) {
SERIAL_ECHOLNPAIR("retracted[", i, "] ", retracted[i]);
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,9 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
// Resume the print job timer if it was running
if (print_job_timer.isPaused()) print_job_timer.start();

ui.reset_status();
#if HAS_LCD_MENU
ui.return_to_status();
#endif
}

#endif // ADVANCED_PAUSE_FEATURE
13 changes: 9 additions & 4 deletions Marlin/src/gcode/bedlevel/M420.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "../../module/configuration_store.h"
#endif

#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extensible_ui/ui_api.h"
#endif

//#define M420_C_USE_MEAN

/**
Expand Down Expand Up @@ -175,14 +179,15 @@ void GcodeSuite::M420() {
set_bed_leveling_enabled(false);
// Subtract the mean from all values
for (uint8_t x = GRID_MAX_POINTS_X; x--;)
for (uint8_t y = GRID_MAX_POINTS_Y; y--;)
for (uint8_t y = GRID_MAX_POINTS_Y; y--;) {
Z_VALUES(x, y) -= zmean;
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y));
#endif
}
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
bed_level_virt_interpolate();
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y));
#endif
}

#endif
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../../core/debug_out.h"

#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extensible_ui/ui_api.h"
#endif

#if ABL_GRID
#if ENABLED(PROBE_Y_FIRST)
#define PR_OUTER_VAR xCount
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/gcode/bedlevel/abl/M421.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include "../../gcode.h"
#include "../../../feature/bedlevel/abl/abl.h"

#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extensible_ui/ui_api.h"
#endif

/**
* M421: Set a single Mesh Bed Leveling Z coordinate
*
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/gcode/calibrate/G34_M422.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ void GcodeSuite::G34() {
extruder_duplication_enabled = false;
#endif

// Before moving other axes raise Z, if needed. Never lower Z.
if (current_position[Z_AXIS] < Z_CLEARANCE_BETWEEN_PROBES) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before moving to probe pos) to ", Z_CLEARANCE_BETWEEN_PROBES);
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
}

// Remember corrections to determine errors on each iteration
float last_z_align_move[Z_STEPPER_COUNT] = ARRAY_N(Z_STEPPER_COUNT, 10000.0f, 10000.0f, 10000.0f),
z_measured[Z_STEPPER_COUNT] = { 0 };
Expand Down
13 changes: 0 additions & 13 deletions Marlin/src/gcode/eeprom/M500-M504.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,25 @@
#include "../../core/serial.h"
#include "../../inc/MarlinConfig.h"

#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extensible_ui/ui_api.h"
#endif

/**
* M500: Store settings in EEPROM
*/
void GcodeSuite::M500() {
(void)settings.save();
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onStoreSettings();
#endif
}

/**
* M501: Read settings from EEPROM
*/
void GcodeSuite::M501() {
(void)settings.load();
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onLoadSettings();
#endif
}

/**
* M502: Revert to default settings
*/
void GcodeSuite::M502() {
(void)settings.reset();
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onFactoryReset();
#endif
}

#if DISABLED(DISABLE_M503)
Expand Down
14 changes: 12 additions & 2 deletions Marlin/src/gcode/feature/trinamic/M906.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,18 @@
#include "../../../module/stepper_indirection.h"

/**
* M906: Set motor current in milliamps using axis codes X, Y, Z, E
* Report driver currents when no axis specified
* M906: Set motor current in milliamps.
*
* Parameters:
* X[current] - Set mA current for X driver(s)
* Y[current] - Set mA current for Y driver(s)
* Z[current] - Set mA current for Z driver(s)
* E[current] - Set mA current for E driver(s)
*
* I[index] - Axis sub-index (Omit or 0 for X, Y, Z; 1 for X2, Y2, Z2; 2 for Z3.)
* T[index] - Extruder index (Zero-based. Omit for E0 only.)
*
* With no parameters report driver currents.
*/
void GcodeSuite::M906() {
#define TMC_SAY_CURRENT(Q) tmc_get_current(stepper##Q)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void GcodeSuite::process_parsed_command(
case 58: G58(); break;
case 59: G59(); break;
#endif

#if ENABLED(GCODE_MOTION_MODES)
case 80: G80(); break; // G80: Reset the current motion mode
#endif
Expand Down
4 changes: 1 addition & 3 deletions Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,9 +1038,7 @@ void MarlinUI::draw_status_screen() {
}

void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
SETCURSOR(0, 0); lcd_put_u8str_P(pref);
if (string) wrap_string(1, string);
if (suff) lcd_put_u8str_P(suff);
ui.draw_select_screen_prompt(pref, string, suff);
SETCURSOR(0, LCD_HEIGHT - 1);
lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd_put_wchar(yesno ? ' ' : ']');
SETCURSOR_RJ(utf8_strlen_P(yes) + 2, LCD_HEIGHT - 1);
Expand Down
4 changes: 1 addition & 3 deletions Marlin/src/lcd/dogm/ultralcd_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
}

void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
SETCURSOR(0, 0); lcd_put_u8str_P(pref);
if (string) wrap_string(1, string);
if (suff) lcd_put_u8str_P(suff);
ui.draw_select_screen_prompt(pref, string, suff);
draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) + 1), LCD_HEIGHT - 1, yes, yesno);
}
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/lcd/extensible_ui/ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ namespace ExtUI {
#if HAS_MESH
bool getMeshValid() { return leveling_is_valid(); }
bed_mesh_t getMeshArray() { return Z_VALUES_ARR; }
float getMeshPoint(const uint8_t xpos, const uint8_t ypos) { return Z_VALUES(xpos,ypos); }
void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zoff) {
if (WITHIN(xpos, 0, GRID_MAX_POINTS_X) && WITHIN(ypos, 0, GRID_MAX_POINTS_Y)) {
Z_VALUES(xpos, ypos) = zoff;
Expand Down Expand Up @@ -748,10 +749,15 @@ namespace ExtUI {
enqueue_and_echo_commands_P(gcode);
}

bool commandsInQueue() { return (planner.movesplanned() || commands_in_queue); }

bool isAxisPositionKnown(const axis_t axis) {
return TEST(axis_known_position, axis);
}

bool isPositionKnown() { return all_axes_known(); }
bool isMachineHomed() { return all_axes_homed(); }

PGM_P getFirmwareName_str() {
static const char firmware_name[] PROGMEM = "Marlin " SHORT_BUILD_VERSION;
return firmware_name;
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/lcd/extensible_ui/ui_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ namespace ExtUI {

bool isMoving();
bool isAxisPositionKnown(const axis_t);
bool isPositionKnown(); // Axis position guaranteed, steppers active since homing
bool isMachineHomed(); // Axis position most likely correct, steppers may have deactivated
bool canMove(const axis_t);
bool canMove(const extruder_t);
void enqueueCommands_P(PGM_P const);
bool commandsInQueue();

/**
* Getters and setters
Expand Down Expand Up @@ -110,8 +113,10 @@ namespace ExtUI {
bool getLevelingActive();
void setLevelingActive(const bool);
#if HAS_MESH
#include "../../feature/bedlevel/bedlevel.h"
bool getMeshValid();
bed_mesh_t getMeshArray();
float getMeshPoint(const uint8_t xpos, const uint8_t ypos);
void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zval);
void onMeshUpdate(const uint8_t xpos, const uint8_t ypos, const float zval);
#endif
Expand Down
15 changes: 15 additions & 0 deletions Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,12 +753,27 @@
#ifndef MSG_START_PRINT
#define MSG_START_PRINT _UxGT("Start print")
#endif
#ifndef MSG_BUTTON_NEXT
#define MSG_BUTTON_NEXT _UxGT("Next")
#endif
#ifndef MSG_BUTTON_INIT
#define MSG_BUTTON_INIT _UxGT("Init")
#endif
#ifndef MSG_BUTTON_STOP
#define MSG_BUTTON_STOP _UxGT("Stop")
#endif
#ifndef MSG_BUTTON_PRINT
#define MSG_BUTTON_PRINT _UxGT("Print")
#endif
#ifndef MSG_BUTTON_RESET
#define MSG_BUTTON_RESET _UxGT("Reset")
#endif
#ifndef MSG_BUTTON_CANCEL
#define MSG_BUTTON_CANCEL _UxGT("Cancel")
#endif
#ifndef MSG_BUTTON_DONE
#define MSG_BUTTON_DONE _UxGT("Done")
#endif
#ifndef MSG_PAUSE_PRINT
#define MSG_PAUSE_PRINT _UxGT("Pause print")
#endif
Expand Down
Loading

0 comments on commit 4972bf8

Please sign in to comment.