Skip to content

Commit

Permalink
Merge pull request #2748 from mkbel/detect_superpinda
Browse files Browse the repository at this point in the history
Detect superPINDA PFW-1107
  • Loading branch information
mkbel authored Jun 16, 2020
2 parents dda9b7f + 9838be8 commit 45e1829
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 148 deletions.
1 change: 0 additions & 1 deletion Firmware/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ extern unsigned long stoptime;
extern int bowden_length[4];
extern bool is_usb_printing;
extern bool homing_flag;
extern bool temp_cal_active;
extern bool loading_flag;
extern unsigned int usb_printing_counter;

Expand Down
288 changes: 146 additions & 142 deletions Firmware/Marlin_main.cpp

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions Firmware/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2196,4 +2196,20 @@ float unscalePID_d(float d)

#endif //PIDTEMP

#ifdef PINDA_THERMISTOR
//! @brief PINDA thermistor detected
//!
//! @retval true firmware should do temperature compensation and allow calibration
//! @retval false PINDA thermistor is not detected, disable temperature compensation and calibration
//!
bool has_temperature_compensation()
{
#ifdef DETECT_SUPERPINDA
return (current_temperature_pinda >= PINDA_MINTEMP) ? true : false;
#else
return true;
#endif
}
#endif //PINDA_THERMISTOR


1 change: 1 addition & 0 deletions Firmware/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ extern float current_temperature_bed;
#ifdef PINDA_THERMISTOR
extern uint16_t current_temperature_raw_pinda;
extern float current_temperature_pinda;
bool has_temperature_compensation();
#endif

#ifdef AMBIENT_THERMISTOR
Expand Down
14 changes: 9 additions & 5 deletions Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3920,14 +3920,12 @@ void lcd_temp_cal_show_result(bool result) {
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1);
SERIAL_ECHOLNPGM("Temperature calibration done. Continue with pressing the knob.");
lcd_show_fullscreen_message_and_wait_P(_T(MSG_TEMP_CALIBRATION_DONE));
temp_cal_active = true;
eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 1);
}
else {
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0);
SERIAL_ECHOLNPGM("Temperature calibration failed. Continue with pressing the knob.");
lcd_show_fullscreen_message_and_wait_P(_i("Temperature calibration failed"));////MSG_TEMP_CAL_FAILED c=20 r=8
temp_cal_active = false;
eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 0);
}
lcd_update_enable(true);
Expand Down Expand Up @@ -4635,6 +4633,7 @@ void lcd_pinda_calibration_menu()
}

void lcd_temp_calibration_set() {
bool temp_cal_active = eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE);
temp_cal_active = !temp_cal_active;
eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, temp_cal_active);
}
Expand Down Expand Up @@ -5764,8 +5763,10 @@ static void lcd_settings_menu()
#if defined (TMC2130) && defined (LINEARITY_CORRECTION)
MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu);
#endif //LINEARITY_CORRECTION && TMC2130

MENU_ITEM_TOGGLE_P(_T(MSG_TEMP_CALIBRATION), temp_cal_active ? _T(MSG_ON) : _T(MSG_OFF), lcd_temp_calibration_set);
if(has_temperature_compensation())
{
MENU_ITEM_TOGGLE_P(_T(MSG_TEMP_CALIBRATION), eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE) ? _T(MSG_ON) : _T(MSG_OFF), lcd_temp_calibration_set);
}

#ifdef HAS_SECOND_SERIAL_PORT
MENU_ITEM_TOGGLE_P(_T(MSG_RPI_PORT), (selectedSerialPort == 0) ? _T(MSG_OFF) : _T(MSG_ON), lcd_second_serial_set);
Expand Down Expand Up @@ -5869,7 +5870,10 @@ static void lcd_calibration_menu()
//MENU_ITEM_FUNCTION_P(MSG_RESET_CALIBRATE_E, lcd_extr_cal_reset);
#endif
#ifndef MK1BP
MENU_ITEM_SUBMENU_P(_i("Temp. calibration"), lcd_pinda_calibration_menu);////MSG_CALIBRATION_PINDA_MENU c=17 r=1
if(has_temperature_compensation())
{
MENU_ITEM_SUBMENU_P(_i("Temp. calibration"), lcd_pinda_calibration_menu);////MSG_CALIBRATION_PINDA_MENU c=17 r=1
}
#endif //MK1BP
}

Expand Down
2 changes: 2 additions & 0 deletions Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@
#if BED_MINTEMP_DELAY>USHRT_MAX
#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)"
#endif
#define DETECT_SUPERPINDA
#define PINDA_MINTEMP BED_MINTEMP

// Maxtemps
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
Expand Down
2 changes: 2 additions & 0 deletions Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@
#if BED_MINTEMP_DELAY>USHRT_MAX
#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)"
#endif
#define DETECT_SUPERPINDA
#define PINDA_MINTEMP BED_MINTEMP

// Maxtemps
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
Expand Down

0 comments on commit 45e1829

Please sign in to comment.