More IntelliSense-friendly declarations

This commit is contained in:
Scott Lahteine
2021-03-24 05:40:28 -05:00
committed by Scott Lahteine
parent da4b6896f7
commit 2d2291d00e
32 changed files with 562 additions and 203 deletions

View File

@ -536,7 +536,9 @@ void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool
static struct {
bool E1_show_target : 1;
bool E2_show_target : 1;
TERN_(HAS_HEATED_BED, bool bed_show_target : 1);
#if ENABLED(HAS_HEATED_BED)
bool bed_show_target : 1;
#endif
} display_state = {
true, true, TERN_(HAS_HEATED_BED, true)
};

View File

@ -180,8 +180,12 @@ static uint8_t _card_percent = 0;
static uint16_t _remain_time = 0;
#if ENABLED(PAUSE_HEAT)
TERN_(HAS_HOTEND, uint16_t resume_hotend_temp = 0);
TERN_(HAS_HEATED_BED, uint16_t resume_bed_temp = 0);
#if ENABLED(HAS_HOTEND)
uint16_t resume_hotend_temp = 0;
#endif
#if ENABLED(HAS_HEATED_BED)
uint16_t resume_bed_temp = 0;
#endif
#endif
#if HAS_ZOFFSET_ITEM

View File

@ -234,9 +234,15 @@ extern char print_filename[16];
extern millis_t dwin_heat_time;
typedef struct {
TERN_(HAS_HOTEND, celsius_t E_Temp = 0);
TERN_(HAS_HEATED_BED, celsius_t Bed_Temp = 0);
TERN_(HAS_FAN, int16_t Fan_speed = 0);
#if ENABLED(HAS_HOTEND)
celsius_t E_Temp = 0;
#endif
#if ENABLED(HAS_HEATED_BED)
celsius_t Bed_Temp = 0;
#endif
#if ENABLED(HAS_FAN)
int16_t Fan_speed = 0;
#endif
int16_t print_speed = 100;
float Max_Feedspeed = 0;
float Max_Acceleration = 0;
@ -312,9 +318,15 @@ void HMI_Move_E();
void HMI_Zoffset();
TERN_(HAS_HOTEND, void HMI_ETemp());
TERN_(HAS_HEATED_BED, void HMI_BedTemp());
TERN_(HAS_FAN, void HMI_FanSpeed());
#if ENABLED(HAS_HOTEND)
void HMI_ETemp();
#endif
#if ENABLED(HAS_HEATED_BED)
void HMI_BedTemp();
#endif
#if ENABLED(HAS_FAN)
void HMI_FanSpeed();
#endif
void HMI_PrintSpeed();

View File

@ -624,7 +624,9 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
DEBUG_ECHOLNPGM("HandlePreheat");
uint8_t e_temp = 0;
TERN_(HAS_HEATED_BED, uint8_t bed_temp = 0);
#if ENABLED(HAS_HEATED_BED)
uint8_t bed_temp = 0;
#endif
const uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
switch (preheat_option) {
default:

View File

@ -49,7 +49,9 @@ static lv_obj_t *labelPause, *labelStop, *labelOperat;
static lv_obj_t *bar1, *bar1ValueText;
static lv_obj_t *buttonPause, *buttonOperat, *buttonStop;
TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2);
#if ENABLED(HAS_MULTI_EXTRUDER)
static lv_obj_t *labelExt2;
#endif
#if HAS_HEATED_BED
static lv_obj_t* labelBed;

View File

@ -103,8 +103,12 @@
namespace ExtUI {
static struct {
uint8_t printer_killed : 1;
TERN_(JOYSTICK, uint8_t jogging : 1);
TERN_(SDSUPPORT, uint8_t was_sd_printing : 1);
#if ENABLED(JOYSTICK)
uint8_t jogging : 1;
#endif
#if ENABLED(SDSUPPORT)
uint8_t was_sd_printing : 1;
#endif
} flags;
#ifdef __SAM3X8E__
@ -175,8 +179,12 @@ namespace ExtUI {
#if HAS_HEATED_BED
case BED: thermalManager.reset_bed_idle_timer(); return;
#endif
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return); // Chamber has no idle timer
TERN_(HAS_COOLER, case COOLER: return); // Cooler has no idle timer
#if ENABLED(HAS_HEATED_CHAMBER)
case CHAMBER: return; // Chamber has no idle timer
#endif
#if ENABLED(HAS_COOLER)
case COOLER: return; // Cooler has no idle timer
#endif
default:
TERN_(HAS_HOTEND, thermalManager.reset_hotend_idle_timer(heater - H0));
break;
@ -234,8 +242,12 @@ namespace ExtUI {
bool isHeaterIdle(const heater_t heater) {
#if HEATER_IDLE_HANDLER
switch (heater) {
TERN_(HAS_HEATED_BED, case BED: return thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out);
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return false); // Chamber has no idle timer
#if ENABLED(HAS_HEATED_BED)
case BED: return thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out;
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
case CHAMBER: return false; // Chamber has no idle timer
#endif
default:
return TERN0(HAS_HOTEND, thermalManager.heater_idle[heater - H0].timed_out);
}
@ -253,8 +265,12 @@ namespace ExtUI {
float getActualTemp_celsius(const heater_t heater) {
switch (heater) {
TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed()));
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber()));
#if ENABLED(HAS_HEATED_BED)
case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed());
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber());
#endif
default: return GET_TEMP_ADJUSTMENT(thermalManager.degHotend(heater - H0));
}
}
@ -265,8 +281,12 @@ namespace ExtUI {
float getTargetTemp_celsius(const heater_t heater) {
switch (heater) {
TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed()));
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber()));
#if ENABLED(HAS_HEATED_BED)
case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed());
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber());
#endif
default: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetHotend(heater - H0));
}
}
@ -294,13 +314,13 @@ namespace ExtUI {
}
float getAxisPosition_mm(const axis_t axis) {
return TERN_(JOYSTICK, flags.jogging ? destination[axis] :) current_position[axis];
return TERN0(JOYSTICK, flags.jogging) ? destination[axis] : current_position[axis];
}
float getAxisPosition_mm(const extruder_t extruder) {
const extruder_t old_tool = getActiveTool();
setActiveTool(extruder, true);
const float epos = TERN_(JOYSTICK, flags.jogging ? destination.e :) current_position.e;
const float epos = TERN0(JOYSTICK, flags.jogging) ? destination.e : current_position.e;
setActiveTool(old_tool, true);
return epos;
}
@ -491,14 +511,30 @@ namespace ExtUI {
int getTMCBumpSensitivity(const axis_t axis) {
switch (axis) {
TERN_(X_SENSORLESS, case X: return stepperX.homing_threshold());
TERN_(X2_SENSORLESS, case X2: return stepperX2.homing_threshold());
TERN_(Y_SENSORLESS, case Y: return stepperY.homing_threshold());
TERN_(Y2_SENSORLESS, case Y2: return stepperY2.homing_threshold());
TERN_(Z_SENSORLESS, case Z: return stepperZ.homing_threshold());
TERN_(Z2_SENSORLESS, case Z2: return stepperZ2.homing_threshold());
TERN_(Z3_SENSORLESS, case Z3: return stepperZ3.homing_threshold());
TERN_(Z4_SENSORLESS, case Z4: return stepperZ4.homing_threshold());
#if ENABLED(X_SENSORLESS)
case X: return stepperX.homing_threshold();
#endif
#if ENABLED(X2_SENSORLESS)
case X2: return stepperX2.homing_threshold();
#endif
#if ENABLED(Y_SENSORLESS)
case Y: return stepperY.homing_threshold();
#endif
#if ENABLED(Y2_SENSORLESS)
case Y2: return stepperY2.homing_threshold();
#endif
#if ENABLED(Z_SENSORLESS)
case Z: return stepperZ.homing_threshold();
#endif
#if ENABLED(Z2_SENSORLESS)
case Z2: return stepperZ2.homing_threshold();
#endif
#if ENABLED(Z3_SENSORLESS)
case Z3: return stepperZ3.homing_threshold();
#endif
#if ENABLED(Z4_SENSORLESS)
case Z4: return stepperZ4.homing_threshold();
#endif
default: return 0;
}
}

View File

@ -688,7 +688,9 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
xyze_pos_t ManualMove::all_axes_destination = { 0 };
bool ManualMove::processing = false;
#endif
TERN_(MULTI_MANUAL, int8_t ManualMove::e_index = 0);
#if ENABLED(MULTI_MANUAL)
int8_t ManualMove::e_index = 0;
#endif
AxisEnum ManualMove::axis = NO_AXIS;
/**

View File

@ -105,9 +105,15 @@
#if PREHEAT_COUNT
typedef struct {
TERN_(HAS_HOTEND, celsius_t hotend_temp);
TERN_(HAS_HEATED_BED, celsius_t bed_temp );
TERN_(HAS_FAN, uint16_t fan_speed );
#if ENABLED(HAS_HOTEND)
celsius_t hotend_temp;
#endif
#if ENABLED(HAS_HEATED_BED)
celsius_t bed_temp;
#endif
#if ENABLED(HAS_FAN)
uint16_t fan_speed;
#endif
} preheat_t;
#endif
@ -123,10 +129,14 @@
static int8_t constexpr e_index = 0;
#endif
static millis_t start_time;
TERN_(IS_KINEMATIC, static xyze_pos_t all_axes_destination);
#if ENABLED(IS_KINEMATIC)
static xyze_pos_t all_axes_destination;
#endif
public:
static float menu_scale;
TERN_(IS_KINEMATIC, static float offset);
#if ENABLED(IS_KINEMATIC)
static float offset;
#endif
template <typename T>
void set_destination(const T& dest) {
#if IS_KINEMATIC

View File

@ -53,10 +53,18 @@
// Pool game data to save SRAM
union MarlinGameData {
TERN_(MARLIN_BRICKOUT, brickout_data_t brickout);
TERN_(MARLIN_INVADERS, invaders_data_t invaders);
TERN_(MARLIN_SNAKE, snake_data_t snake);
TERN_(MARLIN_MAZE, maze_data_t maze);
#if ENABLED(MARLIN_BRICKOUT)
brickout_data_t brickout;
#endif
#if ENABLED(MARLIN_INVADERS)
invaders_data_t invaders;
#endif
#if ENABLED(MARLIN_SNAKE)
snake_data_t snake;
#endif
#if ENABLED(MARLIN_MAZE)
maze_data_t maze;
#endif
};
extern MarlinGameData marlin_game_data;

View File

@ -119,7 +119,9 @@ void lcd_delta_settings() {
}
void menu_delta_calibrate() {
TERN_(DELTA_CALIBRATION_MENU, const bool all_homed = all_axes_homed()); // Acquire ahead of loop
#if ENABLED(DELTA_CALIBRATION_MENU)
const bool all_homed = all_axes_homed(); // Acquire ahead of loop
#endif
START_MENU();
BACK_ITEM(MSG_MAIN);

View File

@ -42,7 +42,9 @@
// Global storage
float z_offset_backup, calculated_z_offset, z_offset_ref;
TERN_(HAS_LEVELING, bool leveling_was_active);
#if ENABLED(HAS_LEVELING)
bool leveling_was_active;
#endif
inline void z_clearance_move() {
do_z_clearance(