Merge commit '66dc65ecd4e2b76273da54c64f9263dd08741dab' into MK3-private_build

Merge Prusa MK3 firmware 3.1.3 with Hyperfine Bed Leveling and P.I.N.D.A.v2 fix by TheZeroBeast
This commit is contained in:
3d-gussner 2018-03-30 12:31:12 +02:00
commit fe862cb37b
8 changed files with 65 additions and 30 deletions

View File

@ -7,11 +7,11 @@
#define STR(x) STR_HELPER(x) #define STR(x) STR_HELPER(x)
// Firmware version // Firmware version
#define FW_VERSION "3.1.2" #define FW_VERSION "3.1.3"
#define FW_COMMIT_NR 231 #define FW_COMMIT_NR 245
// FW_VERSION_UNKNOWN means this is an unofficial build. // FW_VERSION_UNKNOWN means this is an unofficial build.
// The firmware should only be checked into github with this symbol. // The firmware should only be checked into github with this symbol.
#define FW_DEV_VERSION FW_VERSION_UNKNOWN #define FW_DEV_VERSION FW_VERSION_GOLD
#define FW_REPOSITORY "Prusa3D/MK3" #define FW_REPOSITORY "Prusa3D/MK3"
#define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR) #define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR)
@ -123,12 +123,6 @@
#define EEPROM_FSENS_AUTOLOAD_ENABLED (EEPROM_SECOND_SERIAL_ACTIVE - 1) #define EEPROM_FSENS_AUTOLOAD_ENABLED (EEPROM_SECOND_SERIAL_ACTIVE - 1)
// Hyperfine Bed Tuning
#define EEPROM_BED_CORRECTION_FRONT_LEFT (EEPROM_FSENS_AUTOLOAD_ENABLED - 1)
#define EEPROM_BED_CORRECTION_FRONT_RIGHT (EEPROM_BED_CORRECTION_FRONT_LEFT - 1)
#define EEPROM_BED_CORRECTION_REAR_RIGHT (EEPROM_BED_CORRECTION_FRONT_RIGHT - 1)
#define EEPROM_BED_CORRECTION_REAR_LEFT (EEPROM_BED_CORRECTION_REAR_RIGHT - 1)
// End Hyperfine Bed Tuning
// Crash detection counter X (total) // Crash detection counter X (total)
#define EEPROM_CRASH_COUNT_X_TOT (EEPROM_FSENS_AUTOLOAD_ENABLED - 2) // uint16 #define EEPROM_CRASH_COUNT_X_TOT (EEPROM_FSENS_AUTOLOAD_ENABLED - 2) // uint16
// Crash detection counter Y (total) // Crash detection counter Y (total)
@ -138,6 +132,13 @@
// Power loss errors (total) // Power loss errors (total)
#define EEPROM_POWER_COUNT_TOT (EEPROM_FERROR_COUNT_TOT - 2) // uint16 #define EEPROM_POWER_COUNT_TOT (EEPROM_FERROR_COUNT_TOT - 2) // uint16
// Hyperfine Bed Tuning
#define EEPROM_BED_CORRECTION_FRONT_LEFT (EEPROM_POWER_COUNT_TOT - 1)
#define EEPROM_BED_CORRECTION_FRONT_RIGHT (EEPROM_BED_CORRECTION_FRONT_LEFT - 1)
#define EEPROM_BED_CORRECTION_REAR_RIGHT (EEPROM_BED_CORRECTION_FRONT_RIGHT - 1)
#define EEPROM_BED_CORRECTION_REAR_LEFT (EEPROM_BED_CORRECTION_REAR_RIGHT - 1)
// End Hyperfine Bed Tuning
//////////////////////////////////////// ////////////////////////////////////////
// TMC2130 Accurate sensorless homing // TMC2130 Accurate sensorless homing

View File

@ -378,8 +378,8 @@ bool Config_RetrieveSettings(uint16_t offset, uint8_t level)
EEPROM_READ_VAR(i, extruder_advance_k); EEPROM_READ_VAR(i, extruder_advance_k);
EEPROM_READ_VAR(i, advance_ed_ratio); EEPROM_READ_VAR(i, advance_ed_ratio);
} }
calculate_volumetric_multipliers();
#endif //LIN_ADVANCE #endif //LIN_ADVANCE
calculate_extruder_multipliers();
// Call updatePID (similar to when we have processed M301) // Call updatePID (similar to when we have processed M301)
updatePID(); updatePID();

View File

@ -17,6 +17,7 @@
// Electronics // Electronics
#define MOTHERBOARD BOARD_EINSY_0_4a #define MOTHERBOARD BOARD_EINSY_0_4a
#define HAS_SECOND_SERIAL_PORT
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) // Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)

View File

@ -3267,10 +3267,8 @@ void process_commands()
#ifdef PINDA_THERMISTOR #ifdef PINDA_THERMISTOR
if (true) if (true)
{ {
lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CAL_WARNING); if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_STEEL_SHEET_CHECK, false, false); {
if(result) lcd_show_fullscreen_message_and_wait_P(MSG_REMOVE_STEEL_SHEET);
if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) {
// We don't know where we are! HOME! // We don't know where we are! HOME!
// Push the commands to the front of the message queue in the reverse order! // Push the commands to the front of the message queue in the reverse order!
// There shall be always enough space reserved for these commands. // There shall be always enough space reserved for these commands.
@ -3278,6 +3276,17 @@ void process_commands()
enquecommand_front_P((PSTR("G28 W0"))); enquecommand_front_P((PSTR("G28 W0")));
break; break;
} }
lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CAL_WARNING);
bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_STEEL_SHEET_CHECK, false, false);
if (result)
{
current_position[Z_AXIS] = 50;
current_position[Y_AXIS] = 190;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
st_synchronize();
lcd_show_fullscreen_message_and_wait_P(MSG_REMOVE_STEEL_SHEET);
}
lcd_update_enable(true);
KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly
SERIAL_ECHOLNPGM("PINDA probe calibration start"); SERIAL_ECHOLNPGM("PINDA probe calibration start");
@ -7119,11 +7128,14 @@ void save_statistics(unsigned long _total_filament_used, unsigned long _total_pr
} }
float calculate_extruder_multiplier(float diameter) { float calculate_extruder_multiplier(float diameter) {
bool enabled = volumetric_enabled && diameter > 0; float out = 1.f;
float area = enabled ? (M_PI * pow(diameter * .5, 2)) : 0; if (volumetric_enabled && diameter > 0.f) {
return (extrudemultiply == 100) ? float area = M_PI * diameter * diameter * 0.25;
(enabled ? (1.f / area) : 1.f) : out = 1.f / area;
(enabled ? ((float(extrudemultiply) * 0.01f) / area) : 1.f); }
if (extrudemultiply != 100)
out *= float(extrudemultiply) * 0.01f;
return out;
} }
void calculate_extruder_multipliers() { void calculate_extruder_multipliers() {
@ -7636,8 +7648,8 @@ void serialecho_temperatures() {
float tt = degHotend(active_extruder); float tt = degHotend(active_extruder);
SERIAL_PROTOCOLPGM("T:"); SERIAL_PROTOCOLPGM("T:");
SERIAL_PROTOCOL(tt); SERIAL_PROTOCOL(tt);
SERIAL_PROTOCOLPGM(" P:"); SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOL(current_temperature_pinda); SERIAL_PROTOCOL((int)active_extruder);
SERIAL_PROTOCOLPGM(" B:"); SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL_F(degBed(), 1); SERIAL_PROTOCOL_F(degBed(), 1);
SERIAL_PROTOCOLLN(""); SERIAL_PROTOCOLLN("");

View File

@ -99,7 +99,19 @@ union MenuData
int mid_left2; int mid_left2;
} adjustBed; } adjustBed;
// End Hyperfine bed Tuning // End Hyperfine bed Tuning
struct TuneMenu
{
// editMenuParentState is used when an edit menu is entered, so it knows
// the return menu and encoder state.
struct EditMenuParentState editMenuParentState;
// To recognize, whether the menu has been just initialized.
int8_t status;
// Backup of extrudemultiply, to recognize, that the value has been changed and
// it needs to be applied.
int16_t extrudemultiply;
} tuneMenu;
// editMenuParentState is used when an edit menu is entered, so it knows // editMenuParentState is used when an edit menu is entered, so it knows
// the return menu and encoder state. // the return menu and encoder state.
struct EditMenuParentState editMenuParentState; struct EditMenuParentState editMenuParentState;
@ -3957,12 +3969,14 @@ static void lcd_settings_menu()
else { else {
MENU_ITEM(function, MSG_TEMP_CALIBRATION_ON, lcd_temp_calibration_set); MENU_ITEM(function, MSG_TEMP_CALIBRATION_ON, lcd_temp_calibration_set);
} }
#ifdef HAS_SECOND_SERIAL_PORT
if (selectedSerialPort == 0) { if (selectedSerialPort == 0) {
MENU_ITEM(function, MSG_SECOND_SERIAL_OFF, lcd_second_serial_set); MENU_ITEM(function, MSG_SECOND_SERIAL_OFF, lcd_second_serial_set);
} }
else { else {
MENU_ITEM(function, MSG_SECOND_SERIAL_ON, lcd_second_serial_set); MENU_ITEM(function, MSG_SECOND_SERIAL_ON, lcd_second_serial_set);
} }
#endif //HAS_SECOND_SERIAL
if (!isPrintPaused && !homing_flag) if (!isPrintPaused && !homing_flag)
{ {
@ -5492,6 +5506,16 @@ static void lcd_colorprint_change() {
static void lcd_tune_menu() static void lcd_tune_menu()
{ {
if (menuData.tuneMenu.status == 0) {
// Menu was entered. Mark the menu as entered and save the current extrudemultiply value.
menuData.tuneMenu.status = 1;
menuData.tuneMenu.extrudemultiply = extrudemultiply;
} else if (menuData.tuneMenu.extrudemultiply != extrudemultiply) {
// extrudemultiply has been changed from the child menu. Apply the new value.
menuData.tuneMenu.extrudemultiply = extrudemultiply;
calculate_extruder_multipliers();
}
EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu)); EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu));
@ -6082,14 +6106,12 @@ static bool lcd_selfcheck_axis_sg(char axis) {
} }
// first axis length measurement begin // first axis length measurement begin
tmc2130_home_enter(X_AXIS_MASK << axis);
current_position[axis] -= (axis_length + margin); current_position[axis] -= (axis_length + margin);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder);
st_synchronize(); st_synchronize();
tmc2130_home_exit();
tmc2130_sg_meassure_start(axis); tmc2130_sg_meassure_start(axis);
@ -6102,9 +6124,7 @@ static bool lcd_selfcheck_axis_sg(char axis) {
current_position[axis] += axis_length; current_position[axis] += axis_length;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder);
tmc2130_home_enter(X_AXIS_MASK << axis);
st_synchronize(); st_synchronize();
tmc2130_home_exit();
uint16_t sg1 = tmc2130_sg_meassure_stop(); uint16_t sg1 = tmc2130_sg_meassure_stop();
printf_P(PSTR("%c AXIS SG1=%d\n"), 'X'+axis, sg1); printf_P(PSTR("%c AXIS SG1=%d\n"), 'X'+axis, sg1);
@ -6121,12 +6141,10 @@ static bool lcd_selfcheck_axis_sg(char axis) {
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder);
st_synchronize(); st_synchronize();
tmc2130_home_enter(X_AXIS_MASK << axis);
current_position[axis] -= (axis_length + margin); current_position[axis] -= (axis_length + margin);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder);
st_synchronize(); st_synchronize();
tmc2130_home_exit();
current_position_init = st_get_position_mm(axis); current_position_init = st_get_position_mm(axis);
@ -6134,7 +6152,7 @@ static bool lcd_selfcheck_axis_sg(char axis) {
//end of second measurement, now check for possible errors: //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(int i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length
SERIAL_ECHOPGM("Measured axis length:"); SERIAL_ECHOPGM("Measured axis length:");
MYSERIAL.println(measured_axis_length[i]); MYSERIAL.println(measured_axis_length[i]);

View File

@ -17,6 +17,7 @@
// Electronics // Electronics
#define MOTHERBOARD BOARD_EINY_0_3a #define MOTHERBOARD BOARD_EINY_0_3a
#define HAS_SECOND_SERIAL_PORT
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) // Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)

View File

@ -17,6 +17,7 @@
// Electronics // Electronics
#define MOTHERBOARD BOARD_EINY_0_4a #define MOTHERBOARD BOARD_EINY_0_4a
#define HAS_SECOND_SERIAL_PORT
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) // Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)

View File

@ -17,6 +17,7 @@
// Electronics // Electronics
#define MOTHERBOARD BOARD_EINY_0_4a #define MOTHERBOARD BOARD_EINY_0_4a
#define HAS_SECOND_SERIAL_PORT
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) // Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)