Merge remote-tracking branch 'upstream/MK3' into MK3-new_lang

conflicts + fix
This commit is contained in:
Robert Pelnar 2018-08-07 20:55:08 +02:00
commit 9e09efc9f4
5 changed files with 142 additions and 114 deletions

View File

@ -467,7 +467,7 @@ void gcode_M701();
void proc_commands();
void manage_response();
void manage_response(bool move_axes, bool turn_off_nozzle);
bool mmu_get_response(bool timeout);
void mmu_not_responding();
void mmu_load_to_nozzle();

View File

@ -3100,8 +3100,9 @@ void gcode_M600(bool automatic, float x_position, float y_position, float z_shif
//First backup current position and settings
feedmultiplyBckp=feedmultiply;
float HotendTempBckp = degTargetHotend(active_extruder);
int fanSpeedBckp = fanSpeed;
HotendTempBckp = degTargetHotend(active_extruder);
fanSpeedBckp = fanSpeed;
lastpos[X_AXIS]=current_position[X_AXIS];
lastpos[Y_AXIS]=current_position[Y_AXIS];
lastpos[Z_AXIS]=current_position[Z_AXIS];
@ -3527,7 +3528,7 @@ void process_commands()
} else if(code_seen("Fir")){
SERIAL_PROTOCOLLN(FW_VERSION);
SERIAL_PROTOCOLLN(FW_VERSION_FULL);
} else if(code_seen("Rev")){
@ -5945,10 +5946,31 @@ Sigma_Exit:
}
}
break;
case 204: // M204 acclereration S normal moves T filmanent only moves
case 204:
// M204 acclereration settings.
// Supporting old format: M204 S[normal moves] T[filmanent only moves]
// and new format: M204 P[printing moves] R[filmanent only moves] T[travel moves] (as of now T is ignored)
{
if(code_seen('S')) acceleration = code_value() ;
if(code_seen('T')) retract_acceleration = code_value() ;
if(code_seen('S')) {
// Legacy acceleration format. This format is used by the legacy Marlin, MK2 or MK3 firmware,
// and it is also generated by Slic3r to control acceleration per extrusion type
// (there is a separate acceleration settings in Slicer for perimeter, first layer etc).
acceleration = code_value();
// Interpret the T value as retract acceleration in the old Marlin format.
if(code_seen('T'))
retract_acceleration = code_value();
} else {
// New acceleration format, compatible with the upstream Marlin.
if(code_seen('P'))
acceleration = code_value();
if(code_seen('R'))
retract_acceleration = code_value();
if(code_seen('T')) {
// Interpret the T value as the travel acceleration in the new Marlin format.
//FIXME Prusa3D firmware currently does not support travel acceleration value independent from the extruding acceleration value.
// travel_acceleration = code_value();
}
}
}
break;
case 205: //M205 advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
@ -6836,7 +6858,7 @@ if (mmu_enabled)
printf_P(PSTR("T code: %d \n"), tmp_extruder);
mmu_printf_P(PSTR("T%d\n"), tmp_extruder);
manage_response();
manage_response(true, true);
mmu_extruder = tmp_extruder; //filament change is finished
@ -8873,9 +8895,12 @@ static void print_time_remaining_init() {
}
bool mmu_get_response(bool timeout) {
//waits for "ok" from mmu
//function returns true if "ok" was received
//if timeout is set to true function return false if there is no "ok" received before timeout
bool response = true;
LongTimer mmu_get_reponse_timeout;
KEEPALIVE_STATE(IN_PROCESS);
mmu_get_reponse_timeout.start();
while (mmu_rx_ok() <= 0)
{
@ -8889,16 +8914,19 @@ bool mmu_get_response(bool timeout) {
}
void manage_response() {
void manage_response(bool move_axes, bool turn_off_nozzle) {
bool response = false;
mmu_print_saved = false;
bool lcd_update_was_enabled = false;
float hotend_temp_bckp;
float z_position_bckp, x_position_bckp, y_position_bckp;
float hotend_temp_bckp = degTargetHotend(active_extruder);
float z_position_bckp = current_position[Z_AXIS];
float x_position_bckp = current_position[X_AXIS];
float y_position_bckp = current_position[Y_AXIS];
while(!response) {
response = mmu_get_response(true);
if (!response) {
if (!mmu_print_saved) { //first occurence
response = mmu_get_response(true); //wait for "ok" from mmu
if (!response) { //no "ok" was received in reserved time frame, user will fix the issue on mmu unit
if (!mmu_print_saved) { //first occurence, we are saving current position, park print head in certain position and disable nozzle heater
if (lcd_update_enabled) {
lcd_update_was_enabled = true;
lcd_update_enable(false);
@ -8907,6 +8935,7 @@ void manage_response() {
mmu_print_saved = true;
hotend_temp_bckp = degTargetHotend(active_extruder);
if (move_axes) {
z_position_bckp = current_position[Z_AXIS];
x_position_bckp = current_position[X_AXIS];
y_position_bckp = current_position[Y_AXIS];
@ -8916,8 +8945,6 @@ void manage_response() {
if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
st_synchronize();
//set nozzle target temperature to 0
setAllTargetHotends(0);
//Move XY to side
current_position[X_AXIS] = X_PAUSE_POS;
@ -8925,6 +8952,9 @@ void manage_response() {
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder);
st_synchronize();
}
if (turn_off_nozzle) {
//set nozzle target temperature to 0
setAllTargetHotends(0);
printf_P(PSTR("MMU not responding\n"));
lcd_show_fullscreen_message_and_wait_P(_i("MMU needs user attention. Please press knob to resume nozzle target temperature."));
setTargetHotend(hotend_temp_bckp, active_extruder);
@ -8932,12 +8962,15 @@ void manage_response() {
delay_keep_alive(1000);
lcd_wait_for_heater();
}
lcd_display_message_fullscreen_P(_i("Now check MMU. Fix the issue and then press knob on MMU unit."));
}
}
lcd_display_message_fullscreen_P(_i("Check MMU. Fix the issue and then press button on MMU unit."));
}
else if (mmu_print_saved) {
printf_P(PSTR("MMU start responding\n"));
lcd_clear();
lcd_display_message_fullscreen_P(_i("MMU OK. Resuming..."));
if (move_axes) {
current_position[X_AXIS] = x_position_bckp;
current_position[Y_AXIS] = y_position_bckp;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder);
@ -8946,22 +8979,15 @@ void manage_response() {
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
st_synchronize();
}
else {
delay_keep_alive(1000); //delay just for showing MMU OK message for a while in case that there are no xyz movements
}
}
}
if (lcd_update_was_enabled) lcd_update_enable(true);
}
void mmu_load_to_nozzle() {
/*bool saved_e_relative_mode = axis_relative_modes[E_AXIS];
if (!saved_e_relative_mode) {
enquecommand_front_P(PSTR("M82")); // set extruder to relative mode
}
enquecommand_front_P((PSTR("G1 E7.2000 F562")));
enquecommand_front_P((PSTR("G1 E14.4000 F871")));
enquecommand_front_P((PSTR("G1 E36.0000 F1393")));
enquecommand_front_P((PSTR("G1 E14.4000 F871")));
if (!saved_e_relative_mode) {
enquecommand_front_P(PSTR("M83")); // set extruder to relative mode
}*/
st_synchronize();
bool saved_e_relative_mode = axis_relative_modes[E_AXIS];
@ -9024,19 +9050,17 @@ void M600_check_state() {
}
void M600_wait_for_user() {
//Beep, manage nozzle heater and wait for user to start unload filament
KEEPALIVE_STATE(PAUSED_FOR_USER);
int counterBeep = 0;
unsigned long waiting_start_time = millis();
uint8_t wait_for_user_state = 0;
lcd_display_message_fullscreen_P(_T(MSG_PRESS_TO_UNLOAD));
//-//
bool bFirst=true;
while (!(wait_for_user_state == 0 && lcd_clicked())){
manage_heater();
manage_inactivity(true);
@ -9046,8 +9070,6 @@ void M600_wait_for_user() {
}
SET_OUTPUT(BEEPER);
if (counterBeep == 0) {
//-//
//if(eSoundMode==e_SOUND_MODE_LOUD)
if((eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst))
{
bFirst=false;
@ -9059,10 +9081,10 @@ void M600_wait_for_user() {
}
counterBeep++;
#endif
#endif //BEEPER > 0
switch (wait_for_user_state) {
case 0:
case 0: //nozzle is hot, waiting for user to press the knob to unload filament
delay_keep_alive(4);
if (millis() > waiting_start_time + (unsigned long)M600_TIMEOUT * 1000) {
@ -9077,7 +9099,7 @@ void M600_wait_for_user() {
disable_e2();
}
break;
case 1:
case 1: //nozzle target temperature is set to zero, waiting for user to start nozzle preheat
delay_keep_alive(4);
if (lcd_clicked()) {
@ -9087,7 +9109,7 @@ void M600_wait_for_user() {
wait_for_user_state = 2;
}
break;
case 2:
case 2: //waiting for nozzle to reach target temperature
if (abs(degTargetHotend(active_extruder) - degHotend(active_extruder)) < 1) {
lcd_display_message_fullscreen_P(_T(MSG_PRESS_TO_UNLOAD));
@ -9110,16 +9132,16 @@ void M600_wait_for_user() {
void mmu_M600_load_filament(bool automatic)
{
//load filament for mmu v2
bool response = false;
bool yes = false;
if (!automatic)
{
if (!automatic) {
yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false);
if (yes) tmp_extruder = choose_extruder_menu();
if(yes) tmp_extruder = choose_extruder_menu();
else tmp_extruder = mmu_extruder;
}
else
{
else {
tmp_extruder = (tmp_extruder+1)%5;
}
lcd_update_enable(false);
@ -9130,9 +9152,15 @@ void mmu_M600_load_filament(bool automatic)
snmm_filaments_used |= (1 << tmp_extruder); //for stop print
printf_P(PSTR("T code: %d \n"), tmp_extruder);
mmu_printf_P(PSTR("T%d\n"), tmp_extruder);
manage_response();
manage_response(false, true);
mmu_extruder = tmp_extruder; //filament change is finished
mmu_load_to_nozzle();
st_synchronize();
current_position[E_AXIS]+= FILAMENTCHANGE_FINALFEED ;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2, active_extruder);
}
void M600_load_filament_movements()

View File

@ -12,7 +12,7 @@
extern const char* lcd_display_message_fullscreen_P(const char *msg);
extern void lcd_return_to_status();
#define MMU_TIMEOUT 1000
#define MMU_TIMEOUT 100
bool mmu_enabled = false;
@ -193,7 +193,7 @@ void extr_adj(int extruder) //loading filament for SNMM
lcd_print(mmu_extruder + 1);
// get response
manage_response();
manage_response(false, false);
lcd_update_enable(true);
@ -268,7 +268,7 @@ void extr_unload()
fprintf_P(uart2io, PSTR("U0\n"));
// get response
manage_response();
manage_response(false, true);
lcd_update_enable(true);
#else //SNMM

View File

@ -3052,7 +3052,7 @@ bool lcd_wait_for_pinda(float temp) {
void lcd_wait_for_heater() {
lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING));
lcd_set_degree();
lcd_set_cursor(0, 4);
lcd_print(LCD_STR_THERMOMETER[0]);
lcd_print(ftostr3(degHotend(active_extruder)));

View File

@ -32,7 +32,7 @@
#define _PI 3.14159265F
extern long count_position[NUM_AXIS];
extern volatile long count_position[NUM_AXIS];
uint8_t check_pinda_0();
uint8_t check_pinda_1();