PINDA thermistor + extruder current adjust.
This commit is contained in:
parent
1e705198e0
commit
f563618b1c
@ -744,4 +744,6 @@ enum CalibrationStatus
|
||||
#include "Configuration_adv.h"
|
||||
#include "thermistortables.h"
|
||||
|
||||
#define PINDA_THERMISTOR
|
||||
|
||||
#endif //__CONFIGURATION_H
|
||||
|
@ -361,6 +361,11 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
|
||||
float temp_comp_interpolation(float temperature);
|
||||
void temp_compensation_apply();
|
||||
void temp_compensation_start();
|
||||
|
||||
#ifdef PINDA_THERMISTOR
|
||||
float temp_compensation_pinda_thermistor_offset();
|
||||
#endif //PINDA_THERMISTOR
|
||||
|
||||
void wait_for_heater(long codenum);
|
||||
void serialecho_temperatures();
|
||||
|
||||
|
@ -3050,6 +3050,139 @@ void process_commands()
|
||||
|
||||
case 76: //PINDA probe temperature calibration
|
||||
{
|
||||
#ifdef PINDA_THERMISTOR
|
||||
if (farm_mode && temp_cal_active)
|
||||
{
|
||||
if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) {
|
||||
// We don't know where we are! HOME!
|
||||
// Push the commands to the front of the message queue in the reverse order!
|
||||
// There shall be always enough space reserved for these commands.
|
||||
repeatcommand_front(); // repeat G76 with all its parameters
|
||||
enquecommand_front_P((PSTR("G28 W0")));
|
||||
break;
|
||||
}
|
||||
SERIAL_ECHOLNPGM("PINDA probe calibration start");
|
||||
|
||||
float zero_z;
|
||||
int z_shift = 0; //unit: steps
|
||||
float start_temp = 5 * (int)(current_temperature_pinda / 5);
|
||||
if (start_temp < 35) start_temp = 35;
|
||||
if (start_temp < current_temperature_pinda) start_temp += 5;
|
||||
SERIAL_ECHOPGM("start temperature: ");
|
||||
MYSERIAL.println(start_temp);
|
||||
|
||||
setTargetHotend(200, 0);
|
||||
setTargetBed(50 + 10 * (start_temp - 30) / 5);
|
||||
|
||||
custom_message = true;
|
||||
custom_message_type = 4;
|
||||
custom_message_state = 1;
|
||||
custom_message = MSG_TEMP_CALIBRATION;
|
||||
current_position[X_AXIS] = PINDA_PREHEAT_X;
|
||||
current_position[Y_AXIS] = PINDA_PREHEAT_Y;
|
||||
current_position[Z_AXIS] = PINDA_PREHEAT_Z;
|
||||
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();
|
||||
|
||||
while (current_temperature_pinda < start_temp)
|
||||
{
|
||||
delay_keep_alive(1000);
|
||||
serialecho_temperatures();
|
||||
}
|
||||
|
||||
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0); //invalidate temp. calibration in case that in will be aborted during the calibration process
|
||||
|
||||
current_position[Z_AXIS] = 5;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
|
||||
|
||||
current_position[X_AXIS] = pgm_read_float(bed_ref_points);
|
||||
current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1);
|
||||
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();
|
||||
|
||||
find_bed_induction_sensor_point_z(-1.f);
|
||||
zero_z = current_position[Z_AXIS];
|
||||
|
||||
//current_position[Z_AXIS]
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOPGM("ZERO: ");
|
||||
MYSERIAL.print(current_position[Z_AXIS]);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
|
||||
int i = -1; for (; i < 5; i++)
|
||||
{
|
||||
float temp = (40 + i * 5);
|
||||
SERIAL_ECHOPGM("Step: ");
|
||||
MYSERIAL.print(i + 2);
|
||||
SERIAL_ECHOLNPGM("/6 (skipped)");
|
||||
SERIAL_ECHOPGM("PINDA temperature: ");
|
||||
MYSERIAL.print((40 + i*5));
|
||||
SERIAL_ECHOPGM(" Z shift (mm):");
|
||||
MYSERIAL.print(0);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
if (i >= 0) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
|
||||
if (start_temp <= temp) break;
|
||||
}
|
||||
|
||||
for (i++; i < 5; i++)
|
||||
{
|
||||
float temp = (40 + i * 5);
|
||||
SERIAL_ECHOPGM("Step: ");
|
||||
MYSERIAL.print(i + 2);
|
||||
SERIAL_ECHOLNPGM("/6");
|
||||
custom_message_state = i + 2;
|
||||
setTargetBed(50 + 10 * (temp - 30) / 5);
|
||||
setTargetHotend(255, 0);
|
||||
current_position[X_AXIS] = PINDA_PREHEAT_X;
|
||||
current_position[Y_AXIS] = PINDA_PREHEAT_Y;
|
||||
current_position[Z_AXIS] = PINDA_PREHEAT_Z;
|
||||
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();
|
||||
while (current_temperature_pinda < temp)
|
||||
{
|
||||
delay_keep_alive(1000);
|
||||
serialecho_temperatures();
|
||||
}
|
||||
current_position[Z_AXIS] = 5;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
|
||||
current_position[X_AXIS] = pgm_read_float(bed_ref_points);
|
||||
current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1);
|
||||
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();
|
||||
find_bed_induction_sensor_point_z(-1.f);
|
||||
z_shift = (int)((current_position[Z_AXIS] - zero_z)*axis_steps_per_unit[Z_AXIS]);
|
||||
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOPGM("PINDA temperature: ");
|
||||
MYSERIAL.print(current_temperature_pinda);
|
||||
SERIAL_ECHOPGM(" Z shift (mm):");
|
||||
MYSERIAL.print(current_position[Z_AXIS] - zero_z);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
|
||||
EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
|
||||
|
||||
}
|
||||
custom_message_type = 0;
|
||||
custom_message = false;
|
||||
|
||||
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1);
|
||||
SERIAL_ECHOLNPGM("Temperature calibration done. Continue with pressing the knob.");
|
||||
disable_x();
|
||||
disable_y();
|
||||
disable_z();
|
||||
disable_e0();
|
||||
disable_e1();
|
||||
disable_e2();
|
||||
lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CALIBRATION_DONE);
|
||||
lcd_update_enable(true);
|
||||
lcd_update(2);
|
||||
|
||||
setTargetBed(0); //set bed target temperature back to 0
|
||||
setTargetHotend(0,0); //set hotend target temperature back to 0
|
||||
break;
|
||||
}
|
||||
#endif //PINDA_THERMISTOR
|
||||
|
||||
setTargetBed(PINDA_MIN_T);
|
||||
float zero_z;
|
||||
int z_shift = 0; //unit: steps
|
||||
@ -3238,6 +3371,16 @@ void process_commands()
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bool temp_comp_start = true;
|
||||
#ifdef PINDA_THERMISTOR
|
||||
if (farm_mode && temp_cal_active)
|
||||
{
|
||||
temp_comp_start = false;
|
||||
}
|
||||
#endif //PINDA_THERMISTOR
|
||||
|
||||
if (temp_comp_start)
|
||||
if (run == false && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50) {
|
||||
if (lcd_commands_type != LCD_COMMAND_STOP_PRINT) {
|
||||
temp_compensation_start();
|
||||
@ -3368,12 +3511,21 @@ void process_commands()
|
||||
SERIAL_PROTOCOLPGM("\n");
|
||||
}
|
||||
|
||||
float offset_z = 0;
|
||||
|
||||
#ifdef PINDA_THERMISTOR
|
||||
if (farm_mode && temp_cal_active)
|
||||
offset_z = temp_compensation_pinda_thermistor_offset();
|
||||
#endif //PINDA_THERMISTOR
|
||||
|
||||
if (verbosity_level >= 1) {
|
||||
SERIAL_ECHOPGM("mesh bed leveling: ");
|
||||
MYSERIAL.print(current_position[Z_AXIS], 5);
|
||||
SERIAL_ECHOPGM(" offset: ");
|
||||
MYSERIAL.print(offset_z, 5);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
}
|
||||
mbl.set_z(ix, iy, current_position[Z_AXIS]); //store measured z values z_values[iy][ix] = z;
|
||||
mbl.set_z(ix, iy, current_position[Z_AXIS] - offset_z); //store measured z values z_values[iy][ix] = z - offset_z;
|
||||
|
||||
custom_message_state--;
|
||||
mesh_point++;
|
||||
@ -3393,6 +3545,15 @@ void process_commands()
|
||||
}
|
||||
clean_up_after_endstop_move();
|
||||
SERIAL_ECHOLNPGM("clean up finished ");
|
||||
|
||||
bool apply_temp_comp = true;
|
||||
#ifdef PINDA_THERMISTOR
|
||||
if (farm_mode && temp_cal_active)
|
||||
{
|
||||
apply_temp_comp = false;
|
||||
}
|
||||
#endif
|
||||
if (apply_temp_comp)
|
||||
if(temp_cal_active == true && calibration_status_pinda() == true) temp_compensation_apply(); //apply PINDA temperature compensation
|
||||
babystep_apply(); // Apply Z height correction aka baby stepping before mesh bed leveing gets activated.
|
||||
SERIAL_ECHOLNPGM("babystep applied");
|
||||
@ -4334,6 +4495,12 @@ Sigma_Exit:
|
||||
SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1);
|
||||
SERIAL_PROTOCOLPGM(" /");
|
||||
SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder),1);
|
||||
#ifdef PINDA_THERMISTOR
|
||||
SERIAL_PROTOCOLPGM(" T1:");
|
||||
SERIAL_PROTOCOL_F(current_temperature_pinda, 1);
|
||||
SERIAL_PROTOCOLPGM(" /");
|
||||
SERIAL_PROTOCOL_F(degTargetBed(), 1);
|
||||
#endif // PINDA_THERMISTOR
|
||||
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
||||
SERIAL_PROTOCOLPGM(" B:");
|
||||
SERIAL_PROTOCOL_F(degBed(),1);
|
||||
@ -7016,7 +7183,11 @@ float temp_comp_interpolation(float inp_temperature) {
|
||||
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
|
||||
temp_C[i] = 50 + i * 10; //temperature in C
|
||||
|
||||
#ifdef PINDA_THERMISTOR
|
||||
temp_C[i] = 35 + i * 5; //temperature in C
|
||||
#else
|
||||
temp_C[i] = 50 + i * 10; //temperature in C
|
||||
#endif
|
||||
x[i] = (float)temp_C[i];
|
||||
f[i] = (float)shift[i];
|
||||
}
|
||||
@ -7063,6 +7234,15 @@ float temp_comp_interpolation(float inp_temperature) {
|
||||
|
||||
}
|
||||
|
||||
#ifdef PINDA_THERMISTOR
|
||||
float temp_compensation_pinda_thermistor_offset()
|
||||
{
|
||||
if (!temp_cal_active) return 0;
|
||||
if (!calibration_status_pinda()) return 0;
|
||||
return temp_comp_interpolation(current_temperature_pinda) / axis_steps_per_unit[Z_AXIS];
|
||||
}
|
||||
#endif //PINDA_THERMISTOR
|
||||
|
||||
void long_pause() //long pause print
|
||||
{
|
||||
st_synchronize();
|
||||
@ -7111,6 +7291,10 @@ void serialecho_temperatures() {
|
||||
SERIAL_PROTOCOL(tt);
|
||||
SERIAL_PROTOCOLPGM(" E:");
|
||||
SERIAL_PROTOCOL((int)active_extruder);
|
||||
#ifdef PINDA_THERMISTOR
|
||||
SERIAL_PROTOCOLPGM(" T1:");
|
||||
SERIAL_PROTOCOL(current_temperature_pinda);
|
||||
#endif
|
||||
SERIAL_PROTOCOLPGM(" B:");
|
||||
SERIAL_PROTOCOL_F(degBed(), 1);
|
||||
SERIAL_PROTOCOLLN("");
|
||||
|
@ -45,6 +45,10 @@ int target_temperature[EXTRUDERS] = { 0 };
|
||||
int target_temperature_bed = 0;
|
||||
int current_temperature_raw[EXTRUDERS] = { 0 };
|
||||
float current_temperature[EXTRUDERS] = { 0.0 };
|
||||
#ifdef PINDA_THERMISTOR
|
||||
int current_temperature_raw_pinda = 0 ;
|
||||
float current_temperature_pinda = 0.0;
|
||||
#endif //PINDA_THERMISTOR
|
||||
int current_temperature_bed_raw = 0;
|
||||
float current_temperature_bed = 0.0;
|
||||
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
|
||||
@ -864,6 +868,9 @@ static void updateTemperaturesFromRawValues()
|
||||
{
|
||||
current_temperature[e] = analog2temp(current_temperature_raw[e], e);
|
||||
}
|
||||
#ifdef PINDA_THERMISTOR
|
||||
current_temperature_pinda = analog2tempBed(current_temperature_raw_pinda); //thermistor for pinda is the same as for bed
|
||||
#endif
|
||||
|
||||
current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
|
||||
|
||||
@ -1944,16 +1951,20 @@ ISR(TIMER0_COMPB_vect)
|
||||
if (!temp_meas_ready) //Only update the raw values if they have been read. Else we could be updating them during reading.
|
||||
{
|
||||
current_temperature_raw[0] = raw_temp_0_value;
|
||||
#if EXTRUDERS > 1
|
||||
#ifdef PINDA_THERMISTOR
|
||||
current_temperature_raw_pinda = raw_temp_1_value;
|
||||
#else
|
||||
#if EXTRUDERS > 1
|
||||
current_temperature_raw[1] = raw_temp_1_value;
|
||||
#endif
|
||||
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
|
||||
#endif
|
||||
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
|
||||
redundant_temperature_raw = raw_temp_1_value;
|
||||
#endif
|
||||
#if EXTRUDERS > 2
|
||||
#endif
|
||||
#if EXTRUDERS > 2
|
||||
current_temperature_raw[2] = raw_temp_2_value;
|
||||
#endif
|
||||
current_temperature_bed_raw = raw_temp_bed_value;
|
||||
#endif
|
||||
#endif //PINDA_THERMISTOR
|
||||
current_temperature_bed_raw = raw_temp_bed_value;
|
||||
}
|
||||
|
||||
//Add similar code for Filament Sensor - can be read any time since IIR filtering is used
|
||||
|
@ -49,6 +49,12 @@ extern float current_temperature[EXTRUDERS];
|
||||
#endif
|
||||
extern int target_temperature_bed;
|
||||
extern float current_temperature_bed;
|
||||
|
||||
#ifdef PINDA_THERMISTOR
|
||||
extern int current_temperature_raw_pinda;
|
||||
extern float current_temperature_pinda;
|
||||
#endif
|
||||
|
||||
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
|
||||
extern float redundant_temperature;
|
||||
#endif
|
||||
|
@ -734,7 +734,21 @@ static void lcd_implementation_status_screen()
|
||||
planner_queue_min_reset();
|
||||
}
|
||||
#endif
|
||||
bool print_sd_status = true;
|
||||
|
||||
#ifdef PINDA_THERMISTOR
|
||||
// if (farm_mode && (custom_message_type == 4))
|
||||
{
|
||||
lcd.setCursor(0, 2);
|
||||
lcd_printPGM(PSTR("P"));
|
||||
lcd.print(ftostr3(current_temperature_pinda));
|
||||
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
|
||||
print_sd_status = false;
|
||||
}
|
||||
#endif //PINDA_THERMISTOR
|
||||
|
||||
if (print_sd_status)
|
||||
{
|
||||
//Print SD status
|
||||
lcd.setCursor(0, 2);
|
||||
if (is_usb_printing)
|
||||
@ -762,7 +776,8 @@ static void lcd_implementation_status_screen()
|
||||
lcd.print('%');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Farm number display
|
||||
if (farm_mode)
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
|
||||
|
||||
//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only)
|
||||
#define TMC2130_CURRENTS_H {3, 3, 5, 8} // default holding currents for all axes
|
||||
#define TMC2130_CURRENTS_R {13, 13, 20, 20} // default running currents for all axes
|
||||
#define TMC2130_CURRENTS_R {13, 13, 20, 22} // default running currents for all axes
|
||||
|
||||
//#define TMC2130_DEBUG
|
||||
//#define TMC2130_DEBUG_WR
|
||||
|
@ -144,7 +144,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
|
||||
|
||||
//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only)
|
||||
#define TMC2130_CURRENTS_H {3, 3, 5, 8} // default holding currents for all axes
|
||||
#define TMC2130_CURRENTS_R {13, 13, 20, 20} // default running currents for all axes
|
||||
#define TMC2130_CURRENTS_R {13, 13, 20, 22} // default running currents for all axes
|
||||
|
||||
//#define TMC2130_DEBUG
|
||||
//#define TMC2130_DEBUG_WR
|
||||
|
Loading…
Reference in New Issue
Block a user