PINDA thermistor and ambient thermistor.

This commit is contained in:
Robert Pelnar 2017-09-05 14:02:35 +02:00
parent f563618b1c
commit 8ec316773f
8 changed files with 132 additions and 66 deletions

View File

@ -746,4 +746,6 @@ enum CalibrationStatus
#define PINDA_THERMISTOR
#define AMBIENT_THERMISTOR
#endif //__CONFIGURATION_H

View File

@ -3051,7 +3051,7 @@ void process_commands()
case 76: //PINDA probe temperature calibration
{
#ifdef PINDA_THERMISTOR
if (farm_mode && temp_cal_active)
if (true)
{
if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) {
// We don't know where we are! HOME!
@ -3071,7 +3071,7 @@ void process_commands()
SERIAL_ECHOPGM("start temperature: ");
MYSERIAL.println(start_temp);
setTargetHotend(200, 0);
// setTargetHotend(200, 0);
setTargetBed(50 + 10 * (start_temp - 30) / 5);
custom_message = true;
@ -3132,7 +3132,7 @@ void process_commands()
SERIAL_ECHOLNPGM("/6");
custom_message_state = i + 2;
setTargetBed(50 + 10 * (temp - 30) / 5);
setTargetHotend(255, 0);
// setTargetHotend(255, 0);
current_position[X_AXIS] = PINDA_PREHEAT_X;
current_position[Y_AXIS] = PINDA_PREHEAT_Y;
current_position[Z_AXIS] = PINDA_PREHEAT_Z;
@ -3178,7 +3178,7 @@ void process_commands()
lcd_update(2);
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
break;
}
#endif //PINDA_THERMISTOR
@ -3374,10 +3374,7 @@ void process_commands()
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)
@ -3514,7 +3511,6 @@ void process_commands()
float offset_z = 0;
#ifdef PINDA_THERMISTOR
if (farm_mode && temp_cal_active)
offset_z = temp_compensation_pinda_thermistor_offset();
#endif //PINDA_THERMISTOR
@ -3548,10 +3544,7 @@ void process_commands()
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
@ -4495,12 +4488,6 @@ 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);
@ -7291,10 +7278,6 @@ 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("");

View File

@ -65,23 +65,22 @@
#define Z_MS1_PIN -1
#define Z_MS2_PIN -1
#define HEATER_BED_PIN 4
#define TEMP_BED_PIN 2
#define HEATER_BED_PIN 4 //PG5
#define TEMP_BED_PIN 2 //A2
#define HEATER_0_PIN 3
#define TEMP_0_PIN 0
#define HEATER_0_PIN 3 //PE5
#define TEMP_0_PIN 0 //A0
#define HEATER_1_PIN 7
#define TEMP_1_PIN 1
#define HEATER_1_PIN -1
#define TEMP_1_PIN 1 //A1
#ifdef BARICUDA
#define HEATER_2_PIN 6
#else
#define HEATER_2_PIN -1
#endif
#define TEMP_2_PIN -1
#define TEMP_AMBIENT_PIN 6 //A6
#define TEMP_PINDA_PIN 3 //A3
#define E0_TMC2130_CS 66
#define E0_TMC2130_DIAG 65
#define E0_STEP_PIN 34

View File

@ -55,23 +55,22 @@
#define Z_MS1_PIN -1
#define Z_MS2_PIN -1
#define HEATER_BED_PIN 4
#define TEMP_BED_PIN 2
#define HEATER_BED_PIN 4 //PG5
#define TEMP_BED_PIN 2 //A2
#define HEATER_0_PIN 3
#define TEMP_0_PIN 0
#define HEATER_0_PIN 3 //PE5
#define TEMP_0_PIN 0 //A0
#define HEATER_1_PIN 7
#define TEMP_1_PIN 1
#define HEATER_1_PIN -1
#define TEMP_1_PIN 1 //A1
#ifdef BARICUDA
#define HEATER_2_PIN 6
#else
#define HEATER_2_PIN -1
#endif
#define TEMP_2_PIN -1
#define TEMP_AMBIENT_PIN 6 //A6
#define TEMP_PINDA_PIN 3 //A3
#define E0_TMC2130_CS 66
#define E0_TMC2130_DIAG 65
#define E0_STEP_PIN 34

View File

@ -45,10 +45,17 @@ 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
#ifdef AMBIENT_THERMISTOR
int current_temperature_raw_ambient = 0 ;
float current_temperature_ambient = 0.0;
#endif //AMBIENT_THERMISTOR
int current_temperature_bed_raw = 0;
float current_temperature_bed = 0.0;
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
@ -868,10 +875,15 @@ 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
#ifdef AMBIENT_THERMISTOR
current_temperature_ambient = analog2tempBed(current_temperature_raw_ambient); //thermistor for ambient is the same as for bed
#endif
current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
@ -1492,7 +1504,9 @@ ISR(TIMER0_COMPB_vect)
static unsigned long raw_temp_1_value = 0;
static unsigned long raw_temp_2_value = 0;
static unsigned long raw_temp_bed_value = 0;
static unsigned char temp_state = 10;
static unsigned long raw_temp_pinda_value = 0;
static unsigned long raw_temp_ambient_value = 0;
static unsigned char temp_state = 14;
static unsigned char pwm_count = (1 << SOFT_PWM_SCALE);
static unsigned char soft_pwm_0;
#ifdef SLOW_PWM_HEATERS
@ -1931,13 +1945,52 @@ ISR(TIMER0_COMPB_vect)
raw_filwidth_value= raw_filwidth_value + ((unsigned long)ADC<<7); //add new ADC reading
}
#endif
temp_state = 10;
break;
case 10: // Prepare TEMP_AMBIENT
#if defined(TEMP_AMBIENT_PIN) && (TEMP_AMBIENT_PIN > -1)
#if TEMP_AMBIENT_PIN > 7
ADCSRB = 1<<MUX5;
#else
ADCSRB = 0;
#endif
ADMUX = ((1 << REFS0) | (TEMP_AMBIENT_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion
#endif
lcd_buttons_update();
temp_state = 11;
break;
case 11: // Measure TEMP_AMBIENT
#if defined(TEMP_AMBIENT_PIN) && (TEMP_AMBIENT_PIN > -1)
raw_temp_ambient_value += ADC;
#endif
temp_state = 12;
break;
case 12: // Prepare TEMP_PINDA
#if defined(TEMP_PINDA_PIN) && (TEMP_PINDA_PIN > -1)
#if TEMP_PINDA_PIN > 7
ADCSRB = 1<<MUX5;
#else
ADCSRB = 0;
#endif
ADMUX = ((1 << REFS0) | (TEMP_PINDA_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion
#endif
lcd_buttons_update();
temp_state = 13;
break;
case 13: // Measure TEMP_PINDA
#if defined(TEMP_PINDA_PIN) && (TEMP_PINDA_PIN > -1)
raw_temp_pinda_value += ADC;
#endif
temp_state = 0;
temp_count++;
break;
case 10: //Startup, delay initial temp reading a tiny bit so the hardware can settle.
case 14: //Startup, delay initial temp reading a tiny bit so the hardware can settle.
temp_state = 0;
break;
// default:
@ -1951,9 +2004,6 @@ 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;
#ifdef PINDA_THERMISTOR
current_temperature_raw_pinda = raw_temp_1_value;
#else
#if EXTRUDERS > 1
current_temperature_raw[1] = raw_temp_1_value;
#endif
@ -1963,7 +2013,12 @@ ISR(TIMER0_COMPB_vect)
#if EXTRUDERS > 2
current_temperature_raw[2] = raw_temp_2_value;
#endif
#ifdef PINDA_THERMISTOR
current_temperature_raw_pinda = raw_temp_pinda_value;
#endif //PINDA_THERMISTOR
#ifdef AMBIENT_THERMISTOR
current_temperature_raw_ambient = raw_temp_ambient_value;
#endif //AMBIENT_THERMISTOR
current_temperature_bed_raw = raw_temp_bed_value;
}
@ -1979,6 +2034,8 @@ ISR(TIMER0_COMPB_vect)
raw_temp_1_value = 0;
raw_temp_2_value = 0;
raw_temp_bed_value = 0;
raw_temp_pinda_value = 0;
raw_temp_ambient_value = 0;
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
if(current_temperature_raw[0] <= maxttemp_raw[0]) {

View File

@ -51,10 +51,15 @@ extern int target_temperature_bed;
extern float current_temperature_bed;
#ifdef PINDA_THERMISTOR
extern int current_temperature_raw_pinda;
//extern int current_temperature_raw_pinda;
extern float current_temperature_pinda;
#endif
#ifdef AMBIENT_THERMISTOR
//extern int current_temperature_raw_ambient;
extern float current_temperature_ambient;
#endif
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
extern float redundant_temperature;
#endif

View File

@ -952,6 +952,24 @@ static void lcd_menu_extruder_info()
}
}
static void lcd_menu_temperatures()
{
lcd.setCursor(1, 1);
lcd.print("Ambient: ");
lcd.setCursor(12, 1);
lcd.print(ftostr31ns(current_temperature_ambient));
lcd.print(LCD_STR_DEGREE);
lcd.setCursor(1, 2);
lcd.print("PINDA: ");
lcd.setCursor(12, 2);
lcd.print(ftostr31ns(current_temperature_pinda));
lcd.print(LCD_STR_DEGREE);
if (lcd_clicked())
{
lcd_quick_feedback();
lcd_return_to_status();
}
}
static void lcd_preheat_menu()
{
@ -1026,6 +1044,7 @@ static void lcd_support_menu()
MENU_ITEM(function, PSTR("XYZ cal. details"), lcd_service_mode_show_result);
}
MENU_ITEM(submenu, MSG_INFO_EXTRUDER, lcd_menu_extruder_info);
MENU_ITEM(submenu, PSTR("Temperatures"), lcd_menu_temperatures);
#endif //MK1BP
END_MENU();
}

View File

@ -738,6 +738,7 @@ static void lcd_implementation_status_screen()
#ifdef PINDA_THERMISTOR
// if (farm_mode && (custom_message_type == 4))
if (false)
{
lcd.setCursor(0, 2);
lcd_printPGM(PSTR("P"));
@ -747,6 +748,7 @@ static void lcd_implementation_status_screen()
}
#endif //PINDA_THERMISTOR
if (print_sd_status)
{
//Print SD status