Просмотр исходного кода

Voltage measurement - conditional translation

Robert Pelnar 6 лет назад
Родитель
Сommit
31e6271b2c
4 измененных файлов с 25 добавлено и 4 удалено
  1. 12 1
      Firmware/Dcodes.cpp
  2. 0 2
      Firmware/pins_Rambo_1_3.h
  3. 4 0
      Firmware/temperature.cpp
  4. 9 1
      Firmware/ultralcd.cpp

+ 12 - 1
Firmware/Dcodes.cpp

@@ -397,9 +397,18 @@ const char* dcode_9_ADC_name(uint8_t i)
 extern int current_temperature_raw[EXTRUDERS];
 extern int current_temperature_bed_raw;
 extern int current_temperature_raw_pinda;
+
+#ifdef AMBIENT_THERMISTOR
 extern int current_temperature_raw_ambient;
+#endif //AMBIENT_THERMISTOR
+
+#ifdef VOLT_PWR_PIN
 extern int current_voltage_raw_pwr;
+#endif //VOLT_PWR_PIN
+
+#ifdef VOLT_BED_PIN
 extern int current_voltage_raw_bed;
+#endif //VOLT_BED_PIN
 
 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;
 #ifdef VOLT_PWR_PIN
 	case 4: return current_voltage_raw_pwr;
-	case 6: return current_voltage_raw_bed;
 #endif //VOLT_PWR_PIN
 #ifdef AMBIENT_THERMISTOR
 	case 5: return current_temperature_raw_ambient;
 #endif //AMBIENT_THERMISTOR
+#ifdef VOLT_BED_PIN
+	case 6: return current_voltage_raw_bed;
+#endif //VOLT_BED_PIN
 	}
 	return 0;
 }

+ 0 - 2
Firmware/pins_Rambo_1_3.h

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

+ 4 - 0
Firmware/temperature.cpp

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

+ 9 - 1
Firmware/ultralcd.cpp

@@ -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_R2 2370
 #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();
     }
 }
+#endif //defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
 
+#ifdef TMC2130
 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)));
@@ -1646,6 +1649,7 @@ static void lcd_menu_belt_status()
         lcd_return_to_status();
     }
 }
+#endif //TMC2130
 
 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);
@@ -1738,12 +1742,16 @@ static void lcd_support_menu()
   MENU_ITEM(back, PSTR("------------"), lcd_main_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);
   MENU_ITEM(submenu, MSG_INFO_EXTRUDER, lcd_menu_extruder_info);
-    
+
+#ifdef TMC2130
   MENU_ITEM(submenu, MSG_MENU_BELT_STATUS, lcd_menu_belt_status);
+#endif //TMC2130
     
   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);
+#endif //defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
 
 #ifdef DEBUG_BUILD
   MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug);