commit
8d388fa03a
6 changed files with 350 additions and 313 deletions
214
Firmware/first_lay_cal.cpp
Normal file
214
Firmware/first_lay_cal.cpp
Normal file
|
@ -0,0 +1,214 @@
|
|||
//! @file
|
||||
//! @date Jun 10, 2019
|
||||
//! @author Marek Bel
|
||||
//! @brief First layer (Z offset) calibration
|
||||
|
||||
#include "first_lay_cal.h"
|
||||
#include "Configuration_prusa.h"
|
||||
#include "language.h"
|
||||
#include "Marlin.h"
|
||||
#include "mmu.h"
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
//! @brief Preheat
|
||||
void lay1cal_preheat()
|
||||
{
|
||||
static const char cmd_preheat_0[] PROGMEM = "M107";
|
||||
static const char cmd_preheat_1[] PROGMEM = "M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP);
|
||||
static const char cmd_preheat_2[] PROGMEM = "M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP);
|
||||
static const char cmd_preheat_3[] PROGMEM = "M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP);
|
||||
static const char cmd_preheat_4[] PROGMEM = "M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP);
|
||||
static const char cmd_preheat_5[] PROGMEM = "G28";
|
||||
static const char cmd_preheat_6[] PROGMEM = "G92 E0.0";
|
||||
|
||||
static const char * const preheat_cmd[] PROGMEM =
|
||||
{
|
||||
cmd_preheat_0,
|
||||
cmd_preheat_1,
|
||||
cmd_preheat_2,
|
||||
cmd_preheat_3,
|
||||
cmd_preheat_4,
|
||||
cmd_preheat_5, //call MSG_M117_V2_CALIBRATION before
|
||||
cmd_preheat_6,
|
||||
};
|
||||
|
||||
for (uint8_t i = 0; i < (sizeof(preheat_cmd)/sizeof(preheat_cmd[0])); ++i)
|
||||
{
|
||||
if (5 == i) enquecommand_P(_T(MSG_M117_V2_CALIBRATION));
|
||||
enquecommand_P(static_cast<char*>(pgm_read_ptr(&preheat_cmd[i])));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//! @brief Print intro line
|
||||
//! @param cmd_buffer character buffer needed to format gcodes
|
||||
//! @param filament filament to use (applies for MMU only)
|
||||
void lay1cal_intro_line(char *cmd_buffer, uint8_t filament)
|
||||
{
|
||||
static const char cmd_intro_mmu_0[] PROGMEM = "M83";
|
||||
static const char cmd_intro_mmu_1[] PROGMEM = "G1 Y-3.0 F1000.0";
|
||||
static const char cmd_intro_mmu_2[] PROGMEM = "G1 Z0.4 F1000.0";
|
||||
static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55.0 E32.0 F1073.0"; // call T code before
|
||||
static const char cmd_intro_mmu_4[] PROGMEM = "G1 X5.0 E32.0 F1800.0";
|
||||
static const char cmd_intro_mmu_5[] PROGMEM = "G1 X55.0 E8.0 F2000.0";
|
||||
static const char cmd_intro_mmu_6[] PROGMEM = "G1 Z0.3 F1000.0";
|
||||
static const char cmd_intro_mmu_7[] PROGMEM = "G92 E0.0";
|
||||
static const char cmd_intro_mmu_8[] PROGMEM = "G1 X240.0 E25.0 F2200.0";
|
||||
static const char cmd_intro_mmu_9[] PROGMEM = "G1 Y-2.0 F1000.0";
|
||||
static const char cmd_intro_mmu_10[] PROGMEM = "G1 X55.0 E25 F1400.0";
|
||||
static const char cmd_intro_mmu_11[] PROGMEM = "G1 Z0.20 F1000.0";
|
||||
static const char cmd_intro_mmu_12[] PROGMEM = "G1 X5.0 E4.0 F1000.0";
|
||||
|
||||
static const char * const intro_mmu_cmd[] PROGMEM =
|
||||
{
|
||||
cmd_intro_mmu_0,
|
||||
cmd_intro_mmu_1,
|
||||
cmd_intro_mmu_2,
|
||||
cmd_intro_mmu_3, // call T code before
|
||||
cmd_intro_mmu_4,
|
||||
cmd_intro_mmu_5,
|
||||
cmd_intro_mmu_6,
|
||||
cmd_intro_mmu_7,
|
||||
cmd_intro_mmu_8,
|
||||
cmd_intro_mmu_9,
|
||||
cmd_intro_mmu_10,
|
||||
cmd_intro_mmu_11,
|
||||
cmd_intro_mmu_12,
|
||||
};
|
||||
|
||||
if (mmu_enabled)
|
||||
{
|
||||
for (uint8_t i = 0; i < (sizeof(intro_mmu_cmd)/sizeof(intro_mmu_cmd[0])); ++i)
|
||||
{
|
||||
if (3 == i)
|
||||
{
|
||||
sprintf_P(cmd_buffer, PSTR("T%d"), filament);
|
||||
enquecommand(cmd_buffer);
|
||||
}
|
||||
enquecommand_P(static_cast<char*>(pgm_read_ptr(&intro_mmu_cmd[i])));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0"));
|
||||
enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0"));
|
||||
}
|
||||
}
|
||||
|
||||
//! @brief Setup for printing meander
|
||||
void lay1cal_before_meander()
|
||||
{
|
||||
static const char cmd_pre_meander_0[] PROGMEM = "G92 E0.0";
|
||||
static const char cmd_pre_meander_1[] PROGMEM = "G21"; //set units to millimeters TODO unsupported command
|
||||
static const char cmd_pre_meander_2[] PROGMEM = "G90"; //use absolute coordinates
|
||||
static const char cmd_pre_meander_3[] PROGMEM = "M83"; //use relative distances for extrusion TODO: duplicate
|
||||
static const char cmd_pre_meander_4[] PROGMEM = "G1 E-1.50000 F2100.00000";
|
||||
static const char cmd_pre_meander_5[] PROGMEM = "G1 Z5 F7200.000";
|
||||
static const char cmd_pre_meander_6[] PROGMEM = "M204 S1000"; //set acceleration
|
||||
static const char cmd_pre_meander_7[] PROGMEM = "G1 F4000";
|
||||
|
||||
static const char * const cmd_pre_meander[] PROGMEM =
|
||||
{
|
||||
cmd_pre_meander_0,
|
||||
cmd_pre_meander_1,
|
||||
cmd_pre_meander_2,
|
||||
cmd_pre_meander_3,
|
||||
cmd_pre_meander_4,
|
||||
cmd_pre_meander_5,
|
||||
cmd_pre_meander_6,
|
||||
cmd_pre_meander_7,
|
||||
};
|
||||
|
||||
for (uint8_t i = 0; i < (sizeof(cmd_pre_meander)/sizeof(cmd_pre_meander[0])); ++i)
|
||||
{
|
||||
enquecommand_P(static_cast<char*>(pgm_read_ptr(&cmd_pre_meander[i])));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! @brief Count extrude length
|
||||
//!
|
||||
//! @param layer_heigth layer heigth in mm
|
||||
//! @param extrusion_width extrusion width in mm
|
||||
//! @param extrusion_length extrusion length in mm
|
||||
//! @return filament length in mm which needs to be extruded to form line
|
||||
static constexpr float count_e(float layer_heigth, float extrusion_width, float extrusion_length)
|
||||
{
|
||||
return (extrusion_length * layer_heigth * extrusion_width / (M_PI * pow(1.75, 2) / 4));
|
||||
}
|
||||
|
||||
static const float width = 0.4; //!< line width
|
||||
static const float length = 20 - width; //!< line length
|
||||
static const float heigth = 0.2; //!< layer height TODO This is wrong, as current Z height is 0.15 mm
|
||||
static const float extr = count_e(heigth, width, length); //!< E axis movement needed to print line
|
||||
|
||||
//! @brief Print meander
|
||||
//! @param cmd_buffer character buffer needed to format gcodes
|
||||
void lay1cal_meander(char *cmd_buffer)
|
||||
{
|
||||
static const char cmd_meander_0[] PROGMEM = "G1 X50 Y155";
|
||||
static const char cmd_meander_1[] PROGMEM = "G1 Z0.150 F7200.000";
|
||||
static const char cmd_meander_2[] PROGMEM = "G1 F1080";
|
||||
static const char cmd_meander_3[] PROGMEM = "G1 X75 Y155 E2.5";
|
||||
static const char cmd_meander_4[] PROGMEM = "G1 X100 Y155 E2";
|
||||
static const char cmd_meander_5[] PROGMEM = "G1 X200 Y155 E2.62773";
|
||||
static const char cmd_meander_6[] PROGMEM = "G1 X200 Y135 E0.66174";
|
||||
static const char cmd_meander_7[] PROGMEM = "G1 X50 Y135 E3.62773";
|
||||
static const char cmd_meander_8[] PROGMEM = "G1 X50 Y115 E0.49386";
|
||||
static const char cmd_meander_9[] PROGMEM = "G1 X200 Y115 E3.62773";
|
||||
static const char cmd_meander_10[] PROGMEM = "G1 X200 Y95 E0.49386";
|
||||
static const char cmd_meander_11[] PROGMEM = "G1 X50 Y95 E3.62773";
|
||||
static const char cmd_meander_12[] PROGMEM = "G1 X50 Y75 E0.49386";
|
||||
static const char cmd_meander_13[] PROGMEM = "G1 X200 Y75 E3.62773";
|
||||
static const char cmd_meander_14[] PROGMEM = "G1 X200 Y55 E0.49386";
|
||||
static const char cmd_meander_15[] PROGMEM = "G1 X50 Y55 E3.62773";
|
||||
|
||||
static const char * const cmd_meander[] PROGMEM =
|
||||
{
|
||||
cmd_meander_0,
|
||||
cmd_meander_1,
|
||||
cmd_meander_2,
|
||||
cmd_meander_3,
|
||||
cmd_meander_4,
|
||||
cmd_meander_5,
|
||||
cmd_meander_6,
|
||||
cmd_meander_7,
|
||||
cmd_meander_8,
|
||||
cmd_meander_9,
|
||||
cmd_meander_10,
|
||||
cmd_meander_11,
|
||||
cmd_meander_12,
|
||||
cmd_meander_13,
|
||||
cmd_meander_14,
|
||||
cmd_meander_15,
|
||||
};
|
||||
|
||||
for (uint8_t i = 0; i < (sizeof(cmd_meander)/sizeof(cmd_meander[0])); ++i)
|
||||
{
|
||||
enquecommand_P(static_cast<char*>(pgm_read_ptr(&cmd_meander[i])));
|
||||
}
|
||||
sprintf_P(cmd_buffer, PSTR("G1 X50 Y35 E%-.3f"), extr);
|
||||
enquecommand(cmd_buffer);
|
||||
}
|
||||
|
||||
//! @brief Print square
|
||||
//!
|
||||
//! This function needs to be called 16 times for i from 0 to 15.
|
||||
//!
|
||||
//! @param cmd_buffer character buffer needed to format gcodes
|
||||
//! @param i iteration
|
||||
void lay1cal_square(char *cmd_buffer, uint8_t i)
|
||||
{
|
||||
const float extr_short_segment = count_e(heigth, width, width);
|
||||
|
||||
static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f";
|
||||
static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f";
|
||||
sprintf_P(cmd_buffer, fmt1, 70, (35 - i*width * 2), extr);
|
||||
enquecommand(cmd_buffer);
|
||||
sprintf_P(cmd_buffer, fmt2, (35 - (2 * i + 1)*width), extr_short_segment);
|
||||
enquecommand(cmd_buffer);
|
||||
sprintf_P(cmd_buffer, fmt1, 50, (35 - (2 * i + 1)*width), extr);
|
||||
enquecommand(cmd_buffer);
|
||||
sprintf_P(cmd_buffer, fmt2, (35 - (i + 1)*width * 2), extr_short_segment);
|
||||
enquecommand(cmd_buffer);
|
||||
}
|
15
Firmware/first_lay_cal.h
Normal file
15
Firmware/first_lay_cal.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
//! @file
|
||||
//! @date Jun 10, 2019
|
||||
//! @author Marek Bel
|
||||
|
||||
#ifndef FIRMWARE_FIRST_LAY_CAL_H_
|
||||
#define FIRMWARE_FIRST_LAY_CAL_H_
|
||||
#include <stdint.h>
|
||||
|
||||
void lay1cal_preheat();
|
||||
void lay1cal_intro_line(char *cmd_buffer, uint8_t filament);
|
||||
void lay1cal_before_meander();
|
||||
void lay1cal_meander(char *cmd_buffer);
|
||||
void lay1cal_square(char *cmd_buffer, uint8_t i);
|
||||
|
||||
#endif /* FIRMWARE_FIRST_LAY_CAL_H_ */
|
|
@ -434,7 +434,7 @@ static void temp_runaway_stop(bool isPreheat, bool isBed);
|
|||
void updatePID()
|
||||
{
|
||||
#ifdef PIDTEMP
|
||||
for(int e = 0; e < EXTRUDERS; e++) {
|
||||
for(uint_least8_t e = 0; e < EXTRUDERS; e++) {
|
||||
iState_sum_max[e] = PID_INTEGRAL_DRIVE_MAX / cs.Ki;
|
||||
}
|
||||
#endif
|
||||
|
|
10
Firmware/tmc2130.cpp
Normal file → Executable file
10
Firmware/tmc2130.cpp
Normal file → Executable file
|
@ -158,7 +158,7 @@ void tmc2130_init()
|
|||
SET_INPUT(Y_TMC2130_DIAG);
|
||||
SET_INPUT(Z_TMC2130_DIAG);
|
||||
SET_INPUT(E0_TMC2130_DIAG);
|
||||
for (int axis = 0; axis < 2; axis++) // X Y axes
|
||||
for (uint_least8_t axis = 0; axis < 2; axis++) // X Y axes
|
||||
{
|
||||
tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]);
|
||||
tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000);
|
||||
|
@ -169,7 +169,7 @@ void tmc2130_init()
|
|||
tmc2130_wr_TPWMTHRS(axis, TMC2130_TPWMTHRS);
|
||||
//tmc2130_wr_THIGH(axis, TMC2130_THIGH);
|
||||
}
|
||||
for (int axis = 2; axis < 3; axis++) // Z axis
|
||||
for (uint_least8_t axis = 2; axis < 3; axis++) // Z axis
|
||||
{
|
||||
tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]);
|
||||
tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000);
|
||||
|
@ -183,7 +183,7 @@ void tmc2130_init()
|
|||
tmc2130_wr_TPWMTHRS(axis, TMC2130_TPWMTHRS);
|
||||
#endif //TMC2130_STEALTH_Z
|
||||
}
|
||||
for (int axis = 3; axis < 4; axis++) // E axis
|
||||
for (uint_least8_t axis = 3; axis < 4; axis++) // E axis
|
||||
{
|
||||
tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]);
|
||||
tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000);
|
||||
|
@ -383,7 +383,7 @@ void tmc2130_check_overtemp()
|
|||
static uint32_t checktime = 0;
|
||||
if (_millis() - checktime > 1000 )
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (uint_least8_t i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t drv_status = 0;
|
||||
skip_debug_msg = true;
|
||||
|
@ -392,7 +392,7 @@ void tmc2130_check_overtemp()
|
|||
{ // BIT 26 - over temp prewarning ~120C (+-20C)
|
||||
SERIAL_ERRORRPGM(MSG_TMC_OVERTEMP);
|
||||
SERIAL_ECHOLN(i);
|
||||
for (int j = 0; j < 4; j++)
|
||||
for (uint_least8_t j = 0; j < 4; j++)
|
||||
tmc2130_wr(j, TMC2130_REG_CHOPCONF, 0x00010000);
|
||||
kill(MSG_TMC_OVERTEMP);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "static_assert.h"
|
||||
#include "io_atmega2560.h"
|
||||
#include "first_lay_cal.h"
|
||||
|
||||
|
||||
int scrollstuff = 0;
|
||||
|
@ -73,8 +74,8 @@ extern void crashdet_disable();
|
|||
bool presort_flag = false;
|
||||
#endif
|
||||
|
||||
int lcd_commands_type = LCD_COMMAND_IDLE;
|
||||
int lcd_commands_step = 0;
|
||||
uint8_t lcd_commands_type = LCD_COMMAND_IDLE;
|
||||
static uint8_t lcd_commands_step = 0;
|
||||
|
||||
unsigned int custom_message_type = CUSTOM_MSG_TYPE_STATUS;
|
||||
unsigned int custom_message_state = 0;
|
||||
|
@ -245,7 +246,6 @@ static char snmm_stop_print_menu();
|
|||
#ifdef SDCARD_SORT_ALPHA
|
||||
static void lcd_sort_type_set();
|
||||
#endif
|
||||
static float count_e(float layer_heigth, float extrusion_width, float extrusion_length);
|
||||
static void lcd_babystep_z();
|
||||
static void lcd_send_status();
|
||||
#ifdef FARM_CONNECT_MESSAGE
|
||||
|
@ -317,7 +317,7 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, char* longF
|
|||
char c;
|
||||
int enc_dif = lcd_encoder_diff;
|
||||
uint8_t n = LCD_WIDTH - 1;
|
||||
for(int g = 0; g<4;g++){
|
||||
for(uint_least8_t g = 0; g<4;g++){
|
||||
lcd_set_cursor(0, g);
|
||||
lcd_print(' ');
|
||||
}
|
||||
|
@ -1060,7 +1060,6 @@ static void lcd_status_screen()
|
|||
feedmultiply = 999;
|
||||
}
|
||||
|
||||
|
||||
void lcd_commands()
|
||||
{
|
||||
if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE)
|
||||
|
@ -1348,291 +1347,106 @@ void lcd_commands()
|
|||
{
|
||||
char cmd1[30];
|
||||
static uint8_t filament = 0;
|
||||
float width = 0.4;
|
||||
float length = 20 - width;
|
||||
float extr = count_e(0.2, width, length);
|
||||
float extr_short_segment = count_e(0.2, width, width);
|
||||
|
||||
if(lcd_commands_step>1) lcd_timeoutToStatus.start(); //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen
|
||||
|
||||
if (lcd_commands_step == 0 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
lcd_commands_step = 10;
|
||||
}
|
||||
if (lcd_commands_step == 20 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
filament = 0;
|
||||
lcd_commands_step = 10;
|
||||
}
|
||||
if (lcd_commands_step == 21 && !blocks_queued() && cmd_buffer_empty())
|
||||
if (!blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
filament = 1;
|
||||
lcd_commands_step = 10;
|
||||
}
|
||||
if (lcd_commands_step == 22 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
filament = 2;
|
||||
lcd_commands_step = 10;
|
||||
}
|
||||
if (lcd_commands_step == 23 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
filament = 3;
|
||||
lcd_commands_step = 10;
|
||||
}
|
||||
if (lcd_commands_step == 24 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
filament = 4;
|
||||
lcd_commands_step = 10;
|
||||
}
|
||||
|
||||
if (lcd_commands_step == 10)
|
||||
{
|
||||
enquecommand_P(PSTR("M107"));
|
||||
enquecommand_P(PSTR("M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP)));
|
||||
enquecommand_P(PSTR("M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP)));
|
||||
enquecommand_P(PSTR("M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP)));
|
||||
enquecommand_P(PSTR("M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP)));
|
||||
enquecommand_P(_T(MSG_M117_V2_CALIBRATION));
|
||||
enquecommand_P(PSTR("G28"));
|
||||
enquecommand_P(PSTR("G92 E0.0"));
|
||||
|
||||
lcd_commands_step = 9;
|
||||
}
|
||||
if (lcd_commands_step == 9 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
lcd_clear();
|
||||
menu_depth = 0;
|
||||
menu_submenu(lcd_babystep_z);
|
||||
|
||||
if (mmu_enabled)
|
||||
switch(lcd_commands_step)
|
||||
{
|
||||
enquecommand_P(PSTR("M83")); //intro line
|
||||
enquecommand_P(PSTR("G1 Y-3.0 F1000.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 Z0.4 F1000.0")); //intro line
|
||||
strcpy(cmd1, "T");
|
||||
strcat(cmd1, itostr3left(filament));
|
||||
enquecommand(cmd1);
|
||||
enquecommand_P(PSTR("G1 X55.0 E32.0 F1073.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 X5.0 E32.0 F1800.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 X55.0 E8.0 F2000.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 Z0.3 F1000.0")); //intro line
|
||||
enquecommand_P(PSTR("G92 E0.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 X240.0 E25.0 F2200.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 Y-2.0 F1000.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 X55.0 E25 F1400.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 Z0.20 F1000.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 X5.0 E4.0 F1000.0")); //intro line
|
||||
|
||||
} else
|
||||
{
|
||||
enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0")); //intro line
|
||||
enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0")); //intro line
|
||||
case 0:
|
||||
lcd_commands_step = 10;
|
||||
break;
|
||||
case 20:
|
||||
filament = 0;
|
||||
lcd_commands_step = 10;
|
||||
break;
|
||||
case 21:
|
||||
filament = 1;
|
||||
lcd_commands_step = 10;
|
||||
break;
|
||||
case 22:
|
||||
filament = 2;
|
||||
lcd_commands_step = 10;
|
||||
break;
|
||||
case 23:
|
||||
filament = 3;
|
||||
lcd_commands_step = 10;
|
||||
break;
|
||||
case 24:
|
||||
filament = 4;
|
||||
lcd_commands_step = 10;
|
||||
break;
|
||||
case 10:
|
||||
lay1cal_preheat();
|
||||
lcd_commands_step = 9;
|
||||
break;
|
||||
case 9:
|
||||
lcd_clear();
|
||||
menu_depth = 0;
|
||||
menu_submenu(lcd_babystep_z);
|
||||
lay1cal_intro_line(cmd1, filament);
|
||||
lcd_commands_step = 8;
|
||||
break;
|
||||
case 8:
|
||||
lay1cal_before_meander();
|
||||
lcd_commands_step = 7;
|
||||
break;
|
||||
case 7:
|
||||
lay1cal_meander(cmd1);
|
||||
lcd_commands_step = 6;
|
||||
break;
|
||||
case 6:
|
||||
for (uint8_t i = 0; i < 4; i++)
|
||||
{
|
||||
lay1cal_square(cmd1, i);
|
||||
}
|
||||
lcd_commands_step = 5;
|
||||
break;
|
||||
case 5:
|
||||
for (uint8_t i = 4; i < 8; i++)
|
||||
{
|
||||
lay1cal_square(cmd1, i);
|
||||
}
|
||||
lcd_commands_step = 4;
|
||||
break;
|
||||
case 4:
|
||||
for (uint8_t i = 8; i < 12; i++)
|
||||
{
|
||||
lay1cal_square(cmd1, i);
|
||||
}
|
||||
lcd_commands_step = 3;
|
||||
break;
|
||||
case 3:
|
||||
for (uint8_t i = 12; i < 16; i++)
|
||||
{
|
||||
lay1cal_square(cmd1, i);
|
||||
}
|
||||
lcd_commands_step = 2;
|
||||
break;
|
||||
case 2:
|
||||
enquecommand_P(PSTR("M107")); //turn off printer fan
|
||||
enquecommand_P(PSTR("G1 E-0.07500 F2100.00000")); //retract
|
||||
enquecommand_P(PSTR("M104 S0")); // turn off temperature
|
||||
enquecommand_P(PSTR("M140 S0")); // turn off heatbed
|
||||
enquecommand_P(PSTR("G1 Z10 F1300.000")); //lift Z
|
||||
enquecommand_P(PSTR("G1 X10 Y180 F4000")); //Go to parking position
|
||||
if (mmu_enabled) enquecommand_P(PSTR("M702 C")); //unload from nozzle
|
||||
enquecommand_P(PSTR("M84"));// disable motors
|
||||
forceMenuExpire = true; //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen
|
||||
lcd_commands_step = 1;
|
||||
break;
|
||||
case 1:
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
lcd_commands_step = 0;
|
||||
lcd_commands_type = 0;
|
||||
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1)
|
||||
{
|
||||
lcd_wizard(WizState::RepeatLay1Cal);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
lcd_commands_step = 8;
|
||||
}
|
||||
if (lcd_commands_step == 8 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
|
||||
enquecommand_P(PSTR("G92 E0.0"));
|
||||
enquecommand_P(PSTR("G21")); //set units to millimeters
|
||||
enquecommand_P(PSTR("G90")); //use absolute coordinates
|
||||
enquecommand_P(PSTR("M83")); //use relative distances for extrusion
|
||||
enquecommand_P(PSTR("G1 E-1.50000 F2100.00000"));
|
||||
enquecommand_P(PSTR("G1 Z5 F7200.000"));
|
||||
enquecommand_P(PSTR("M204 S1000")); //set acceleration
|
||||
enquecommand_P(PSTR("G1 F4000"));
|
||||
lcd_commands_step = 7;
|
||||
}
|
||||
if (lcd_commands_step == 7 && !blocks_queued() && cmd_buffer_empty()) //draw meander
|
||||
{
|
||||
lcd_timeoutToStatus.start();
|
||||
|
||||
|
||||
//just opposite direction
|
||||
/*enquecommand_P(PSTR("G1 X50 Y55"));
|
||||
enquecommand_P(PSTR("G1 F1080"));
|
||||
enquecommand_P(PSTR("G1 X200 Y55 E3.62773"));
|
||||
enquecommand_P(PSTR("G1 X200 Y75 E0.49386"));
|
||||
enquecommand_P(PSTR("G1 X50 Y75 E3.62773"));
|
||||
enquecommand_P(PSTR("G1 X50 Y95 E0.49386"));
|
||||
enquecommand_P(PSTR("G1 X200 Y95 E3.62773"));
|
||||
enquecommand_P(PSTR("G1 X200 Y115 E0.49386"));
|
||||
enquecommand_P(PSTR("G1 X50 Y115 E3.62773"));
|
||||
enquecommand_P(PSTR("G1 X50 Y135 E0.49386"));
|
||||
enquecommand_P(PSTR("G1 X200 Y135 E3.62773"));
|
||||
enquecommand_P(PSTR("G1 X200 Y155 E0.66174"));
|
||||
enquecommand_P(PSTR("G1 X100 Y155 E2.62773"));
|
||||
enquecommand_P(PSTR("G1 X75 Y155 E2"));
|
||||
enquecommand_P(PSTR("G1 X50 Y155 E2.5"));
|
||||
enquecommand_P(PSTR("G1 E - 0.07500 F2100.00000"));*/
|
||||
|
||||
|
||||
enquecommand_P(PSTR("G1 X50 Y155"));
|
||||
enquecommand_P(PSTR("G1 Z0.150 F7200.000"));
|
||||
enquecommand_P(PSTR("G1 F1080"));
|
||||
enquecommand_P(PSTR("G1 X75 Y155 E2.5"));
|
||||
enquecommand_P(PSTR("G1 X100 Y155 E2"));
|
||||
enquecommand_P(PSTR("G1 X200 Y155 E2.62773"));
|
||||
enquecommand_P(PSTR("G1 X200 Y135 E0.66174"));
|
||||
enquecommand_P(PSTR("G1 X50 Y135 E3.62773"));
|
||||
enquecommand_P(PSTR("G1 X50 Y115 E0.49386"));
|
||||
enquecommand_P(PSTR("G1 X200 Y115 E3.62773"));
|
||||
enquecommand_P(PSTR("G1 X200 Y95 E0.49386"));
|
||||
enquecommand_P(PSTR("G1 X50 Y95 E3.62773"));
|
||||
enquecommand_P(PSTR("G1 X50 Y75 E0.49386"));
|
||||
enquecommand_P(PSTR("G1 X200 Y75 E3.62773"));
|
||||
enquecommand_P(PSTR("G1 X200 Y55 E0.49386"));
|
||||
enquecommand_P(PSTR("G1 X50 Y55 E3.62773"));
|
||||
|
||||
strcpy(cmd1, "G1 X50 Y35 E");
|
||||
strcat(cmd1, ftostr43(extr));
|
||||
enquecommand(cmd1);
|
||||
|
||||
lcd_commands_step = 6;
|
||||
}
|
||||
|
||||
if (lcd_commands_step == 6 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
|
||||
lcd_timeoutToStatus.start();
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
strcpy(cmd1, "G1 X70 Y");
|
||||
strcat(cmd1, ftostr32(35 - i*width * 2));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 Y");
|
||||
strcat(cmd1, ftostr32(35 - (2 * i + 1)*width));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr_short_segment));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 X50 Y");
|
||||
strcat(cmd1, ftostr32(35 - (2 * i + 1)*width));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 Y");
|
||||
strcat(cmd1, ftostr32(35 - (i + 1)*width * 2));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr_short_segment));
|
||||
enquecommand(cmd1);
|
||||
}
|
||||
|
||||
lcd_commands_step = 5;
|
||||
}
|
||||
|
||||
if (lcd_commands_step == 5 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
lcd_timeoutToStatus.start();
|
||||
for (int i = 4; i < 8; i++) {
|
||||
strcpy(cmd1, "G1 X70 Y");
|
||||
strcat(cmd1, ftostr32(35 - i*width * 2));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 Y");
|
||||
strcat(cmd1, ftostr32(35 - (2 * i + 1)*width));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr_short_segment));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 X50 Y");
|
||||
strcat(cmd1, ftostr32(35 - (2 * i + 1)*width));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 Y");
|
||||
strcat(cmd1, ftostr32(35 - (i + 1)*width * 2));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr_short_segment));
|
||||
enquecommand(cmd1);
|
||||
}
|
||||
|
||||
lcd_commands_step = 4;
|
||||
}
|
||||
|
||||
if (lcd_commands_step == 4 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
lcd_timeoutToStatus.start();
|
||||
for (int i = 8; i < 12; i++) {
|
||||
strcpy(cmd1, "G1 X70 Y");
|
||||
strcat(cmd1, ftostr32(35 - i*width * 2));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 Y");
|
||||
strcat(cmd1, ftostr32(35 - (2 * i + 1)*width));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr_short_segment));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 X50 Y");
|
||||
strcat(cmd1, ftostr32(35 - (2 * i + 1)*width));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 Y");
|
||||
strcat(cmd1, ftostr32(35 - (i + 1)*width * 2));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr_short_segment));
|
||||
enquecommand(cmd1);
|
||||
}
|
||||
|
||||
lcd_commands_step = 3;
|
||||
}
|
||||
|
||||
if (lcd_commands_step == 3 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
lcd_timeoutToStatus.start();
|
||||
for (int i = 12; i < 16; i++) {
|
||||
strcpy(cmd1, "G1 X70 Y");
|
||||
strcat(cmd1, ftostr32(35 - i*width * 2));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 Y");
|
||||
strcat(cmd1, ftostr32(35 - (2 * i + 1)*width));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr_short_segment));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 X50 Y");
|
||||
strcat(cmd1, ftostr32(35 - (2 * i + 1)*width));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr));
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 Y");
|
||||
strcat(cmd1, ftostr32(35 - (i + 1)*width * 2));
|
||||
strcat(cmd1, " E");
|
||||
strcat(cmd1, ftostr43(extr_short_segment));
|
||||
enquecommand(cmd1);
|
||||
}
|
||||
|
||||
lcd_commands_step = 2;
|
||||
}
|
||||
|
||||
if (lcd_commands_step == 2 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
lcd_timeoutToStatus.start();
|
||||
enquecommand_P(PSTR("M107")); //turn off printer fan
|
||||
enquecommand_P(PSTR("G1 E-0.07500 F2100.00000")); //retract
|
||||
enquecommand_P(PSTR("M104 S0")); // turn off temperature
|
||||
enquecommand_P(PSTR("M140 S0")); // turn off heatbed
|
||||
enquecommand_P(PSTR("G1 Z10 F1300.000")); //lift Z
|
||||
enquecommand_P(PSTR("G1 X10 Y180 F4000")); //Go to parking position
|
||||
if (mmu_enabled) enquecommand_P(PSTR("M702 C")); //unload from nozzle
|
||||
enquecommand_P(PSTR("M84"));// disable motors
|
||||
forceMenuExpire = true; //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen
|
||||
lcd_commands_step = 1;
|
||||
}
|
||||
if (lcd_commands_step == 1 && !blocks_queued() && cmd_buffer_empty())
|
||||
{
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
lcd_commands_step = 0;
|
||||
lcd_commands_type = 0;
|
||||
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {
|
||||
lcd_wizard(WizState::RepeatLay1Cal);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // not SNMM
|
||||
|
@ -1826,12 +1640,6 @@ void lcd_commands()
|
|||
|
||||
}
|
||||
|
||||
static float count_e(float layer_heigth, float extrusion_width, float extrusion_length) {
|
||||
//returns filament length in mm which needs to be extrude to form line with extrusion_length * extrusion_width * layer heigth dimensions
|
||||
float extr = extrusion_length * layer_heigth * extrusion_width / (M_PI * pow(1.75, 2) / 4);
|
||||
return extr;
|
||||
}
|
||||
|
||||
void lcd_return_to_status()
|
||||
{
|
||||
lcd_refresh(); // to maybe revive the LCD if static electricity killed it.
|
||||
|
@ -2770,11 +2578,11 @@ void lcd_change_success() {
|
|||
|
||||
static void lcd_loading_progress_bar(uint16_t loading_time_ms) {
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
for (uint_least8_t i = 0; i < 20; i++) {
|
||||
lcd_set_cursor(i, 3);
|
||||
lcd_print(".");
|
||||
//loading_time_ms/20 delay
|
||||
for (int j = 0; j < 5; j++) {
|
||||
for (uint_least8_t j = 0; j < 5; j++) {
|
||||
delay_keep_alive(loading_time_ms / 100);
|
||||
}
|
||||
}
|
||||
|
@ -3216,7 +3024,7 @@ static void lcd_menu_xyz_offset()
|
|||
float cntr[2];
|
||||
world2machine_read_valid(vec_x, vec_y, cntr);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (uint_least8_t i = 0; i < 2; i++)
|
||||
{
|
||||
lcd_puts_at_P(11, i + 2, PSTR(""));
|
||||
lcd_print(cntr[i]);
|
||||
|
@ -4884,7 +4692,7 @@ void lcd_v2_calibration()
|
|||
else {
|
||||
lcd_display_message_fullscreen_P(_i("Please load PLA filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4
|
||||
lcd_consume_click();
|
||||
for (int i = 0; i < 20; i++) { //wait max. 2s
|
||||
for (uint_least8_t i = 0; i < 20; i++) { //wait max. 2s
|
||||
delay_keep_alive(100);
|
||||
if (lcd_clicked()) {
|
||||
break;
|
||||
|
@ -5611,7 +5419,7 @@ void bowden_menu() {
|
|||
lcd_clear();
|
||||
lcd_set_cursor(0, 0);
|
||||
lcd_print(">");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (uint_least8_t i = 0; i < 4; i++) {
|
||||
lcd_set_cursor(1, i);
|
||||
lcd_print("Extruder ");
|
||||
lcd_print(i);
|
||||
|
@ -5699,7 +5507,7 @@ void bowden_menu() {
|
|||
enc_dif = lcd_encoder_diff;
|
||||
lcd_set_cursor(0, cursor_pos);
|
||||
lcd_print(">");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (uint_least8_t i = 0; i < 4; i++) {
|
||||
lcd_set_cursor(1, i);
|
||||
lcd_print("Extruder ");
|
||||
lcd_print(i);
|
||||
|
@ -5826,14 +5634,14 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite
|
|||
if (header) lcd_puts_at_P(0,0,header);
|
||||
|
||||
const bool last_visible = (first == items_no - 3);
|
||||
const int8_t ordinary_items = (last_item&&last_visible)?2:3;
|
||||
const uint_least8_t ordinary_items = (last_item&&last_visible)?2:3;
|
||||
|
||||
for (int i = 0; i < ordinary_items; i++)
|
||||
for (uint_least8_t i = 0; i < ordinary_items; i++)
|
||||
{
|
||||
if (item) lcd_puts_at_P(1, i + 1, item);
|
||||
}
|
||||
|
||||
for (int i = 0; i < ordinary_items; i++)
|
||||
for (uint_least8_t i = 0; i < ordinary_items; i++)
|
||||
{
|
||||
lcd_set_cursor(2 + item_len, i+1);
|
||||
lcd_print(first + i + 1);
|
||||
|
@ -5887,7 +5695,7 @@ char reset_menu() {
|
|||
lcd_consume_click();
|
||||
while (1) {
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (uint_least8_t i = 0; i < 4; i++) {
|
||||
lcd_set_cursor(1, i);
|
||||
lcd_print(item[first + i]);
|
||||
}
|
||||
|
@ -6213,7 +6021,7 @@ unsigned char lcd_choose_color() {
|
|||
item[0] = "Orange";
|
||||
item[1] = "Black";
|
||||
//-----------------------------------------------------
|
||||
unsigned char active_rows;
|
||||
uint_least8_t active_rows;
|
||||
static int first = 0;
|
||||
int enc_dif = 0;
|
||||
unsigned char cursor_pos = 1;
|
||||
|
@ -6226,7 +6034,7 @@ unsigned char lcd_choose_color() {
|
|||
lcd_consume_click();
|
||||
while (1) {
|
||||
lcd_puts_at_P(0, 0, PSTR("Choose color:"));
|
||||
for (int i = 0; i < active_rows; i++) {
|
||||
for (uint_least8_t i = 0; i < active_rows; i++) {
|
||||
lcd_set_cursor(1, i+1);
|
||||
lcd_print(item[first + i]);
|
||||
}
|
||||
|
@ -7263,7 +7071,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) {
|
|||
|
||||
//end of second measurement, now check for possible errors:
|
||||
|
||||
for(int i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length
|
||||
for(uint_least8_t i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length
|
||||
printf_P(_N("Measured axis length:%.3f\n"), measured_axis_length[i]);
|
||||
if (abs(measured_axis_length[i] - axis_length) > max_error_mm) {
|
||||
enable_endstops(false);
|
||||
|
@ -8127,7 +7935,7 @@ static void menu_action_sdfile(const char* filename)
|
|||
const char end[5] = ".gco";
|
||||
|
||||
//we are storing just first 8 characters of 8.3 filename assuming that extension is always ".gco"
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (uint_least8_t i = 0; i < 8; i++) {
|
||||
if (strcmp((cmd + i + 4), end) == 0) {
|
||||
//filename is shorter then 8.3, store '\0' character on position where ".gco" string was found to terminate stored string properly
|
||||
eeprom_write_byte((uint8_t*)EEPROM_FILENAME + i, '\0');
|
||||
|
@ -8141,8 +7949,8 @@ static void menu_action_sdfile(const char* filename)
|
|||
uint8_t depth = (uint8_t)card.getWorkDirDepth();
|
||||
eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth);
|
||||
|
||||
for (uint8_t i = 0; i < depth; i++) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
for (uint_least8_t i = 0; i < depth; i++) {
|
||||
for (uint_least8_t j = 0; j < 8; j++) {
|
||||
eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8 * i, dir_names[i][j]);
|
||||
}
|
||||
}
|
||||
|
|
2
Firmware/ultralcd.h
Normal file → Executable file
2
Firmware/ultralcd.h
Normal file → Executable file
|
@ -97,7 +97,7 @@ extern void lcd_diag_show_end_stops();
|
|||
#define LCD_COMMAND_PID_EXTRUDER 7
|
||||
#define LCD_COMMAND_V2_CAL 8
|
||||
|
||||
extern int lcd_commands_type;
|
||||
extern uint8_t lcd_commands_type;
|
||||
extern int8_t FSensorStateMenu;
|
||||
|
||||
#define CUSTOM_MSG_TYPE_STATUS 0 // status message from lcd_status_message variable
|
||||
|
|
Loading…
Add table
Reference in a new issue