Mark code unused when PINDA_THERMISTOR is defined by macro. Saves 1B of RAM and 4B of FLASH memory.

This commit is contained in:
Marek Bel 2019-09-17 20:26:03 +02:00
parent 966d9baf2b
commit 027b6238fd
5 changed files with 27 additions and 20 deletions

View file

@ -423,8 +423,6 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y); void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y);
#endif //HEATBED_ANALYSIS #endif //HEATBED_ANALYSIS
float temp_comp_interpolation(float temperature); float temp_comp_interpolation(float temperature);
void temp_compensation_apply();
void temp_compensation_start();
void show_fw_version_warnings(); void show_fw_version_warnings();
uint8_t check_printer_version(); uint8_t check_printer_version();

View file

@ -397,6 +397,9 @@ static bool setTargetedHotend(int code, uint8_t &extruder);
static void print_time_remaining_init(); static void print_time_remaining_init();
static void wait_for_heater(long codenum, uint8_t extruder); static void wait_for_heater(long codenum, uint8_t extruder);
static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis); static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis);
static void temp_compensation_start();
static void temp_compensation_apply();
uint16_t gcode_in_progress = 0; uint16_t gcode_in_progress = 0;
uint16_t mcode_in_progress = 0; uint16_t mcode_in_progress = 0;
@ -4617,7 +4620,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
case_G80: case_G80:
{ {
mesh_bed_leveling_flag = true; mesh_bed_leveling_flag = true;
#ifndef PINDA_THERMISTOR
static bool run = false; static bool run = false;
#endif // ndef PINDA_THERMISTOR
#ifdef SUPPORT_VERBOSITY #ifdef SUPPORT_VERBOSITY
int8_t verbosity_level = 0; int8_t verbosity_level = 0;
@ -4665,13 +4670,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
} }
bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0); bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0);
bool temp_comp_start = true; #ifndef PINDA_THERMISTOR
#ifdef PINDA_THERMISTOR if (run == false && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50)
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 != LcdCommands::StopPrint) { if (lcd_commands_type != LcdCommands::StopPrint) {
temp_compensation_start(); temp_compensation_start();
run = true; run = true;
@ -4683,7 +4684,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
} }
break; break;
} }
run = false; run = false;
#endif //PINDA_THERMISTOR
if (lcd_commands_type == LcdCommands::StopPrint) { if (lcd_commands_type == LcdCommands::StopPrint) {
mesh_bed_leveling_flag = false; mesh_bed_leveling_flag = false;
break; break;
@ -4900,12 +4902,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
clean_up_after_endstop_move(l_feedmultiply); clean_up_after_endstop_move(l_feedmultiply);
// SERIAL_ECHOLNPGM("clean up finished "); // SERIAL_ECHOLNPGM("clean up finished ");
bool apply_temp_comp = true; #ifndef PINDA_THERMISTOR
#ifdef PINDA_THERMISTOR
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 if(temp_cal_active == true && calibration_status_pinda() == true) temp_compensation_apply(); //apply PINDA temperature compensation
#endif
babystep_apply(); // Apply Z height correction aka baby stepping before mesh bed leveing gets activated. babystep_apply(); // Apply Z height correction aka baby stepping before mesh bed leveing gets activated.
// SERIAL_ECHOLNPGM("babystep applied"); // SERIAL_ECHOLNPGM("babystep applied");
bool eeprom_bed_correction_valid = eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1; bool eeprom_bed_correction_valid = eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1;
@ -9354,7 +9353,8 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
} }
#endif //HEATBED_ANALYSIS #endif //HEATBED_ANALYSIS
void temp_compensation_start() { #ifndef PINDA_THERMISTOR
static void temp_compensation_start() {
custom_message_type = CustomMsg::TempCompPreheat; custom_message_type = CustomMsg::TempCompPreheat;
custom_message_state = PINDA_HEAT_T + 1; custom_message_state = PINDA_HEAT_T + 1;
@ -9381,7 +9381,7 @@ void temp_compensation_start() {
custom_message_state = 0; custom_message_state = 0;
} }
void temp_compensation_apply() { static void temp_compensation_apply() {
int i_add; int i_add;
int z_shift = 0; int z_shift = 0;
float z_shift_mm; float z_shift_mm;
@ -9404,6 +9404,7 @@ void temp_compensation_apply() {
//we have no temp compensation data //we have no temp compensation data
} }
} }
#endif //ndef PINDA_THERMISTOR
float temp_comp_interpolation(float inp_temperature) { float temp_comp_interpolation(float inp_temperature) {

View file

@ -1565,7 +1565,9 @@ extern "C" {
void adc_ready(void) //callback from adc when sampling finished void adc_ready(void) //callback from adc when sampling finished
{ {
current_temperature_raw[0] = adc_values[ADC_PIN_IDX(TEMP_0_PIN)]; //heater current_temperature_raw[0] = adc_values[ADC_PIN_IDX(TEMP_0_PIN)]; //heater
#ifdef PINDA_THERMISTOR
current_temperature_raw_pinda_fast = adc_values[ADC_PIN_IDX(TEMP_PINDA_PIN)]; current_temperature_raw_pinda_fast = adc_values[ADC_PIN_IDX(TEMP_PINDA_PIN)];
#endif //PINDA_THERMISTOR
current_temperature_bed_raw = adc_values[ADC_PIN_IDX(TEMP_BED_PIN)]; current_temperature_bed_raw = adc_values[ADC_PIN_IDX(TEMP_BED_PIN)];
#ifdef VOLT_PWR_PIN #ifdef VOLT_PWR_PIN
current_voltage_raw_pwr = adc_values[ADC_PIN_IDX(VOLT_PWR_PIN)]; current_voltage_raw_pwr = adc_values[ADC_PIN_IDX(VOLT_PWR_PIN)];

View file

@ -1863,11 +1863,11 @@ static void lcd_menu_temperatures()
lcd_timeoutToStatus.stop(); //infinite timeout lcd_timeoutToStatus.stop(); //infinite timeout
lcd_home(); lcd_home();
lcd_printf_P(PSTR(" %S: %d%c \n" " %S: %d%c \n"), _i("Nozzle"), (int)current_temperature[0], '\x01', _i("Bed"), (int)current_temperature_bed, '\x01'); lcd_printf_P(PSTR(" %S: %d%c \n" " %S: %d%c \n"), _i("Nozzle"), (int)current_temperature[0], '\x01', _i("Bed"), (int)current_temperature_bed, '\x01');
#ifdef AMBIENT_THERMISTOR #if defined (AMBIENT_THERMISTOR) && defined (PINDA_THERMISTOR)
lcd_printf_P(PSTR(" %S: %d%c\n" " PINDA: %d%c"), _i("Ambient"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01'); lcd_printf_P(PSTR(" %S: %d%c\n" " PINDA: %d%c"), _i("Ambient"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01');
#else //AMBIENT_THERMISTOR #elif defined (PINDA_THERMISTOR)
lcd_printf_P(PSTR(" PINDA: %d%c"), (int)current_temperature_pinda, '\x01'); lcd_printf_P(PSTR(" PINDA: %d%c"), (int)current_temperature_pinda, '\x01');
#endif //AMBIENT_THERMISTOR #endif
menu_back_if_clicked(); menu_back_if_clicked();
} }
@ -2969,9 +2969,11 @@ static void lcd_babystep_z()
eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte( eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte(
&(EEPROM_Sheets_base->active_sheet)))].bed_temp), &(EEPROM_Sheets_base->active_sheet)))].bed_temp),
target_temperature_bed); target_temperature_bed);
#ifdef PINDA_THERMISTOR
eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte( eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte(
&(EEPROM_Sheets_base->active_sheet)))].pinda_temp), &(EEPROM_Sheets_base->active_sheet)))].pinda_temp),
current_temperature_pinda); current_temperature_pinda);
#endif //PINDA_THERMISTOR
calibration_status_store(CALIBRATION_STATUS_CALIBRATED); calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
} }
if (LCD_CLICKED) menu_back(); if (LCD_CLICKED) menu_back();
@ -3140,6 +3142,7 @@ void lcd_adjust_z() {
}*/ }*/
#ifdef PINDA_THERMISTOR
bool lcd_wait_for_pinda(float temp) { bool lcd_wait_for_pinda(float temp) {
lcd_set_custom_characters_degree(); lcd_set_custom_characters_degree();
setAllTargetHotends(0); setAllTargetHotends(0);
@ -3168,6 +3171,7 @@ bool lcd_wait_for_pinda(float temp) {
lcd_update_enable(true); lcd_update_enable(true);
return target_temp_reached; return target_temp_reached;
} }
#endif //PINDA_THERMISTOR
void lcd_wait_for_heater() { void lcd_wait_for_heater() {
lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING)); lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING));

View file

@ -197,7 +197,9 @@ void lcd_wait_for_cool_down();
void lcd_extr_cal_reset(); void lcd_extr_cal_reset();
void lcd_temp_cal_show_result(bool result); void lcd_temp_cal_show_result(bool result);
#ifdef PINDA_THERMISTOR
bool lcd_wait_for_pinda(float temp); bool lcd_wait_for_pinda(float temp);
#endif //PINDA_THERMISTOR
void bowden_menu(); void bowden_menu();