Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
crysxd committed Feb 15, 2020
2 parents 3d0c76d + 5584da3 commit adbf4ba
Show file tree
Hide file tree
Showing 32 changed files with 1,053 additions and 387 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- megaatmega2560
- teensy31
- teensy35
- SAMD51_grandcentral_m4

# Extended AVR Environments

Expand Down Expand Up @@ -75,7 +76,6 @@ jobs:
#- mks_robin_lite
#- mks_robin_mini
#- mks_robin_nano
#- SAMD51_grandcentral_m4

steps:

Expand Down
4 changes: 3 additions & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1213,9 +1213,11 @@
//#define AO_EXP1_PINMAP // AlephObjects CLCD UI EXP1 mapping
//#define AO_EXP2_PINMAP // AlephObjects CLCD UI EXP2 mapping
//#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 pin mapping
//#define S6_TFT_PINMAP // FYSETC S6 pin mapping

//#define OTHER_PIN_LAYOUT // Define pins manually below
#if ENABLED(OTHER_PIN_LAYOUT)
// The pins for CS and MOD_RESET (PD) must be chosen.
// Pins for CS and MOD_RESET (PD) must be chosen
#define CLCD_MOD_RESET 9
#define CLCD_SPI_CS 10

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_ESP32/i2s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ void stepperTask(void* parameter) {
remaining--;
}
else {
Stepper::stepper_pulse_phase_isr();
remaining = Stepper::stepper_block_phase_isr();
Stepper::pulse_phase_isr();
remaining = Stepper::block_phase_isr();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_SAMD51/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
typedef uint32_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF

#define HAL_TIMER_RATE SystemCoreClock // frequency of timers peripherals
#define HAL_TIMER_RATE F_CPU // frequency of timers peripherals

#define STEP_TIMER_NUM 0 // index of timer to use for stepper (also +1 for 32bits counter)
#define PULSE_TIMER_NUM STEP_TIMER_NUM
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void disable_all_steppers() {

void event_probe_recover() {
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), PSTR("Dismiss"));
host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), DISMISS_STR);
#endif
#ifdef ACTION_ON_G29_RECOVER
host_action(PSTR(ACTION_ON_G29_RECOVER));
Expand Down
6 changes: 5 additions & 1 deletion Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@
#define BOARD_GTM32_MINI_A30 4022 // STM32F103VET6 controller
#define BOARD_GTM32_REV_B 4023 // STM32F103VET6 controller


//
// ARM Cortex-M4F
//
Expand Down Expand Up @@ -340,6 +339,11 @@
#define BOARD_MRR_ESPE 6002
#define BOARD_E4D_BOX 6003 // E4d@BOX

//
// SAMD51 ARM Cortex M4
//
#define BOARD_AGCM4_RAMPS_144 6100 // RAMPS 1.4.4

//
// Simulations
//
Expand Down
8 changes: 0 additions & 8 deletions Marlin/src/feature/babystep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ void Babystep::step_axis(const AxisEnum axis) {
}
}

void Babystep::task() {
#if EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
LOOP_XYZ(axis) step_axis((AxisEnum)axis);
#else
step_axis(Z_AXIS);
#endif
}

void Babystep::add_mm(const AxisEnum axis, const float &mm) {
add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]);
}
Expand Down
10 changes: 9 additions & 1 deletion Marlin/src/feature/babystep.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ class Babystep {

static void add_steps(const AxisEnum axis, const int16_t distance);
static void add_mm(const AxisEnum axis, const float &mm);
static void task();

//
// Called by the Temperature ISR to
// apply accumulated babysteps to the axes.
//
static inline void task() {
LOOP_L_N(axis, BS_TODO_AXIS(Z_AXIS)) step_axis((AxisEnum)axis);
}

private:
static void step_axis(const AxisEnum axis);
};
Expand Down
99 changes: 55 additions & 44 deletions Marlin/src/feature/host_actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ void host_action(const char * const pstr, const bool eol) {

#if ENABLED(HOST_PROMPT_SUPPORT)

const char CONTINUE_STR[] PROGMEM = "Continue";
const char CONTINUE_STR[] PROGMEM = "Continue",
DISMISS_STR[] PROGMEM = "Dismiss";

#if HAS_RESUME_CONTINUE
extern bool wait_for_user;
Expand All @@ -84,70 +85,78 @@ void host_action(const char * const pstr, const bool eol) {
if (eol) SERIAL_EOL();
}

void host_action_prompt_plus(const char * const ptype, const char * const pstr, const bool eol=true) {
void host_action_prompt_plus(const char * const ptype, const char * const pstr, const char extra_char='\0') {
host_action_prompt(ptype, false);
SERIAL_CHAR(' ');
serialprintPGM(pstr);
if (eol) SERIAL_EOL();
if (extra_char != '\0') SERIAL_CHAR(extra_char);
SERIAL_EOL();
}
void host_action_prompt_begin(const PromptReason reason, const char * const pstr, const char extra_char/*='\0'*/) {
host_action_prompt_end();
host_prompt_reason = reason;
host_action_prompt_plus(PSTR("begin"), pstr, extra_char);
}
void host_action_prompt_begin(const char * const pstr, const bool eol/*=true*/) { host_action_prompt_plus(PSTR("begin"), pstr, eol); }
void host_action_prompt_button(const char * const pstr) { host_action_prompt_plus(PSTR("button"), pstr); }
void host_action_prompt_end() { host_action_prompt(PSTR("end")); }
void host_action_prompt_show() { host_action_prompt(PSTR("show")); }
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const pbtn/*=nullptr*/) {
host_prompt_reason = reason;
host_action_prompt_end();
host_action_prompt_begin(pstr);
if (pbtn) host_action_prompt_button(pbtn);
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const btn1/*=nullptr*/, const char * const btn2/*=nullptr*/) {
host_action_prompt_begin(reason, pstr);
if (btn1) host_action_prompt_button(btn1);
if (btn2) host_action_prompt_button(btn2);
host_action_prompt_show();
}

inline void say_m876_response(const char * const pstr) {
SERIAL_ECHOPGM("M876 Responding PROMPT_");
serialprintPGM(pstr);
SERIAL_EOL();
void filament_load_host_prompt() {
const bool disable_to_continue = (false
#if HAS_FILAMENT_SENSOR
|| runout.filament_ran_out
#endif
);
host_prompt_do(PROMPT_FILAMENT_RUNOUT, PSTR("Paused"), PSTR("PurgeMore"),
disable_to_continue ? PSTR("DisableRunout") : CONTINUE_STR
);
}

//
// Handle responses from the host, such as:
// - Filament runout responses: Purge More, Continue
// - General "Continue" response
// - Resume Print response
// - Dismissal of info
//
void host_response_handler(const uint8_t response) {
#ifdef DEBUG_HOST_ACTIONS
SERIAL_ECHOLNPAIR("M876 Handle Reason: ", host_prompt_reason);
SERIAL_ECHOLNPAIR("M876 Handle Response: ", response);
static const char m876_prefix[] PROGMEM = "M876 Handle Re";
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("ason: ", host_prompt_reason);
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("sponse: ", response);
#endif
const char *msg = PSTR("UNKNOWN STATE");
const PromptReason hpr = host_prompt_reason;
host_prompt_reason = PROMPT_NOT_DEFINED;
host_prompt_reason = PROMPT_NOT_DEFINED; // Reset now ahead of logic
switch (hpr) {
case PROMPT_FILAMENT_RUNOUT:
msg = PSTR("FILAMENT_RUNOUT");
if (response == 0) {
#if ENABLED(ADVANCED_PAUSE_FEATURE)
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE;
#endif
host_action_prompt_end(); // Close current prompt
host_action_prompt_begin(PSTR("Paused"));
host_action_prompt_button(PSTR("Purge More"));
if (false
switch (response) {

case 0: // "Purge More" button
#if HAS_LCD_MENU && ENABLED(ADVANCED_PAUSE_FEATURE)
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // Simulate menu selection (menu exits, doesn't extrude more)
#endif
filament_load_host_prompt(); // Initiate another host prompt. (NOTE: The loop in load_filament may also do this!)
break;

case 1: // "Continue" / "Disable Runout" button
#if HAS_LCD_MENU && ENABLED(ADVANCED_PAUSE_FEATURE)
pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; // Simulate menu selection
#endif
#if HAS_FILAMENT_SENSOR
|| runout.filament_ran_out
if (runout.filament_ran_out) { // Disable a triggered sensor
runout.enabled = false;
runout.reset();
}
#endif
)
host_action_prompt_button(PSTR("DisableRunout"));
else {
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
host_action_prompt_button(CONTINUE_STR);
}
host_action_prompt_show();
}
else if (response == 1) {
#if HAS_FILAMENT_SENSOR
if (runout.filament_ran_out) {
runout.enabled = false;
runout.reset();
}
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT;
#endif
break;
}
break;
case PROMPT_USER_CONTINUE:
Expand All @@ -168,7 +177,9 @@ void host_action(const char * const pstr, const bool eol) {
break;
default: break;
}
say_m876_response(msg);
SERIAL_ECHOPGM("M876 Responding PROMPT_");
serialprintPGM(msg);
SERIAL_EOL();
}

#endif // HOST_PROMPT_SUPPORT
Expand Down
12 changes: 7 additions & 5 deletions Marlin/src/feature/host_actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void host_action(const char * const pstr, const bool eol=true);

#if ENABLED(HOST_PROMPT_SUPPORT)

extern const char CONTINUE_STR[];
extern const char CONTINUE_STR[], DISMISS_STR[];

enum PromptReason : uint8_t {
PROMPT_NOT_DEFINED,
Expand All @@ -61,13 +61,15 @@ void host_action(const char * const pstr, const bool eol=true);

void host_response_handler(const uint8_t response);
void host_action_notify(const char * const message);
void host_action_prompt_begin(const char * const pstr, const bool eol=true);
void host_action_prompt_begin(const PromptReason reason, const char * const pstr, const char extra_char='\0');
void host_action_prompt_button(const char * const pstr);
void host_action_prompt_end();
void host_action_prompt_show();
void host_prompt_do(const PromptReason type, const char * const pstr, const char * const pbtn=nullptr);
inline void host_prompt_open(const PromptReason reason, const char * const pstr, const char * const pbtn=nullptr) {
if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, pbtn);
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const btn1=nullptr, const char * const btn2=nullptr);
inline void host_prompt_open(const PromptReason reason, const char * const pstr, const char * const btn1=nullptr, const char * const btn2=nullptr) {
if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, btn1, btn2);
}

void filament_load_host_prompt();

#endif
45 changes: 16 additions & 29 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@

static xyze_pos_t resume_position;

PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;

PauseMenuResponse pause_menu_response;
#if HAS_LCD_MENU
PauseMenuResponse pause_menu_response;
PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;
#endif

fil_change_settings_t fc_settings[EXTRUDERS];

Expand All @@ -85,7 +86,11 @@ fil_change_settings_t fc_settings[EXTRUDERS];

#if HAS_BUZZER
static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
if (pause_mode == PAUSE_MODE_PAUSE_PRINT) return;

#if HAS_LCD_MENU
if (pause_mode == PAUSE_MODE_PAUSE_PRINT) return;
#endif

static millis_t next_buzz = 0;
static int8_t runout_beep = 0;

Expand Down Expand Up @@ -186,11 +191,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
+ active_extruder
#endif
;
host_prompt_reason = PROMPT_USER_CONTINUE;
host_action_prompt_end();
host_action_prompt_begin(PSTR("Load Filament T"), false);
SERIAL_CHAR(tool);
SERIAL_EOL();
host_action_prompt_begin(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool);
host_action_prompt_button(CONTINUE_STR);
host_action_prompt_show();
#endif
Expand Down Expand Up @@ -247,10 +248,10 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l

wait_for_user = true;
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purge Running..."), CONTINUE_STR);
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR);
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired_P(PSTR("Filament Purge Running..."));
ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging..."));
#endif
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
Expand All @@ -269,27 +270,13 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
do_pause_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
}

// Show "Purge More" / "Resume" menu and wait for reply
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
host_action_prompt_end(); // Close current prompt
host_action_prompt_begin(PSTR("Paused"));
host_action_prompt_button(PSTR("PurgeMore"));
if (false
#if HAS_FILAMENT_SENSOR
|| runout.filament_ran_out
#endif
)
host_action_prompt_button(PSTR("DisableRunout"));
else {
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
host_action_prompt_button(CONTINUE_STR);
}
host_action_prompt_show();
filament_load_host_prompt(); // Initiate another host prompt. (NOTE: host_response_handler may also do this!)
#endif

#if HAS_LCD_MENU
if (show_lcd) {
// Show "Purge More" / "Resume" menu and wait for reply
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = false;
lcd_pause_show_message(PAUSE_MESSAGE_OPTION);
Expand Down Expand Up @@ -409,7 +396,7 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
#endif

#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_INFO, PSTR("Pause"), PSTR("Dismiss"));
host_prompt_open(PROMPT_INFO, PSTR("Pause"), DISMISS_STR);
#endif

if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
Expand Down Expand Up @@ -680,7 +667,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
--did_pause_print;

#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_INFO, PSTR("Resuming"), PSTR("Dismiss"));
host_prompt_open(PROMPT_INFO, PSTR("Resuming"), DISMISS_STR);
#endif

#if ENABLED(SDSUPPORT)
Expand Down
Loading

0 comments on commit adbf4ba

Please sign in to comment.