Merge pull request #44 from 3d-gussner/MK3-PINDA2CalibrationFix

Mk3 pinda2 calibration fix
This commit is contained in:
3d-gussner 2018-01-28 08:17:48 +01:00 committed by GitHub
commit 1322b2cb70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14497 additions and 14977 deletions

View File

@ -511,7 +511,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define PINDA_PREHEAT_X 20 #define PINDA_PREHEAT_X 20
#define PINDA_PREHEAT_Y 60 #define PINDA_PREHEAT_Y 60
#define PINDA_PREHEAT_Z 0.15 #define PINDA_PREHEAT_Z 0.10
/* /*
#define PINDA_PREHEAT_X 70 #define PINDA_PREHEAT_X 70
#define PINDA_PREHEAT_Y -3 #define PINDA_PREHEAT_Y -3

View File

@ -353,28 +353,28 @@ void dcode_8()
if (i > 0) offs = eeprom_read_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + (i - 1)); if (i > 0) offs = eeprom_read_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + (i - 1));
float foffs = ((float)offs) / axis_steps_per_unit[Z_AXIS]; float foffs = ((float)offs) / axis_steps_per_unit[Z_AXIS];
offs = 1000 * foffs; offs = 1000 * foffs;
printf_P(PSTR("temp_pinda=%dC temp_shift=%dum\n"), 35 + i * 5, offs); printf_P(PSTR("temp_pinda=%dC temp_shift=%dum\n"), 35 + i * 7, offs);
} }
} }
else if (strchr_pointer[1+1] == '!') else if (strchr_pointer[1+1] == '!')
{ {
cal_status = 1; cal_status = 1;
eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, cal_status); eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, cal_status);
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 0, 8); //40C - 20um - 8usteps eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 0, 8); //42C - 20um - 8usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 1, 24); //45C - 60um - 24usteps eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 1, 24); //49C - 60um - 24usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 2, 48); //50C - 120um - 48usteps eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 2, 48); //56C - 120um - 48usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 3, 80); //55C - 200um - 80usteps eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 3, 80); //63C - 200um - 80usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 4, 120); //60C - 300um - 120usteps eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 4, 120); //70C - 300um - 120usteps
} }
else else
{ {
if (code_seen('P')) // Pinda temperature [C] if (code_seen('P')) // Pinda temperature [C]
temp_pinda = code_value(); temp_pinda = code_value();
offset_z = temp_compensation_pinda_thermistor_offset(temp_pinda); offset_z = temp_compensation_pinda_thermistor_offset(temp_pinda);
if (code_seen('Z')) // Z Offset [mm] /*if (code_seen('Z')) // Z Offset [mm]
{ {
offset_z = code_value(); offset_z = code_value();
} }*/
} }
printf_P(PSTR("temp_pinda=%d offset_z=%d.%03d\n"), (int)temp_pinda, (int)offset_z, ((int)(1000 * offset_z) % 1000)); printf_P(PSTR("temp_pinda=%d offset_z=%d.%03d\n"), (int)temp_pinda, (int)offset_z, ((int)(1000 * offset_z) % 1000));
} }

File diff suppressed because it is too large Load Diff

View File

@ -3095,10 +3095,11 @@ void process_commands()
case 75: case 75:
{ {
for (int i = 40; i <= 110; i++) { for (int i = 35; i <= 80; i++) {
MYSERIAL.print(i); MYSERIAL.print(i);
MYSERIAL.print(" "); MYSERIAL.print(" -");
MYSERIAL.println(temp_comp_interpolation(i));// / axis_steps_per_unit[Z_AXIS]); MYSERIAL.print(int(temp_compensation_pinda_thermistor_offset(i) * 1000));
MYSERIAL.println("um");
} }
} }
break; break;
@ -3123,12 +3124,12 @@ void process_commands()
int z_shift = 0; //unit: steps int z_shift = 0; //unit: steps
float start_temp = 5 * (int)(current_temperature_pinda / 5); float start_temp = 5 * (int)(current_temperature_pinda / 5);
if (start_temp < 35) start_temp = 35; if (start_temp < 35) start_temp = 35;
if (start_temp < current_temperature_pinda) start_temp += 5; if (start_temp < current_temperature_pinda) start_temp = (int)(current_temperature_pinda);
SERIAL_ECHOPGM("start temperature: "); SERIAL_ECHOPGM("Start temperature: ");
MYSERIAL.println(start_temp); MYSERIAL.println(start_temp);
// setTargetHotend(200, 0);
setTargetBed(70 + (start_temp - 30)); setTargetBed(70 + (start_temp - 30));
custom_message = true; custom_message = true;
custom_message_type = 4; custom_message_type = 4;
@ -3167,28 +3168,35 @@ void process_commands()
int i = -1; for (; i < 5; i++) int i = -1; for (; i < 5; i++)
{ {
float temp = (40 + i * 5); float temp = (42 + i * 7);
if (start_temp <= temp) break;
SERIAL_ECHOPGM("Step: "); SERIAL_ECHOPGM("Step: ");
MYSERIAL.print(i + 2); MYSERIAL.print(i + 2);
SERIAL_ECHOLNPGM("/6 (skipped)"); if (i > -1) {
SERIAL_ECHOLNPGM("/6 (skipped)");
} else {
SERIAL_ECHOLNPGM("/6");
}
SERIAL_ECHOPGM("PINDA temperature: "); SERIAL_ECHOPGM("PINDA temperature: ");
MYSERIAL.print((40 + i*5)); MYSERIAL.print((42 + i * 7));
SERIAL_ECHOPGM(" Z shift (mm):"); SERIAL_ECHOPGM(" Z shift (mm):");
MYSERIAL.print(0); MYSERIAL.print(0);
SERIAL_ECHOLNPGM(""); SERIAL_ECHOLNPGM("");
if (i >= 0) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); if (i >= 0) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
if (start_temp <= temp) break; //if (start_temp <= temp) break;
} }
for (i++; i < 5; i++) for (i++; i < 5; i++)
{ {
float temp = (40 + i * 5); float temp = (42 + i * 7);
SERIAL_ECHOPGM("Step: "); SERIAL_ECHOPGM("Step: ");
MYSERIAL.print(i + 2); MYSERIAL.print(i + 2);
SERIAL_ECHOLNPGM("/6"); SERIAL_ECHOLNPGM("/6");
custom_message_state = i + 2; custom_message_state = i + 2;
setTargetBed(50 + 10 * (temp - 30) / 5); if ((50 + 10 * (temp - 30) / 5) > 115) {
// setTargetHotend(255, 0); setTargetBed(115);
} else setTargetBed(50 + 10 * (temp - 30) / 5);
if (i>2) setTargetHotend(255, 0); //Boost to get to the end game (last couple probings)
current_position[X_AXIS] = PINDA_PREHEAT_X; current_position[X_AXIS] = PINDA_PREHEAT_X;
current_position[Y_AXIS] = PINDA_PREHEAT_Y; current_position[Y_AXIS] = PINDA_PREHEAT_Y;
current_position[Z_AXIS] = PINDA_PREHEAT_Z; current_position[Z_AXIS] = PINDA_PREHEAT_Z;
@ -3214,9 +3222,8 @@ void process_commands()
SERIAL_ECHOPGM(" Z shift (mm):"); SERIAL_ECHOPGM(" Z shift (mm):");
MYSERIAL.print(current_position[Z_AXIS] - zero_z); MYSERIAL.print(current_position[Z_AXIS] - zero_z);
SERIAL_ECHOLNPGM(""); SERIAL_ECHOLNPGM("");
if (z_shift < 0) z_shift = 0; //Ensure that a small negative value doesn't throw out EEPROM word/float
EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
} }
custom_message_type = 0; custom_message_type = 0;
custom_message = false; custom_message = false;
@ -3230,7 +3237,13 @@ void process_commands()
disable_e1(); disable_e1();
disable_e2(); disable_e2();
setTargetBed(0); //set bed target temperature back to 0 setTargetBed(0); //set bed target temperature back to 0
// setTargetHotend(0,0); //set hotend target temperature back to 0 setTargetHotend(0,0); //set hotend target temperature back to 0
//Move head back out of the way
current_position[X_AXIS] = pgm_read_float(bed_ref_points);
current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1);
current_position[Z_AXIS] = 5; //Lift head up a little
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_TEMP_CALIBRATION_DONE); lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CALIBRATION_DONE);
lcd_update_enable(true); lcd_update_enable(true);
lcd_update(2); lcd_update(2);
@ -7306,9 +7319,8 @@ float temp_comp_interpolation(float inp_temperature) {
shift[0] = 0; shift[0] = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (i>0) EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + (i-1) * 2, &shift[i]); //read shift in steps from EEPROM if (i>0) EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + (i-1) * 2, &shift[i]); //read shift in steps from EEPROM
temp_C[i] = 50 + i * 10; //temperature in C
#ifdef PINDA_THERMISTOR #ifdef PINDA_THERMISTOR
temp_C[i] = 35 + i * 5; //temperature in C temp_C[i] = 35 + i * 7; //temperature in C
#else #else
temp_C[i] = 50 + i * 10; //temperature in C temp_C[i] = 50 + i * 10; //temperature in C
#endif #endif
@ -7353,9 +7365,11 @@ float temp_comp_interpolation(float inp_temperature) {
d = f[i]; d = f[i];
sum = a*pow((inp_temperature - x[i]), 3) + b*pow((inp_temperature - x[i]), 2) + c*(inp_temperature - x[i]) + d; sum = a*pow((inp_temperature - x[i]), 3) + b*pow((inp_temperature - x[i]), 2) + c*(inp_temperature - x[i]) + d;
} }
// Create hard limits to prevent machine damage from error result
return sum; if (sum < 0) {
return 0;
} else if ((sum / axis_steps_per_unit[Z_AXIS]) > 1.5) return (1.5 * axis_steps_per_unit[Z_AXIS]);
return sum;
} }
#ifdef PINDA_THERMISTOR #ifdef PINDA_THERMISTOR
@ -7413,8 +7427,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(" E:"); SERIAL_PROTOCOLPGM(" P:");
SERIAL_PROTOCOL((int)active_extruder); SERIAL_PROTOCOL(current_temperature_pinda);
SERIAL_PROTOCOLPGM(" B:"); SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL_F(degBed(), 1); SERIAL_PROTOCOL_F(degBed(), 1);
SERIAL_PROTOCOLLN(""); SERIAL_PROTOCOLLN("");