merge debug gcodes for bed analysis

This commit is contained in:
PavelSindler 2019-03-06 20:45:23 +01:00
commit 98bb2b7acf
19 changed files with 593 additions and 275 deletions

View file

@ -7,8 +7,8 @@
#define STR(x) STR_HELPER(x)
// Firmware version
#define FW_VERSION "3.6.0-RC1"
#define FW_COMMIT_NR 2060
#define FW_VERSION "3.6.0"
#define FW_COMMIT_NR 2069
// FW_VERSION_UNKNOWN means this is an unofficial build.
// The firmware should only be checked into github with this symbol.
#define FW_DEV_VERSION FW_VERSION_UNKNOWN
@ -132,7 +132,7 @@
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
#define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term
#define K1 0.95 //smoothing factor within the PID
#define PID_K1 0.95 //smoothing factor within the PID
#define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
@ -446,7 +446,9 @@ your extruder heater takes 2 minutes to hit the target on heating.
// When enabled Marlin will send a busy status message to the host
// every couple of seconds when it can't accept commands.
//
#ifndef HEATBED_ANALYSIS
#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages
#endif //HEATBED_ANALYSIS
#define HOST_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
//LCD and SD support

View file

@ -284,6 +284,7 @@ void setPwmFrequency(uint8_t pin, int val);
#define CRITICAL_SECTION_END SREG = _sreg;
#endif //CRITICAL_SECTION_START
extern bool fans_check_enabled;
extern float homing_feedrate[];
extern bool axis_relative_modes[];
extern int feedmultiply;
@ -296,9 +297,14 @@ extern float min_pos[3];
extern float max_pos[3];
extern bool axis_known_position[3];
extern int fanSpeed;
extern void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0);
extern int8_t lcd_change_fil_state;
#ifdef TMC2130
void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0);
#else
void homeaxis(int axis, uint8_t cnt = 1);
#endif //TMC2130
#ifdef FAN_SOFT_PWM
extern unsigned char fanSpeedSoftPwm;
@ -310,9 +316,9 @@ extern float retract_length_swap;
extern float retract_recover_length_swap;
#endif
#ifdef HOST_KEEPALIVE_FEATURE
extern uint8_t host_keepalive_interval;
#endif
extern unsigned long starttime;
extern unsigned long stoptime;
@ -396,13 +402,12 @@ extern void check_babystep();
extern void long_pause();
extern void crashdet_stop_and_save_print();
#ifdef DIS
#ifdef HEATBED_ANALYSIS
void d_setup();
float d_ReadData();
void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y);
#endif
void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y);
#endif //HEATBED_ANALYSIS
float temp_comp_interpolation(float temperature);
void temp_compensation_apply();
void temp_compensation_start();
@ -442,7 +447,7 @@ extern void restore_print_from_ram_and_continue(float e_move);
extern uint16_t print_time_remaining();
extern uint8_t calc_percent_done();
#ifdef HOST_KEEPALIVE_FEATURE
// States for managing Marlin and host communication
// Marlin sends messages if blocked or busy
@ -465,7 +470,6 @@ extern void host_keepalive();
//extern MarlinBusyState busy_state;
extern int busy_state;
#endif //HOST_KEEPALIVE_FEATURE
#ifdef TMC2130
@ -477,8 +481,6 @@ void force_high_power_mode(bool start_high_power_section);
#endif //TMC2130
// G-codes
void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl);
void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis);
bool gcode_M45(bool onlyZ, int8_t verbosity_level);
void gcode_M114();

View file

@ -302,16 +302,9 @@ int fanSpeed=0;
bool cancel_heatup = false ;
#ifdef HOST_KEEPALIVE_FEATURE
int busy_state = NOT_BUSY;
static long prev_busy_signal_ms = -1;
uint8_t host_keepalive_interval = HOST_KEEPALIVE_INTERVAL;
#else
#define host_keepalive();
#define KEEPALIVE_STATE(n);
#endif
int busy_state = NOT_BUSY;
static long prev_busy_signal_ms = -1;
uint8_t host_keepalive_interval = HOST_KEEPALIVE_INTERVAL;
const char errormagic[] PROGMEM = "Error:";
const char echomagic[] PROGMEM = "echo:";
@ -407,6 +400,7 @@ static void get_arc_coordinates();
static bool setTargetedHotend(int code, uint8_t &extruder);
static void print_time_remaining_init();
static void wait_for_heater(long codenum, uint8_t extruder);
static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis);
uint16_t gcode_in_progress = 0;
uint16_t mcode_in_progress = 0;
@ -511,7 +505,6 @@ void servo_init()
bool fans_check_enabled = true;
#ifdef TMC2130
extern int8_t CrashDetectMenu;
@ -1697,12 +1690,14 @@ void serial_read_stream() {
}
}
#ifdef HOST_KEEPALIVE_FEATURE
/**
* Output a "busy" message at regular intervals
* while the machine is not accepting commands.
*/
void host_keepalive() {
#ifndef HOST_KEEPALIVE_FEATURE
return;
#endif //HOST_KEEPALIVE_FEATURE
if (farm_mode) return;
long ms = _millis();
if (host_keepalive_interval && busy_state != NOT_BUSY) {
@ -1727,7 +1722,7 @@ void host_keepalive() {
}
prev_busy_signal_ms = ms;
}
#endif
// The loop() function is called in an endless loop by the Arduino framework from the default main() routine.
// Before loop(), the setup() function is called by the main() routine.
@ -2127,7 +2122,11 @@ bool calibrate_z_auto()
}
#endif //TMC2130
#ifdef TMC2130
void homeaxis(int axis, uint8_t cnt, uint8_t* pstep)
#else
void homeaxis(int axis, uint8_t cnt)
#endif //TMC2130
{
bool endstops_enabled = enable_endstops(true); //RP: endstops should be allways enabled durring homing
#define HOMEAXIS_DO(LETTER) \
@ -2436,11 +2435,12 @@ void force_high_power_mode(bool start_high_power_section) {
}
#endif //TMC2130
void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis) {
gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, false, true);
}
void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl) {
#ifdef TMC2130
static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl)
#else
static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool without_mbl)
#endif //TMC2130
{
st_synchronize();
#if 0
@ -2725,6 +2725,15 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_
#endif
}
static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis)
{
#ifdef TMC2130
gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, false, true);
#else
gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, true);
#endif //TMC2130
}
void adjust_bed_reset()
{
eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1);
@ -3831,8 +3840,12 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
home_z_value = code_value_long();
bool without_mbl = code_seen('W');
// calibrate?
#ifdef TMC2130
bool calib = code_seen('C');
gcode_G28(home_x, home_x_value, home_y, home_y_value, home_z, home_z_value, calib, without_mbl);
#else
gcode_G28(home_x, home_x_value, home_y, home_y_value, home_z, home_z_value, without_mbl);
#endif //TMC2130
if ((home_x || home_y || without_mbl || home_z) == false) {
// Push the commands to the front of the message queue in the reverse order!
// There shall be always enough space reserved for these commands.
@ -4296,44 +4309,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
}
break;
#ifdef DIS
case 77:
{
//! G77 X200 Y150 XP100 YP15 XO10 Y015
//! for 9 point mesh bed leveling G77 X203 Y196 XP3 YP3 XO0 YO0
//! G77 X232 Y218 XP116 YP109 XO-11 YO0
float dimension_x = 40;
float dimension_y = 40;
int points_x = 40;
int points_y = 40;
float offset_x = 74;
float offset_y = 33;
if (code_seen('X')) dimension_x = code_value();
if (code_seen('Y')) dimension_y = code_value();
if (code_seen("XP")) { strchr_pointer+=1; points_x = code_value(); }
if (code_seen("YP")) { strchr_pointer+=1; points_y = code_value(); }
if (code_seen("XO")) { strchr_pointer+=1; offset_x = code_value(); }
if (code_seen("YO")) { strchr_pointer+=1; offset_y = code_value(); }
bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
} break;
#endif
case 79: {
for (int i = 255; i > 0; i = i - 5) {
fanSpeed = i;
//delay_keep_alive(2000);
for (int j = 0; j < 100; j++) {
delay_keep_alive(100);
}
printf_P(_N("%d: %d\n"), i, fan_speed[1]);
}
}break;
/**
* G80: Mesh-based Z probe, probes a grid and produces a
@ -5814,7 +5790,6 @@ Sigma_Exit:
if (code_seen('N'))
gcode_LastN = code_value_long();
break;
#ifdef HOST_KEEPALIVE_FEATURE
case 113: // M113 - Get or set Host Keepalive interval
if (code_seen('S')) {
host_keepalive_interval = (uint8_t)code_value_short();
@ -5826,7 +5801,6 @@ Sigma_Exit:
SERIAL_PROTOCOLLN("");
}
break;
#endif
case 115: // M115
if (code_seen('V')) {
// Report the Prusa version number.
@ -7160,7 +7134,66 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
dcode_9(); break;
case 10: //! D10 - XYZ calibration = OK
dcode_10(); break;
#endif //DEBUG_DCODES
#ifdef HEATBED_ANALYSIS
case 80:
{
float dimension_x = 40;
float dimension_y = 40;
int points_x = 40;
int points_y = 40;
float offset_x = 74;
float offset_y = 33;
if (code_seen('E')) dimension_x = code_value();
if (code_seen('F')) dimension_y = code_value();
if (code_seen('G')) {points_x = code_value(); }
if (code_seen('H')) {points_y = code_value(); }
if (code_seen('I')) {offset_x = code_value(); }
if (code_seen('J')) {offset_y = code_value(); }
printf_P(PSTR("DIM X: %f\n"), dimension_x);
printf_P(PSTR("DIM Y: %f\n"), dimension_y);
printf_P(PSTR("POINTS X: %d\n"), points_x);
printf_P(PSTR("POINTS Y: %d\n"), points_y);
printf_P(PSTR("OFFSET X: %f\n"), offset_x);
printf_P(PSTR("OFFSET Y: %f\n"), offset_y);
bed_check(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
}break;
case 81:
{
float dimension_x = 40;
float dimension_y = 40;
int points_x = 40;
int points_y = 40;
float offset_x = 74;
float offset_y = 33;
if (code_seen('E')) dimension_x = code_value();
if (code_seen('F')) dimension_y = code_value();
if (code_seen("G")) { strchr_pointer+=1; points_x = code_value(); }
if (code_seen("H")) { strchr_pointer+=1; points_y = code_value(); }
if (code_seen("I")) { strchr_pointer+=1; offset_x = code_value(); }
if (code_seen("J")) { strchr_pointer+=1; offset_y = code_value(); }
bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
} break;
#endif //HEATBED_ANALYSIS
#ifdef DEBUG_DCODES
case 106: //D106 print measured fan speed for different pwm values
{
for (int i = 255; i > 0; i = i - 5) {
fanSpeed = i;
//delay_keep_alive(2000);
for (int j = 0; j < 100; j++) {
delay_keep_alive(100);
}
printf_P(_N("%d: %d\n"), i, fan_speed[1]);
}
}break;
#ifdef TMC2130
case 2130: //! D2130 - TMC2130
@ -7521,7 +7554,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
if (mmu_enabled == false)
{
//-// if (mcode_in_progress != 600) //M600 not in progress
if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active
if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad) && (menu_menu!=lcd_menu_extruder_info)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo menu not active
{
if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active)
{
@ -7956,7 +7989,7 @@ void check_babystep()
lcd_update_enable(true);
}
}
#ifdef DIS
#ifdef HEATBED_ANALYSIS
void d_setup()
{
pinMode(D_DATACLOCK, INPUT_PULLUP);
@ -8006,6 +8039,199 @@ float d_ReadData()
}
void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y) {
int t1 = 0;
int t_delay = 0;
int digit[13];
int m;
char str[3];
//String mergeOutput;
char mergeOutput[15];
float output;
int mesh_point = 0; //index number of calibration point
float bed_zero_ref_x = (-22.f + X_PROBE_OFFSET_FROM_EXTRUDER); //shift between zero point on bed and target and between probe and nozzle
float bed_zero_ref_y = (-0.6f + Y_PROBE_OFFSET_FROM_EXTRUDER);
float mesh_home_z_search = 4;
float measure_z_heigth = 0.2f;
float row[x_points_num];
int ix = 0;
int iy = 0;
const char* filename_wldsd = "mesh.txt";
char data_wldsd[x_points_num * 7 + 1]; //6 chars(" -A.BCD")for each measurement + null
char numb_wldsd[8]; // (" -A.BCD" + null)
#ifdef MICROMETER_LOGGING
d_setup();
#endif //MICROMETER_LOGGING
int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS] / 20;
int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40;
unsigned int custom_message_type_old = custom_message_type;
unsigned int custom_message_state_old = custom_message_state;
custom_message_type = CUSTOM_MSG_TYPE_MESHBL;
custom_message_state = (x_points_num * y_points_num) + 10;
lcd_update(1);
//mbl.reset();
babystep_undo();
card.openFile(filename_wldsd, false);
/*destination[Z_AXIS] = mesh_home_z_search;
//plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
for(int8_t i=0; i < NUM_AXIS; i++) {
current_position[i] = destination[i];
}
st_synchronize();
*/
destination[Z_AXIS] = measure_z_heigth;
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
for(int8_t i=0; i < NUM_AXIS; i++) {
current_position[i] = destination[i];
}
st_synchronize();
/*int l_feedmultiply = */setup_for_endstop_move(false);
SERIAL_PROTOCOLPGM("Num X,Y: ");
SERIAL_PROTOCOL(x_points_num);
SERIAL_PROTOCOLPGM(",");
SERIAL_PROTOCOL(y_points_num);
SERIAL_PROTOCOLPGM("\nZ search height: ");
SERIAL_PROTOCOL(mesh_home_z_search);
SERIAL_PROTOCOLPGM("\nDimension X,Y: ");
SERIAL_PROTOCOL(x_dimension);
SERIAL_PROTOCOLPGM(",");
SERIAL_PROTOCOL(y_dimension);
SERIAL_PROTOCOLLNPGM("\nMeasured points:");
while (mesh_point != x_points_num * y_points_num) {
ix = mesh_point % x_points_num; // from 0 to MESH_NUM_X_POINTS - 1
iy = mesh_point / x_points_num;
if (iy & 1) ix = (x_points_num - 1) - ix; // Zig zag
float z0 = 0.f;
/*destination[Z_AXIS] = mesh_home_z_search;
//plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
for(int8_t i=0; i < NUM_AXIS; i++) {
current_position[i] = destination[i];
}
st_synchronize();*/
//current_position[X_AXIS] = 13.f + ix * (x_dimension / (x_points_num - 1)) - bed_zero_ref_x + shift_x;
//current_position[Y_AXIS] = 6.4f + iy * (y_dimension / (y_points_num - 1)) - bed_zero_ref_y + shift_y;
destination[X_AXIS] = ix * (x_dimension / (x_points_num - 1)) + shift_x;
destination[Y_AXIS] = iy * (y_dimension / (y_points_num - 1)) + shift_y;
mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], XY_AXIS_FEEDRATE/6, active_extruder);
for(int8_t i=0; i < NUM_AXIS; i++) {
current_position[i] = destination[i];
}
st_synchronize();
// printf_P(PSTR("X = %f; Y= %f \n"), current_position[X_AXIS], current_position[Y_AXIS]);
delay_keep_alive(1000);
#ifdef MICROMETER_LOGGING
//memset(numb_wldsd, 0, sizeof(numb_wldsd));
//dtostrf(d_ReadData(), 8, 5, numb_wldsd);
//strcat(data_wldsd, numb_wldsd);
//MYSERIAL.println(data_wldsd);
//delay(1000);
//delay(3000);
//t1 = millis();
//while (digitalRead(D_DATACLOCK) == LOW) {}
//while (digitalRead(D_DATACLOCK) == HIGH) {}
memset(digit, 0, sizeof(digit));
//cli();
digitalWrite(D_REQUIRE, LOW);
for (int i = 0; i<13; i++)
{
//t1 = millis();
for (int j = 0; j < 4; j++)
{
while (digitalRead(D_DATACLOCK) == LOW) {}
while (digitalRead(D_DATACLOCK) == HIGH) {}
//printf_P(PSTR("Done %d\n"), j);
bitWrite(digit[i], j, digitalRead(D_DATA));
}
//t_delay = (millis() - t1);
//SERIAL_PROTOCOLPGM(" ");
//SERIAL_PROTOCOL_F(t_delay, 5);
//SERIAL_PROTOCOLPGM(" ");
}
//sei();
digitalWrite(D_REQUIRE, HIGH);
mergeOutput[0] = '\0';
output = 0;
for (int r = 5; r <= 10; r++) //Merge digits
{
sprintf(str, "%d", digit[r]);
strcat(mergeOutput, str);
}
output = atof(mergeOutput);
if (digit[4] == 8) //Handle sign
{
output *= -1;
}
for (int i = digit[11]; i > 0; i--) //Handle floating point
{
output *= 0.1;
}
//output = d_ReadData();
//row[ix] = current_position[Z_AXIS];
//row[ix] = d_ReadData();
row[ix] = output;
if (iy % 2 == 1 ? ix == 0 : ix == x_points_num - 1) {
memset(data_wldsd, 0, sizeof(data_wldsd));
for (int i = 0; i < x_points_num; i++) {
SERIAL_PROTOCOLPGM(" ");
SERIAL_PROTOCOL_F(row[i], 5);
memset(numb_wldsd, 0, sizeof(numb_wldsd));
dtostrf(row[i], 7, 3, numb_wldsd);
strcat(data_wldsd, numb_wldsd);
}
card.write_command(data_wldsd);
SERIAL_PROTOCOLPGM("\n");
}
custom_message_state--;
mesh_point++;
lcd_update(1);
}
#endif //MICROMETER_LOGGING
card.closefile();
//clean_up_after_endstop_move(l_feedmultiply);
}
void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y) {
int t1 = 0;
int t_delay = 0;
@ -8189,7 +8415,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
card.closefile();
clean_up_after_endstop_move(l_feedmultiply);
}
#endif
#endif //HEATBED_ANALYSIS
void temp_compensation_start() {

View file

@ -153,10 +153,9 @@
#define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) //uint16_t
#define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) //uint8_t
#define EEPROM_UVLO_MESH_BED_LEVELING_FULL (EEPROM_MMU_LOAD_FAIL - 12*12*2) //allow 12 calibration points for future expansion
#define EEPROM_MMU_CUTTER_ENABLED (EEPROM_MMU_LOAD_FAIL - 1)
#define EEPROM_UVLO_MESH_BED_LEVELING_FULL (EEPROM_MMU_CUTTER_ENABLED - 12*12*2) //allow 12 calibration points for future expansion
#define EEPROM_MBL_TYPE (EEPROM_UVLO_MESH_BED_LEVELING_FULL-1) //uint8_t for mesh bed leveling precision
// !!!!!
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
// !!!!!

View file

@ -77,7 +77,7 @@ uint8_t lang_select(uint8_t lang)
if (lang_check(table))
if (pgm_read_dword(((uint32_t*)(table + 12))) == pgm_read_dword(((uint32_t*)(_PRI_LANG_SIGNATURE)))) //signature valid
{
lang_table = table; // set table pointer
lang_table = (lang_table_t*)table; // set table pointer
lang_selected = lang; // set language id
}
}
@ -157,7 +157,7 @@ uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* off
if (lang == LANG_ID_SEC)
{
uint16_t ui = _SEC_LANG_TABLE; //table pointer
memcpy_P(header, ui, sizeof(lang_table_header_t)); //read table header from progmem
memcpy_P(header, (lang_table_header_t*)ui, sizeof(lang_table_header_t)); //read table header from progmem
if (offset) *offset = ui;
return (header->magic == LANG_MAGIC)?1:0; //return 1 if magic valid
}

View file

@ -122,7 +122,7 @@ void menu_back_if_clicked_fb(void)
void menu_submenu(menu_func_t submenu)
{
if (menu_depth <= MENU_DEPTH_MAX)
if (menu_depth < MENU_DEPTH_MAX)
{
menu_stack[menu_depth].menu = menu_menu;
menu_stack[menu_depth++].position = lcd_encoder;
@ -132,7 +132,7 @@ void menu_submenu(menu_func_t submenu)
static void menu_submenu_no_reset(menu_func_t submenu)
{
if (menu_depth <= MENU_DEPTH_MAX)
if (menu_depth < MENU_DEPTH_MAX)
{
menu_stack[menu_depth].menu = menu_menu;
menu_stack[menu_depth++].position = lcd_encoder;

View file

@ -181,6 +181,17 @@ bool check_for_ir_sensor()
#endif //IR_SENSOR
}
static bool activate_stealth_mode()
{
#if defined (MMU_FORCE_STEALTH_MODE)
return true;
#elif defined (SILENT_MODE_STEALTH)
return (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH);
#else
return false;
#endif
}
//mmu main loop - state machine processing
void mmu_loop(void)
{
@ -222,8 +233,8 @@ void mmu_loop(void)
bool version_valid = mmu_check_version();
if (!version_valid) mmu_show_warning();
else puts_P(PSTR("MMU version valid"));
if ((PRINTER_TYPE == PRINTER_MK3) || (PRINTER_TYPE == PRINTER_MK3_SNMM))
if (!activate_stealth_mode())
{
FDEBUG_PUTS_P(PSTR("MMU <= 'P0'"));
mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
@ -297,6 +308,14 @@ void mmu_loop(void)
mmu_fil_loaded = false;
mmu_state = S::WaitCmd;
}
else if ((mmu_cmd >= MmuCmd::K0) && (mmu_cmd <= MmuCmd::K4))
{
const uint8_t filament = mmu_cmd - MmuCmd::K0;
DEBUG_PRINTF_P(PSTR("MMU <= 'K%d'\n"), filament);
mmu_printf_P(PSTR("K%d\n"), filament); //send eject filament
mmu_fil_loaded = false;
mmu_state = S::WaitCmd;
}
else if (mmu_cmd == MmuCmd::R0)
{
DEBUG_PRINTF_P(PSTR("MMU <= 'R0'\n"));
@ -1044,14 +1063,14 @@ else {
}
}
//-//
//! @brief show which filament is currently unloaded
void extr_unload_view()
{
lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT));
lcd_print(" ");
if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" ");
else lcd_print(mmu_extruder + 1);
lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT));
lcd_print(" ");
if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" ");
else lcd_print(mmu_extruder + 1);
}
void extr_unload()
@ -1066,17 +1085,8 @@ void extr_unload()
{
#ifndef SNMM
st_synchronize();
//show which filament is currently unloaded
//-// lcd_update_enable(false);
menu_submenu(extr_unload_view);
/*
lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT));
lcd_print(" ");
if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" ");
else lcd_print(mmu_extruder + 1);
*/
menu_submenu(extr_unload_view);
mmu_filament_ramming();
@ -1084,8 +1094,7 @@ menu_submenu(extr_unload_view);
// get response
manage_response(false, true, MMU_UNLOAD_MOVE);
//-// lcd_update_enable(true);
menu_back();
menu_back();
#else //SNMM
lcd_clear();
@ -1143,7 +1152,6 @@ menu_back();
{
show_preheat_nozzle_warning();
}
//lcd_return_to_status();
}
//wrapper functions for loading filament
@ -1197,76 +1205,6 @@ void extr_adj_4()
#endif
}
void mmu_load_to_nozzle_0()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(0);
}
void mmu_load_to_nozzle_1()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(1);
}
void mmu_load_to_nozzle_2()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(2);
}
void mmu_load_to_nozzle_3()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(3);
}
void mmu_load_to_nozzle_4()
{
//-//
menu_back();
lcd_mmu_load_to_nozzle(4);
}
void mmu_eject_fil_0()
{
//-//
menu_back();
mmu_eject_filament(0, true);
}
void mmu_eject_fil_1()
{
//-//
menu_back();
mmu_eject_filament(1, true);
}
void mmu_eject_fil_2()
{
//-//
menu_back();
mmu_eject_filament(2, true);
}
void mmu_eject_fil_3()
{
//-//
menu_back();
mmu_eject_filament(3, true);
}
void mmu_eject_fil_4()
{
//-//
menu_back();
mmu_eject_filament(4, true);
}
void load_all()
{
#ifndef SNMM
@ -1421,6 +1359,26 @@ bFilamentAction=false; // NOT in "mmu_load_to_nozzle_
}
}
void mmu_cut_filament(uint8_t filament_nr)
{
bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()"
if (degHotend0() > EXTRUDE_MINTEMP)
{
LcdUpdateDisabler disableLcdUpdate;
lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_i("Cutting filament")); //// c=18 r=1
lcd_print(" ");
lcd_print(filament_nr + 1);
mmu_filament_ramming();
mmu_command(MmuCmd::K0 + filament_nr);
manage_response(false, false, MMU_UNLOAD_MOVE);
}
else
{
show_preheat_nozzle_warning();
}
}
void mmu_eject_filament(uint8_t filament, bool recover)
{
//-//
@ -1436,9 +1394,7 @@ bFilamentAction=false; // NOT in "mmu_fil_eject_menu(
LcdUpdateDisabler disableLcdUpdate;
lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_i("Ejecting filament"));
current_position[E_AXIS] -= 80;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2500 / 60, active_extruder);
st_synchronize();
mmu_filament_ramming();
mmu_command(MmuCmd::E0 + filament);
manage_response(false, false, MMU_UNLOAD_MOVE);
if (recover)
@ -1461,15 +1417,26 @@ bFilamentAction=false; // NOT in "mmu_fil_eject_menu(
}
}
//! @brief load more
//!
//! Try to feed more filament from MMU if it is not detected by filament sensor.
//! Move filament back and forth to nozzle in order to detect jam.
//! If PTFE tube is jammed, this cause filament to be unloaded and no longer
//! detected by pulley IR sensor in next step.
static void load_more()
{
for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++)
{
if (PIN_GET(IR_SENSOR_PIN) == 0) return;
if (PIN_GET(IR_SENSOR_PIN) == 0) break;
DEBUG_PRINTF_P(PSTR("Additional load attempt nr. %d\n"), i);
mmu_command(MmuCmd::C0);
manage_response(true, true, MMU_LOAD_MOVE);
}
current_position[E_AXIS] += 60;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder);
current_position[E_AXIS] -= 58;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder);
st_synchronize();
}
void mmu_continue_loading()
@ -1484,6 +1451,12 @@ void mmu_continue_loading()
if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1);
if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1);
if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
{
mmu_command(MmuCmd::K0 + tmp_extruder);
manage_response(true, true, MMU_UNLOAD_MOVE);
}
mmu_command(MmuCmd::T0 + tmp_extruder);
manage_response(true, true, MMU_TCODE_MOVE);
load_more();

View file

@ -52,6 +52,11 @@ enum class MmuCmd : uint_least8_t
E2,
E3,
E4,
K0,
K1,
K2,
K3,
K4,
R0,
S3,
W0,
@ -108,11 +113,6 @@ extern void extr_adj_1();
extern void extr_adj_2();
extern void extr_adj_3();
extern void extr_adj_4();
extern void mmu_load_to_nozzle_0();
extern void mmu_load_to_nozzle_1();
extern void mmu_load_to_nozzle_2();
extern void mmu_load_to_nozzle_3();
extern void mmu_load_to_nozzle_4();
extern void load_all();
extern void extr_change_0();
extern void extr_change_1();
@ -132,11 +132,7 @@ extern bool mmu_check_version();
extern void mmu_show_warning();
extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr);
extern void mmu_eject_filament(uint8_t filament, bool recover);
extern void mmu_eject_fil_0();
extern void mmu_eject_fil_1();
extern void mmu_eject_fil_2();
extern void mmu_eject_fil_3();
extern void mmu_eject_fil_4();
extern void mmu_cut_filament(uint8_t filament_nr);
extern void mmu_continue_loading();
extern void mmu_filament_ramming();
extern void mmu_wait_for_heater_blocking();

View file

@ -3,20 +3,6 @@
#include "boards.h"
#if !MB(5DPRINT)
#define X_MS1_PIN -1
#define X_MS2_PIN -1
#define Y_MS1_PIN -1
#define Y_MS2_PIN -1
#define Z_MS1_PIN -1
#define Z_MS2_PIN -1
#define E0_MS1_PIN -1
#define E0_MS2_PIN -1
#define E1_MS1_PIN -1
#define E1_MS2_PIN -1
#define DIGIPOTSS_PIN -1
#endif
#define LARGE_FLASH true
/*****************************************************************

View file

@ -14,6 +14,12 @@
#define SWI2C_SDA 20 //SDA on P3
#define SWI2C_SCL 21 //SCL on P3
#ifdef MICROMETER_LOGGING
#define D_DATACLOCK 24 //Y_MAX (green)
#define D_DATA 30 //X_MAX (blue)
#define D_REQUIRE 23 //Z_MAX (white)
#endif //MICROMETER_LOGGING
#define X_STEP_PIN 37

View file

@ -92,10 +92,15 @@ bool abort_on_endstop_hit = false;
int motor_current_setting_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
#endif
static bool old_x_min_endstop=false;
#if ( (defined(X_MAX_PIN) && (X_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_XMAXLIMIT)
static bool old_x_max_endstop=false;
static bool old_y_min_endstop=false;
#endif
#if ( (defined(Y_MAX_PIN) && (Y_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_YMAXLIMIT)
static bool old_y_max_endstop=false;
#endif
static bool old_x_min_endstop=false;
static bool old_y_min_endstop=false;
static bool old_z_min_endstop=false;
static bool old_z_max_endstop=false;

View file

@ -484,8 +484,6 @@ void countFanSpeed()
fan_edge_counter[1] = 0;
}
extern bool fans_check_enabled;
void checkFanSpeed()
{
uint8_t max_print_fan_errors = 0;
@ -663,9 +661,9 @@ void manage_heater()
iState_sum[e] += pid_error[e];
iState_sum[e] = constrain(iState_sum[e], iState_sum_min[e], iState_sum_max[e]);
iTerm[e] = cs.Ki * iState_sum[e];
// K1 defined in Configuration.h in the PID settings
#define K2 (1.0-K1)
dTerm[e] = (cs.Kd * (pid_input - dState_last[e]))*K2 + (K1 * dTerm[e]); // e.g. digital filtration of derivative term changes
// PID_K1 defined in Configuration.h in the PID settings
#define K2 (1.0-PID_K1)
dTerm[e] = (cs.Kd * (pid_input - dState_last[e]))*K2 + (PID_K1 * dTerm[e]); // e.g. digital filtration of derivative term changes
pid_output = pTerm[e] + iTerm[e] - dTerm[e]; // subtraction due to "Derivative on Measurement" method (i.e. derivative of input instead derivative of error is used)
if (pid_output > PID_MAX) {
if (pid_error[e] > 0 ) iState_sum[e] -= pid_error[e]; // conditional un-integration
@ -812,9 +810,9 @@ void manage_heater()
temp_iState_bed = constrain(temp_iState_bed, temp_iState_min_bed, temp_iState_max_bed);
iTerm_bed = cs.bedKi * temp_iState_bed;
//K1 defined in Configuration.h in the PID settings
#define K2 (1.0-K1)
dTerm_bed= (cs.bedKd * (pid_input - temp_dState_bed))*K2 + (K1 * dTerm_bed);
//PID_K1 defined in Configuration.h in the PID settings
#define K2 (1.0-PID_K1)
dTerm_bed= (cs.bedKd * (pid_input - temp_dState_bed))*K2 + (PID_K1 * dTerm_bed);
temp_dState_bed = pid_input;
pid_output = pTerm_bed + iTerm_bed - dTerm_bed;
@ -890,9 +888,7 @@ void manage_heater()
}
#endif
#ifdef HOST_KEEPALIVE_FEATURE
host_keepalive();
#endif
}
#define PGM_RD_W(x) (short)pgm_read_word(&x)

View file

@ -157,12 +157,12 @@ void delay2(unsigned long ms)
}
}
void tone2(uint8_t _pin, unsigned int frequency/*, unsigned long duration*/)
void tone2(__attribute__((unused)) uint8_t _pin, __attribute__((unused)) unsigned int frequency/*, unsigned long duration*/)
{
PIN_SET(BEEPER);
}
void noTone2(uint8_t _pin)
void noTone2(__attribute__((unused)) uint8_t _pin)
{
PIN_CLR(BEEPER);
}

View file

@ -41,8 +41,6 @@
#include "static_assert.h"
#include "io_atmega2560.h"
extern bool fans_check_enabled;
int scrollstuff = 0;
char longFilenameOLD[LONG_FILENAME_LENGTH];
@ -133,7 +131,7 @@ static void prusa_stat_farm_number();
static void prusa_stat_temperatures();
static void prusa_stat_printinfo();
static void lcd_farm_no();
static void lcd_menu_extruder_info();
void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
static void lcd_menu_xyz_y_min();
static void lcd_menu_xyz_skew();
static void lcd_menu_xyz_offset();
@ -144,6 +142,7 @@ static void lcd_menu_show_sensors_state();
static void mmu_fil_eject_menu();
static void mmu_load_to_nozzle_menu();
static void mmu_cut_filament_menu();
#if defined(TMC2130) || defined(FILAMENT_SENSOR)
static void lcd_menu_fails_stats();
@ -187,7 +186,9 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite);
#ifdef FANCHECK
static bool lcd_selftest_fan_dialog(int _fan);
#endif //FANCHECK
#ifdef PAT9125
static bool lcd_selftest_fsensor();
#endif //PAT9125
static bool selftest_irsensor();
static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2);
static void lcd_colorprint_change();
@ -200,6 +201,7 @@ static void fil_unload_menu();
#endif // SNMM || SNMM_V2
static void lcd_disable_farm_mode();
static void lcd_set_fan_check();
static void lcd_cutter_enabled();
static char snmm_stop_print_menu();
#ifdef SDCARD_SORT_ALPHA
static void lcd_sort_type_set();
@ -1899,7 +1901,7 @@ void lcd_cooldown()
}
static void lcd_menu_extruder_info()
void lcd_menu_extruder_info() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
{
//|01234567890123456789|
//|Nozzle FAN: RPM|
@ -2293,6 +2295,18 @@ void lcd_set_fan_check() {
eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED, fans_check_enabled);
}
void lcd_cutter_enabled()
{
if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
{
eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 0);
}
else
{
eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 1);
}
}
void lcd_set_filament_autoload() {
fsensor_autoload_set(!fsensor_autoload_enabled);
}
@ -2330,7 +2344,8 @@ switch(eFilamentAction)
lcd_puts_P(_i("to unload filament")); ////MSG_ c=20 r=1
break;
case e_FILAMENT_ACTION_mmuEject:
lcd_puts_P(_i("to eject filament")); ////MSG_ c=20 r=1
case e_FILAMENT_ACTION_mmuCut:
case e_FILAMENT_ACTION_none:
break;
}
if(lcd_clicked())
@ -2344,38 +2359,23 @@ if(lcd_clicked())
menu_back(nLevel);
switch(eFilamentAction)
{
case e_FILAMENT_ACTION_Load:
case e_FILAMENT_ACTION_autoLoad:
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
// no break
case e_FILAMENT_ACTION_Load:
loading_flag=true;
enquecommand_P(PSTR("M701")); // load filament
break;
case e_FILAMENT_ACTION_unLoad:
enquecommand_P(PSTR("M702")); // unload filament
break;
/*
case e_FILAMENT_ACTION_mmuLoad:
//./ MYSERIAL.println("mFilamentPrompt - mmuLoad");
bFilamentAction=true;
menu_submenu(mmu_load_to_nozzle_menu);
break;
*/
/*
case e_FILAMENT_ACTION_mmuUnLoad:
//./ MYSERIAL.println("mFilamentPrompt - mmuUnLoad");
bFilamentAction=true;
extr_unload();
break;
*/
/*
case e_FILAMENT_ACTION_mmuEject:
MYSERIAL.println("mFilamentPrompt - mmuEject");
bFilamentAction=true;
// menu_submenu(mmu_fil_eject_menu);
case e_FILAMENT_ACTION_mmuCut:
case e_FILAMENT_ACTION_none:
break;
*/
}
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
}
}
@ -2409,6 +2409,9 @@ switch(eFilamentAction)
case e_FILAMENT_ACTION_mmuEject:
lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1
break;
case e_FILAMENT_ACTION_mmuCut:
lcd_puts_P(_i("Preheating to cut")); ////MSG_ c=20 r=1
break;
}
lcd_set_cursor(0,3);
lcd_puts_P(_i(">Cancel")); ////MSG_ c=20 r=1
@ -2462,6 +2465,14 @@ else {
menu_back(nLevel);
menu_submenu(mmu_fil_eject_menu);
break;
case e_FILAMENT_ACTION_mmuCut:
nLevel=1;
if(!bFilamentPreheatState)
nLevel++;
bFilamentAction=true;
menu_back(nLevel);
menu_submenu(mmu_cut_filament_menu);
break;
}
if(bBeep)
Sound_MakeSound(e_SOUND_TYPE_StandardPrompt);
@ -2524,6 +2535,14 @@ if(current_temperature[0]>(target_temperature[0]*0.95))
menu_back(nLevel);
menu_submenu(mmu_fil_eject_menu);
break;
case e_FILAMENT_ACTION_mmuCut:
nLevel=bFilamentPreheatState?1:2;
bFilamentAction=true;
menu_back(nLevel);
menu_submenu(mmu_cut_filament_menu);
break;
case e_FILAMENT_ACTION_none:
break;
}
if(bFilamentWaitingFlag)
Sound_MakeSound(e_SOUND_TYPE_StandardPrompt);
@ -2548,6 +2567,11 @@ else {
case e_FILAMENT_ACTION_mmuEject:
lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1
break;
case e_FILAMENT_ACTION_mmuCut:
lcd_puts_P(_i("Preheating to cut")); ////MSG_ c=20 r=1
break;
case e_FILAMENT_ACTION_none:
break;
}
lcd_set_cursor(0,3);
lcd_puts_P(_i(">Cancel")); ////MSG_ c=20 r=1
@ -3494,7 +3518,6 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z)
// Until confirmed by the confirmation dialog.
for (;;) {
unsigned long previous_millis_cmd = _millis();
const char *msg = only_z ? _i("Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done.") : _i("Calibrating XYZ. Rotate the knob to move the Z carriage up to the end stoppers. Click when done.");////MSG_MOVE_CARRIAGE_TO_THE_TOP c=20 r=8////MSG_MOVE_CARRIAGE_TO_THE_TOP_Z c=20 r=8
const char *msg_next = lcd_display_message_fullscreen_P(msg);
const bool multi_screen = msg_next != NULL;
@ -3503,13 +3526,10 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z)
lcd_encoder_diff = 0;
lcd_encoder = 0;
for (;;) {
// if (_millis() - previous_millis_cmd > LCD_TIMEOUT_TO_STATUS)
// goto canceled;
manage_heater();
manage_inactivity(true);
if (abs(lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP) {
_delay(50);
previous_millis_cmd = _millis();
lcd_encoder += abs(lcd_encoder_diff / ENCODER_PULSES_PER_STEP);
lcd_encoder_diff = 0;
if (! planner_queue_full()) {
@ -4012,7 +4032,6 @@ static void lcd_print_state(uint8_t state)
static void lcd_show_sensors_state()
{
//0: N/A; 1: OFF; 2: ON
uint8_t chars = 0;
uint8_t pinda_state = STATE_NA;
uint8_t finda_state = STATE_NA;
uint8_t idler_state = STATE_NA;
@ -4057,7 +4076,25 @@ void prusa_statistics(int _message, uint8_t _fil_nr) {
{
case 0: // default message
if (IS_SD_PRINTING)
if (busy_state == PAUSED_FOR_USER)
{
SERIAL_ECHO("{");
prusa_stat_printerstatus(15);
prusa_stat_farm_number();
prusa_stat_printinfo();
SERIAL_ECHOLN("}");
status_number = 15;
}
else if (isPrintPaused || card.paused)
{
SERIAL_ECHO("{");
prusa_stat_printerstatus(14);
prusa_stat_farm_number();
prusa_stat_printinfo();
SERIAL_ECHOLN("}");
status_number = 14;
}
else if (IS_SD_PRINTING)
{
SERIAL_ECHO("{");
prusa_stat_printerstatus(4);
@ -4852,7 +4889,7 @@ static void lcd_wizard_unload()
}
else
{
mmu_eject_fil_0();
mmu_eject_filament(0, true);
}
}
else
@ -5181,6 +5218,29 @@ do\
}\
while(0)\
static bool settingsCutter()
{
if (mmu_enabled)
{
if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
{
if (menu_item_function_P(_i("Cutter [on]"), lcd_cutter_enabled)) return true;//// c=17 r=1
}
else
{
if (menu_item_function_P(_i("Cutter [off]"), lcd_cutter_enabled)) return true;//// c=17 r=1
}
}
return false;
}
#define SETTINGS_CUTTER \
do\
{\
if(settingsCutter()) return;\
}\
while(0)\
#ifdef TMC2130
#define SETTINGS_SILENT_MODE \
do\
@ -5326,6 +5386,8 @@ static void lcd_settings_menu()
SETTINGS_AUTO_DEPLETE;
SETTINGS_CUTTER;
if (fans_check_enabled == true)
MENU_ITEM_FUNCTION_P(_i("Fans check [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1
else
@ -5380,10 +5442,9 @@ static void lcd_ustep_linearity_menu_save()
}
#endif //TMC2130
#ifdef TMC2130
static void lcd_settings_linearity_correction_menu_save()
{
#ifdef TMC2130
bool changed = false;
if (tmc2130_wave_fac[X_AXIS] < TMC2130_WAVE_FAC1000_MIN) tmc2130_wave_fac[X_AXIS] = 0;
if (tmc2130_wave_fac[Y_AXIS] < TMC2130_WAVE_FAC1000_MIN) tmc2130_wave_fac[Y_AXIS] = 0;
@ -5395,9 +5456,8 @@ static void lcd_settings_linearity_correction_menu_save()
changed |= (eeprom_read_byte((uint8_t*)EEPROM_TMC2130_WAVE_E_FAC) != tmc2130_wave_fac[E_AXIS]);
lcd_ustep_linearity_menu_save();
if (changed) tmc2130_init();
#endif //TMC2130
}
#endif //TMC2130
static void lcd_calibration_menu()
{
@ -5816,18 +5876,24 @@ static void fil_load_menu()
MENU_END();
}
template <uint8_t filament>
static void mmu_load_to_nozzle()
{
menu_back();
lcd_mmu_load_to_nozzle(filament);
}
static void mmu_load_to_nozzle_menu()
{
//-//if (degHotend0() > EXTRUDE_MINTEMP)
if(bFilamentAction)
{
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle_0);
MENU_ITEM_FUNCTION_P(_i("Load filament 2"), mmu_load_to_nozzle_1);
MENU_ITEM_FUNCTION_P(_i("Load filament 3"), mmu_load_to_nozzle_2);
MENU_ITEM_FUNCTION_P(_i("Load filament 4"), mmu_load_to_nozzle_3);
MENU_ITEM_FUNCTION_P(_i("Load filament 5"), mmu_load_to_nozzle_4);
MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle<0>);
MENU_ITEM_FUNCTION_P(_i("Load filament 2"), mmu_load_to_nozzle<1>);
MENU_ITEM_FUNCTION_P(_i("Load filament 3"), mmu_load_to_nozzle<2>);
MENU_ITEM_FUNCTION_P(_i("Load filament 4"), mmu_load_to_nozzle<3>);
MENU_ITEM_FUNCTION_P(_i("Load filament 5"), mmu_load_to_nozzle<4>);
MENU_END();
}
else {
@ -5842,22 +5908,61 @@ else {
}
}
template <uint8_t filament>
static void mmu_eject_filament()
{
menu_back();
mmu_eject_filament(filament, true);
}
static void mmu_fil_eject_menu()
{
//-//if (degHotend0() > EXTRUDE_MINTEMP)
if(bFilamentAction)
{
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_filament<0>);
MENU_ITEM_FUNCTION_P(_i("Eject filament 2"), mmu_eject_filament<1>);
MENU_ITEM_FUNCTION_P(_i("Eject filament 3"), mmu_eject_filament<2>);
MENU_ITEM_FUNCTION_P(_i("Eject filament 4"), mmu_eject_filament<3>);
MENU_ITEM_FUNCTION_P(_i("Eject filament 5"), mmu_eject_filament<4>);
MENU_END();
}
else
{
eFilamentAction=e_FILAMENT_ACTION_mmuEject;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
bFilamentPreheatState=true;
mFilamentItem(target_temperature[0],target_temperature_bed);
}
else mFilamentMenu();
}
}
template <uint8_t filament>
static void mmu_cut_filament()
{
menu_back();
mmu_cut_filament(filament);
}
static void mmu_cut_filament_menu()
{
if(bFilamentAction)
{
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_fil_0);
MENU_ITEM_FUNCTION_P(_i("Eject filament 2"), mmu_eject_fil_1);
MENU_ITEM_FUNCTION_P(_i("Eject filament 3"), mmu_eject_fil_2);
MENU_ITEM_FUNCTION_P(_i("Eject filament 4"), mmu_eject_fil_3);
MENU_ITEM_FUNCTION_P(_i("Eject filament 5"), mmu_eject_fil_4);
MENU_END();
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
MENU_ITEM_FUNCTION_P(_i("Cut filament 1"), mmu_cut_filament<0>);
MENU_ITEM_FUNCTION_P(_i("Cut filament 2"), mmu_cut_filament<1>);
MENU_ITEM_FUNCTION_P(_i("Cut filament 3"), mmu_cut_filament<2>);
MENU_ITEM_FUNCTION_P(_i("Cut filament 4"), mmu_cut_filament<3>);
MENU_ITEM_FUNCTION_P(_i("Cut filament 5"), mmu_cut_filament<4>);
MENU_END();
}
else {
eFilamentAction=e_FILAMENT_ACTION_mmuEject;
eFilamentAction=e_FILAMENT_ACTION_mmuCut;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
@ -6340,6 +6445,7 @@ static void lcd_main_menu()
//bFilamentFirstRun=true;
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload_);
MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu);
MENU_ITEM_SUBMENU_P(_i("Cut filament"), mmu_cut_filament_menu);
}
else
{
@ -6479,6 +6585,8 @@ static void lcd_tune_menu()
SETTINGS_AUTO_DEPLETE;
SETTINGS_CUTTER;
#ifdef TMC2130
if(!farm_mode)
{
@ -6742,8 +6850,7 @@ bool lcd_selftest()
_result = lcd_selftest_manual_fan_check(1, false);
if (!_result)
{
const char *_err;
lcd_selftest_error(6, _err, _err); //print fan not spinning
lcd_selftest_error(6, 0, 0); //print fan not spinning
}
#endif //defined(TACH_1)
@ -7429,6 +7536,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
}
#ifdef FILAMENT_SENSOR
#ifdef PAT9125
static bool lcd_selftest_fsensor(void)
{
fsensor_init();
@ -7438,6 +7546,7 @@ static bool lcd_selftest_fsensor(void)
}
return (!fsensor_not_responding);
}
#endif //PAT9125
//! @brief Self-test of infrared barrier filament sensor mounted on MK3S with MMUv2 printer
//!

View file

@ -45,6 +45,8 @@ extern bool lcd_selftest();
void lcd_menu_statistics();
void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
extern const char* lcd_display_message_fullscreen_P(const char *msg);
@ -134,7 +136,16 @@ void extr_unload_used();
void extr_unload();
typedef enum
{e_FILAMENT_ACTION_none,e_FILAMENT_ACTION_Load,e_FILAMENT_ACTION_autoLoad,e_FILAMENT_ACTION_unLoad,e_FILAMENT_ACTION_mmuLoad,e_FILAMENT_ACTION_mmuUnLoad,e_FILAMENT_ACTION_mmuEject} eFILAMENT_ACTION; // 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state)
{
e_FILAMENT_ACTION_none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state)
e_FILAMENT_ACTION_Load,
e_FILAMENT_ACTION_autoLoad,
e_FILAMENT_ACTION_unLoad,
e_FILAMENT_ACTION_mmuLoad,
e_FILAMENT_ACTION_mmuUnLoad,
e_FILAMENT_ACTION_mmuEject,
e_FILAMENT_ACTION_mmuCut,
} eFILAMENT_ACTION;
extern eFILAMENT_ACTION eFilamentAction;
extern bool bFilamentFirstRun;
extern bool bFilamentPreheatState;

View file

@ -498,7 +498,8 @@
//#define SUPPORT_VERBOSITY
#define MMU_REQUIRED_FW_BUILDNR 132
//#define MMU_DEBUG //print communication between MMU2 and printer on serial
#define MMU_FORCE_STEALTH_MODE
#define MMU_DEBUG //print communication between MMU2 and printer on serial
#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning

View file

@ -499,8 +499,12 @@
//#define SUPPORT_VERBOSITY
#define MMU_REQUIRED_FW_BUILDNR 132
//#define MMU_DEBUG //print communication between MMU2 and printer on serial
#define MMU_FORCE_STEALTH_MODE
#define MMU_DEBUG //print communication between MMU2 and printer on serial
#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning
//#define HEATBED_ANALYSIS //for meash bed leveling and heatbed analysis D-codes D80 and D81
//#define MICROMETER_LOGGING //related to D-codes D80 and D81, currently works on MK2.5 only (MK3 board pin definitions missing)
#endif //__CONFIGURATION_PRUSA_H

View file

@ -498,7 +498,8 @@
//#define SUPPORT_VERBOSITY
#define MMU_REQUIRED_FW_BUILDNR 132
//#define MMU_DEBUG //print communication between MMU2 and printer on serial
#define MMU_FORCE_STEALTH_MODE
#define MMU_DEBUG //print communication between MMU2 and printer on serial
#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning

View file

@ -499,7 +499,8 @@
//#define SUPPORT_VERBOSITY
#define MMU_REQUIRED_FW_BUILDNR 132
//#define MMU_DEBUG //print communication between MMU2 and printer on serial
#define MMU_FORCE_STEALTH_MODE
#define MMU_DEBUG //print communication between MMU2 and printer on serial
#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning