Voltage measurement - conditional translation

This commit is contained in:
Robert Pelnar 2018-02-08 21:07:17 +01:00
parent af48be7653
commit 31e6271b2c
4 changed files with 25 additions and 4 deletions

View File

@ -397,9 +397,18 @@ const char* dcode_9_ADC_name(uint8_t i)
extern int current_temperature_raw[EXTRUDERS]; extern int current_temperature_raw[EXTRUDERS];
extern int current_temperature_bed_raw; extern int current_temperature_bed_raw;
extern int current_temperature_raw_pinda; extern int current_temperature_raw_pinda;
#ifdef AMBIENT_THERMISTOR
extern int current_temperature_raw_ambient; extern int current_temperature_raw_ambient;
#endif //AMBIENT_THERMISTOR
#ifdef VOLT_PWR_PIN
extern int current_voltage_raw_pwr; extern int current_voltage_raw_pwr;
#endif //VOLT_PWR_PIN
#ifdef VOLT_BED_PIN
extern int current_voltage_raw_bed; extern int current_voltage_raw_bed;
#endif //VOLT_BED_PIN
uint16_t dcode_9_ADC_val(uint8_t i) uint16_t dcode_9_ADC_val(uint8_t i)
{ {
@ -411,11 +420,13 @@ uint16_t dcode_9_ADC_val(uint8_t i)
case 3: return current_temperature_raw_pinda; case 3: return current_temperature_raw_pinda;
#ifdef VOLT_PWR_PIN #ifdef VOLT_PWR_PIN
case 4: return current_voltage_raw_pwr; case 4: return current_voltage_raw_pwr;
case 6: return current_voltage_raw_bed;
#endif //VOLT_PWR_PIN #endif //VOLT_PWR_PIN
#ifdef AMBIENT_THERMISTOR #ifdef AMBIENT_THERMISTOR
case 5: return current_temperature_raw_ambient; case 5: return current_temperature_raw_ambient;
#endif //AMBIENT_THERMISTOR #endif //AMBIENT_THERMISTOR
#ifdef VOLT_BED_PIN
case 6: return current_voltage_raw_bed;
#endif //VOLT_BED_PIN
} }
return 0; return 0;
} }

View File

@ -63,8 +63,6 @@
#define TEMP_PINDA_PIN 3 //A3 #define TEMP_PINDA_PIN 3 //A3
#define VOLT_PWR_PIN 4 //A4
#define VOLT_BED_PIN 9 //A9
#define E0_STEP_PIN 34 #define E0_STEP_PIN 34

View File

@ -1554,11 +1554,15 @@ void adc_ready(void) //callback from adc when sampling finished
current_temperature_raw[0] = adc_values[0]; current_temperature_raw[0] = adc_values[0];
current_temperature_bed_raw = adc_values[2]; current_temperature_bed_raw = adc_values[2];
current_temperature_raw_pinda = adc_values[3]; current_temperature_raw_pinda = adc_values[3];
#ifdef VOLT_PWR_PIN
current_voltage_raw_pwr = adc_values[4]; current_voltage_raw_pwr = adc_values[4];
#endif
#ifdef AMBIENT_THERMISTOR #ifdef AMBIENT_THERMISTOR
current_temperature_raw_ambient = adc_values[5]; current_temperature_raw_ambient = adc_values[5];
#endif //AMBIENT_THERMISTOR #endif //AMBIENT_THERMISTOR
#ifdef VOLT_BED_PIN
current_voltage_raw_bed = adc_values[6]; current_voltage_raw_bed = adc_values[6];
#endif
temp_meas_ready = true; temp_meas_ready = true;
} }

View File

@ -1620,6 +1620,7 @@ static void lcd_menu_temperatures()
} }
} }
#ifdef defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
#define VOLT_DIV_R1 10000 #define VOLT_DIV_R1 10000
#define VOLT_DIV_R2 2370 #define VOLT_DIV_R2 2370
#define VOLT_DIV_FAC ((float)VOLT_DIV_R2 / (VOLT_DIV_R2 + VOLT_DIV_R1)) #define VOLT_DIV_FAC ((float)VOLT_DIV_R2 / (VOLT_DIV_R2 + VOLT_DIV_R1))
@ -1636,7 +1637,9 @@ static void lcd_menu_voltages()
lcd_return_to_status(); lcd_return_to_status();
} }
} }
#endif //defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
#ifdef TMC2130
static void lcd_menu_belt_status() static void lcd_menu_belt_status()
{ {
fprintf_P(lcdout, PSTR(ESC_H(1,0) "Belt status" ESC_H(2,1) "X %d" ESC_H(2,2) "Y %d" ), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y))); fprintf_P(lcdout, PSTR(ESC_H(1,0) "Belt status" ESC_H(2,1) "X %d" ESC_H(2,2) "Y %d" ), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y)));
@ -1646,6 +1649,7 @@ static void lcd_menu_belt_status()
lcd_return_to_status(); lcd_return_to_status();
} }
} }
#endif //TMC2130
extern void stop_and_save_print_to_ram(float z_move, float e_move); extern void stop_and_save_print_to_ram(float z_move, float e_move);
extern void restore_print_from_ram_and_continue(float e_move); extern void restore_print_from_ram_and_continue(float e_move);
@ -1739,11 +1743,15 @@ static void lcd_support_menu()
if (!IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) MENU_ITEM(function, MSG_XYZ_DETAILS, lcd_service_mode_show_result); if (!IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) MENU_ITEM(function, MSG_XYZ_DETAILS, lcd_service_mode_show_result);
MENU_ITEM(submenu, MSG_INFO_EXTRUDER, lcd_menu_extruder_info); MENU_ITEM(submenu, MSG_INFO_EXTRUDER, lcd_menu_extruder_info);
#ifdef TMC2130
MENU_ITEM(submenu, MSG_MENU_BELT_STATUS, lcd_menu_belt_status); MENU_ITEM(submenu, MSG_MENU_BELT_STATUS, lcd_menu_belt_status);
#endif //TMC2130
MENU_ITEM(submenu, MSG_MENU_TEMPERATURES, lcd_menu_temperatures); MENU_ITEM(submenu, MSG_MENU_TEMPERATURES, lcd_menu_temperatures);
#ifdef defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
MENU_ITEM(submenu, MSG_MENU_VOLTAGES, lcd_menu_voltages); MENU_ITEM(submenu, MSG_MENU_VOLTAGES, lcd_menu_voltages);
#endif //defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
#ifdef DEBUG_BUILD #ifdef DEBUG_BUILD
MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug); MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug);