Skip to content

Commit

Permalink
Merge nightly patches
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 16, 2020
2 parents 8dbbcfd + f6e80d5 commit 129b1bb
Show file tree
Hide file tree
Showing 45 changed files with 224 additions and 52 deletions.
1 change: 1 addition & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,7 @@
//#define EEPROM_SETTINGS // Persistent storage with M500 and M501
//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
#define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load
#if ENABLED(EEPROM_SETTINGS)
//#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
#endif
Expand Down
10 changes: 7 additions & 3 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,12 @@
// Minimum time that a segment needs to take if the buffer is emptied
#define DEFAULT_MINSEGMENTTIME 20000 // (ms)

// If defined the movements slow down when the look ahead buffer is only half full
// Slow down the machine if the look ahead buffer is (by default) half full.
// Increase the slowdown divisor for larger buffer sizes.
#define SLOWDOWN
#if ENABLED(SLOWDOWN)
#define SLOWDOWN_DIVISOR 2
#endif

// Frequency limit
// See nophead's blog for more info
Expand Down Expand Up @@ -999,7 +1003,7 @@
#define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s)
#endif

#if HAS_GRAPHICAL_LCD && HAS_PRINT_PROGRESS
#if HAS_GRAPHICAL_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
//#define SHOW_REMAINING_TIME // Display estimated time to completion
#if ENABLED(SHOW_REMAINING_TIME)
Expand All @@ -1008,7 +1012,7 @@
#endif
#endif

#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS
#if HAS_CHARACTER_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
//#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing
#if ENABLED(LCD_PROGRESS_BAR)
#define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
#if USE_EMULATED_EEPROM
#undef SRAM_EEPROM_EMULATION
#undef SDCARD_EEPROM_EMULATION
#define FLASH_EEPROM_EMULATION 1
#define FLASH_EEPROM_EMULATION
#endif
5 changes: 5 additions & 0 deletions Marlin/src/HAL/ESP32/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@
*
*/
#pragma once

// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation
#if ENABLED(EEPROM_SETTINGS) && NONE(USE_REAL_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION)
#define SDCARD_EEPROM_EMULATION
#endif
8 changes: 2 additions & 6 deletions Marlin/src/HAL/LPC1768/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
*/
#pragma once

#if ENABLED(EEPROM_SETTINGS)
#undef USE_REAL_EEPROM
#define USE_EMULATED_EEPROM 1
#if DISABLED(FLASH_EEPROM_EMULATION)
#define SDCARD_EEPROM_EMULATION 1
#endif
#if USE_EMULATED_EEPROM && NONE(SDCARD_EEPROM_EMULATION, SRAM_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#endif
3 changes: 1 addition & 2 deletions Marlin/src/HAL/LPC1768/persistent_store_flash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@
* 16Kb I/O buffers (intended to hold DMA USB and Ethernet data, but currently
* unused).
*/
#include "../../inc/MarlinConfigPre.h"
#include "../../inc/MarlinConfig.h"

#if ENABLED(FLASH_EEPROM_EMULATION)

#include "persistent_store_api.h"
#include "../../inc/MarlinConfig.h"

extern "C" {
#include <lpc17xx_iap.h>
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/SAMD51/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
#if USE_EMULATED_EEPROM
#undef SRAM_EEPROM_EMULATION
#undef SDCARD_EEPROM_EMULATION
#define FLASH_EEPROM_EMULATION 1
#define FLASH_EEPROM_EMULATION
#endif
5 changes: 5 additions & 0 deletions Marlin/src/HAL/STM32/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@
*
*/
#pragma once

// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation
#if ENABLED(EEPROM_SETTINGS) && NONE(USE_REAL_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION)
#define SDCARD_EEPROM_EMULATION
#endif
3 changes: 1 addition & 2 deletions Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

#if ENABLED(EEPROM_SETTINGS) && defined(STM32F7)
#undef USE_REAL_EEPROM
#define USE_EMULATED_EEPROM 1
#undef SRAM_EEPROM_EMULATION
#undef SDCARD_EEPROM_EMULATION
#define FLASH_EEPROM_EMULATION 1
#define FLASH_EEPROM_EMULATION
#endif
5 changes: 5 additions & 0 deletions Marlin/src/HAL/TEENSY31_32/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@
*
*/
#pragma once

// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation
#if ENABLED(EEPROM_SETTINGS) && NONE(USE_REAL_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION)
#define SDCARD_EEPROM_EMULATION
#endif
10 changes: 6 additions & 4 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const char NUL_STR[] PROGMEM = "",
SP_Z_LBL[] PROGMEM = " Z:",
SP_E_LBL[] PROGMEM = " E:";

bool Running = true;
MarlinState marlin_state = MF_INITIALIZING;

// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
bool wait_for_heatup = true;
Expand Down Expand Up @@ -839,7 +839,7 @@ void stop() {
SERIAL_ERROR_MSG(STR_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED);
safe_delay(350); // allow enough time for messages to get out before stopping
Running = false;
marlin_state = MF_STOPPED;
}
}

Expand Down Expand Up @@ -991,8 +991,8 @@ void setup() {
SETUP_RUN(ui.show_bootscreen());
#endif

#if ENABLED(SDSUPPORT)
SETUP_RUN(card.mount()); // Mount the SD card before settings.first_load
#if ENABLED(SDSUPPORT) && defined(SDCARD_CONNECTION) && !SD_CONNECTION_IS(LCD)
SETUP_RUN(card.mount()); // Mount onboard / custom SD card before settings.first_load
#endif

SETUP_RUN(settings.first_load()); // Load data from EEPROM if available (or use defaults)
Expand Down Expand Up @@ -1183,6 +1183,8 @@ void setup() {
SETUP_RUN(max7219.init());
#endif

marlin_state = MF_RUNNING;

SETUP_LOG("setup() completed.");
}

Expand Down
16 changes: 13 additions & 3 deletions Marlin/src/MarlinCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,19 @@ void minkill(const bool steppers_off=false);

void quickstop_stepper();

extern bool Running;
inline bool IsRunning() { return Running; }
inline bool IsStopped() { return !Running; }
// Global State of the firmware
enum MarlinState : uint8_t {
MF_INITIALIZING = 0,
MF_RUNNING = _BV(0),
MF_PAUSED = _BV(1),
MF_WAITING = _BV(2),
MF_STOPPED = _BV(3),
MF_KILLED = _BV(7)
};

extern MarlinState marlin_state;
inline bool IsRunning() { return marlin_state == MF_RUNNING; }
inline bool IsStopped() { return marlin_state != MF_RUNNING; }

bool printingIsActive();
bool printingIsPaused();
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/core/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ void safe_delay(millis_t ms) {
TERN(PROBE_MANUALLY, "PROBE_MANUALLY", "")
TERN(NOZZLE_AS_PROBE, "NOZZLE_AS_PROBE", "")
TERN(FIX_MOUNTED_PROBE, "FIX_MOUNTED_PROBE", "")
TERN(BLTOUCH, "BLTOUCH", "")
TERN(HAS_Z_SERVO_PROBE, TERN(BLTOUCH, "BLTOUCH", "SERVO PROBE"), "")
TERN(TOUCH_MI_PROBE, "TOUCH_MI_PROBE", "")
TERN(Z_PROBE_SLED, "Z_PROBE_SLED", "")
Expand Down
7 changes: 6 additions & 1 deletion Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,12 @@ G29_TYPE GcodeSuite::G29() {

// Unapply the offset because it is going to be immediately applied
// and cause compensation movement in Z
current_position.z -= bilinear_z_offset(current_position);
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float fade_scaling_factor = planner.fade_scaling_factor_for_z(current_position.z);
#else
constexpr float fade_scaling_factor = 1.0f;
#endif
current_position.z -= fade_scaling_factor * bilinear_z_offset(current_position);

if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(" corrected Z:", current_position.z);
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/calibrate/G34_M422.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void GcodeSuite::G34() {
const uint8_t iprobe = (iteration & 1) ? NUM_Z_STEPPER_DRIVERS - 1 - i : i;

// Safe clearance even on an incline
if (iteration == 0 || i > 0) do_blocking_move_to_z(z_probe);
if ((iteration == 0 || i > 0) && z_probe > current_position.z) do_blocking_move_to_z(z_probe);

if (DEBUGGING(LEVELING))
DEBUG_ECHOLNPAIR_P(PSTR("Probing X"), z_stepper_align.xy[iprobe].x, SP_Y_STR, z_stepper_align.xy[iprobe].y);
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/control/M999.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "../gcode.h"

#include "../../lcd/ultralcd.h" // for lcd_reset_alert_level
#include "../../MarlinCore.h" // for Running
#include "../../MarlinCore.h" // for marlin_state
#include "../queue.h" // for flush_and_request_resend

/**
Expand All @@ -37,7 +37,7 @@
*
*/
void GcodeSuite::M999() {
Running = true;
marlin_state = MF_RUNNING;
ui.reset_alert_level();

if (parser.boolval('S')) return;
Expand Down
4 changes: 1 addition & 3 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@
#define HAS_LINEAR_E_JERK 1
#endif

// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation
#if ENABLED(EEPROM_SETTINGS)
#if NONE(FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SDCARD_EEPROM_EMULATION) && EITHER(I2C_EEPROM, SPI_EEPROM)
#define USE_REAL_EEPROM 1
#else
#define USE_EMULATED_EEPROM 1
#endif
#if NONE(USE_REAL_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION)
#define SDCARD_EEPROM_EMULATION 1
#endif
#else
#undef I2C_EEPROM
#undef SPI_EEPROM
Expand Down
15 changes: 15 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1993,9 +1993,24 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
static_assert(PWM_PIN(E2_AUTO_FAN_PIN), "E2" AF_ERR_SUFF);
#elif HAS_AUTO_FAN_3
static_assert(PWM_PIN(E3_AUTO_FAN_PIN), "E3" AF_ERR_SUFF);
#elif HAS_AUTO_FAN_4
static_assert(PWM_PIN(E4_AUTO_FAN_PIN), "E4" AF_ERR_SUFF);
#elif HAS_AUTO_FAN_5
static_assert(PWM_PIN(E5_AUTO_FAN_PIN), "E5" AF_ERR_SUFF);
#elif HAS_AUTO_FAN_6
static_assert(PWM_PIN(E6_AUTO_FAN_PIN), "E6" AF_ERR_SUFF);
#elif HAS_AUTO_FAN_7
static_assert(PWM_PIN(E7_AUTO_FAN_PIN), "E7" AF_ERR_SUFF);
#endif
#endif

/**
* Make sure only one EEPROM type is enabled
*/
#if ENABLED(EEPROM_SETTINGS) && 1 < ENABLED(SDCARD_EEPROM_EMULATION) + ENABLED(FLASH_EEPROM_EMULATION) + ENABLED(SRAM_EEPROM_EMULATION)
#error "Please select only one of SDCARD, FLASH, or SRAM_EEPROM_EMULATION."
#endif

/**
* Make sure only one display is enabled
*/
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-03-14"
#define STRING_DISTRIBUTION_DATE "2020-03-16"
#endif

/**
Expand Down
7 changes: 3 additions & 4 deletions Marlin/src/lcd/dogm/status_screen_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ void MarlinUI::draw_status_screen() {
#endif
}

constexpr bool can_show_days = DISABLED(DOGM_SD_PERCENT) || ENABLED(ROTATE_PROGRESS_DISPLAY);
if (ev != lastElapsed) {
lastElapsed = ev;
const bool has_days = (elapsed.value >= 60*60*24L);
const uint8_t len = elapsed.toDigital(elapsed_string, has_days);
const uint8_t len = elapsed.toDigital(elapsed_string, can_show_days && elapsed.value >= 60*60*24L);
elapsed_x_pos = _SD_INFO_X(len);

#if ENABLED(SHOW_REMAINING_TIME)
Expand All @@ -468,8 +468,7 @@ void MarlinUI::draw_status_screen() {
}
else {
duration_t estimation = timeval;
const bool has_days = (estimation.value >= 60*60*24L);
const uint8_t len = estimation.toDigital(estimation_string, has_days);
const uint8_t len = estimation.toDigital(estimation_string, can_show_days && estimation.value >= 60*60*24L);
estimation_x_pos = _SD_INFO_X(len
#if !BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
+ 1
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/lcd/menu/menu_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ void menu_advanced_settings();
START_MENU();
BACK_ITEM(MSG_CONFIGURATION);
#if ENABLED(DUAL_X_CARRIAGE)
EDIT_ITEM_FAST(float51, MSG_HOTEND_OFFSET_X, &hotend_offset[1].x, float(X2_HOME_POS - 25), float(X2_HOME_POS + 25), _recalc_offsets);
EDIT_ITEM_FAST(float52, MSG_HOTEND_OFFSET_X, &hotend_offset[1].x, float(X2_HOME_POS - 25), float(X2_HOME_POS + 25), _recalc_offsets);
#else
EDIT_ITEM_FAST(float41sign, MSG_HOTEND_OFFSET_X, &hotend_offset[1].x, -99.0, 99.0, _recalc_offsets);
EDIT_ITEM_FAST(float52, MSG_HOTEND_OFFSET_X, &hotend_offset[1].x, -99.0, 99.0, _recalc_offsets);
#endif
EDIT_ITEM_FAST(float41sign, MSG_HOTEND_OFFSET_Y, &hotend_offset[1].y, -99.0, 99.0, _recalc_offsets);
EDIT_ITEM_FAST(float41sign, MSG_HOTEND_OFFSET_Z, &hotend_offset[1].z, Z_PROBE_LOW_POINT, 10.0, _recalc_offsets);
EDIT_ITEM_FAST(float52, MSG_HOTEND_OFFSET_Y, &hotend_offset[1].y, -99.0, 99.0, _recalc_offsets);
EDIT_ITEM_FAST(float52, MSG_HOTEND_OFFSET_Z, &hotend_offset[1].z, Z_PROBE_LOW_POINT, 10.0, _recalc_offsets);
#if ENABLED(EEPROM_SETTINGS)
ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings);
#endif
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/module/configuration_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1531,10 +1531,10 @@ void MarlinSettings::postprocess() {
_FIELD_TEST(planner_leveling_active);
#if ENABLED(AUTO_BED_LEVELING_UBL)
const bool &planner_leveling_active = planner.leveling_active;
const uint8_t &ubl_storage_slot = ubl.storage_slot;
const int8_t &ubl_storage_slot = ubl.storage_slot;
#else
bool planner_leveling_active;
uint8_t ubl_storage_slot;
int8_t ubl_storage_slot;
#endif
EEPROM_READ(planner_leveling_active);
EEPROM_READ(ubl_storage_slot);
Expand Down Expand Up @@ -2185,8 +2185,10 @@ void MarlinSettings::postprocess() {
}

#if ENABLED(EEPROM_CHITCHAT) && DISABLED(DISABLE_M503)
if (!validating) report();
// Report the EEPROM settings
if (!validating && (DISABLED(EEPROM_BOOT_SILENT) || IsRunning())) report();
#endif

EEPROM_FINISH();

return !eeprom_error;
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,10 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#endif

#if ENABLED(SLOWDOWN)
if (WITHIN(moves_queued, 2, (BLOCK_BUFFER_SIZE) / 2 - 1)) {
#ifndef SLOWDOWN_DIVISOR
#define SLOWDOWN_DIVISOR 2
#endif
if (WITHIN(moves_queued, 2, (BLOCK_BUFFER_SIZE) / (SLOWDOWN_DIVISOR) - 1)) {
if (segment_time_us < settings.min_segment_time_us) {
// buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more.
const uint32_t nst = segment_time_us + LROUND(2 * (settings.min_segment_time_us - segment_time_us) / moves_queued);
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
//

inline void loud_kill(PGM_P const lcd_msg, const heater_ind_t heater) {
Running = false;
marlin_state = MF_KILLED;
#if USE_BEEPER
for (uint8_t i = 20; i--;) {
WRITE(BEEPER_PIN, HIGH); delay(25);
Expand Down Expand Up @@ -2003,7 +2003,7 @@ void Temperature::init() {

/**
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Thermal Thermal Runaway Running. Heater ID: ");
SERIAL_ECHOPGM("Thermal Runaway Running. Heater ID: ");
if (heater_id == H_CHAMBER) SERIAL_ECHOPGM("chamber");
if (heater_id < 0) SERIAL_ECHOPGM("bed"); else SERIAL_ECHO(heater_id);
SERIAL_ECHOPAIR(" ; State:", sm.state, " ; Timer:", sm.timer, " ; Temperature:", current, " ; Target Temp:", target);
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@

#define BOARD_INFO_NAME "AZSMZ MINI"

//
// EEPROM
//
#define FLASH_EEPROM_EMULATION
//#define SDCARD_EEPROM_EMULATION

//
// Servos
//
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
#define BOARD_INFO_NAME "BIQU Thunder B300 V1.0"
#endif

//
// EEPROM
//
#define FLASH_EEPROM_EMULATION
//#define SDCARD_EEPROM_EMULATION

//
// Limit Switches
//
Expand Down
Loading

0 comments on commit 129b1bb

Please sign in to comment.