🎨 Check flags without ENABLED

This commit is contained in:
Scott Lahteine 2021-07-09 17:09:58 -05:00
parent fea4e06484
commit 78c2eb6876
31 changed files with 90 additions and 90 deletions

View file

@ -135,7 +135,7 @@
#include "module/servo.h"
#endif
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
#include "feature/dac/stepper_dac.h"
#endif
@ -1355,7 +1355,7 @@ void setup() {
SETUP_RUN(digipot_i2c.init());
#endif
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
SETUP_RUN(stepper_dac.init());
#endif

View file

@ -307,7 +307,7 @@ void unified_bed_leveling::G29() {
const uint8_t p_val = parser.byteval('P');
const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen_test('J');
#if ENABLED(HAS_MULTI_HOTEND)
#if HAS_MULTI_HOTEND
const uint8_t old_tool_index = active_extruder;
#endif

View file

@ -32,7 +32,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
#include "dac_mcp4728.h"

View file

@ -26,7 +26,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
#include "stepper_dac.h"
#include "../../MarlinCore.h" // for SP_X_LBL...

View file

@ -32,13 +32,13 @@
class Joystick {
friend class Temperature;
private:
#if ENABLED(HAS_JOY_ADC_X)
#if HAS_JOY_ADC_X
static temp_info_t x;
#endif
#if ENABLED(HAS_JOY_ADC_Y)
#if HAS_JOY_ADC_Y
static temp_info_t y;
#endif
#if ENABLED(HAS_JOY_ADC_Z)
#if HAS_JOY_ADC_Z
static temp_info_t z;
#endif
public:

View file

@ -64,13 +64,13 @@ typedef struct {
Repeat stored_repeat;
#endif
#if ENABLED(HAS_HOME_OFFSET)
#if HAS_HOME_OFFSET
xyz_pos_t home_offset;
#endif
#if ENABLED(HAS_POSITION_SHIFT)
#if HAS_POSITION_SHIFT
xyz_pos_t position_shift;
#endif
#if ENABLED(HAS_MULTI_EXTRUDER)
#if HAS_MULTI_EXTRUDER
uint8_t active_extruder;
#endif
@ -78,13 +78,13 @@ typedef struct {
float filament_size[EXTRUDERS];
#endif
#if ENABLED(HAS_HOTEND)
#if HAS_HOTEND
celsius_t target_temperature[HOTENDS];
#endif
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
celsius_t target_temperature_bed;
#endif
#if ENABLED(HAS_FAN)
#if HAS_FAN
uint8_t fan_speed[FAN_COUNT];
#endif

View file

@ -363,7 +363,7 @@ void test_tmc_connection(LOGICAL_AXIS_DECL(const bool, true));
struct motion_state_t {
xy_ulong_t acceleration;
#if ENABLED(HAS_CLASSIC_JERK)
#if HAS_CLASSIC_JERK
xy_float_t jerk_state;
#endif
};

View file

@ -63,7 +63,7 @@ enum CalEnum : char { // the 7 main calibration points -
#define LOOP_CAL_RAD(VAR) LOOP_CAL_PT(VAR, __A, _7P_STEP)
#define LOOP_CAL_ACT(VAR, _4P, _OP) LOOP_CAL_PT(VAR, _OP ? _AB : __A, _4P ? _4P_STEP : _7P_STEP)
#if ENABLED(HAS_MULTI_HOTEND)
#if HAS_MULTI_HOTEND
const uint8_t old_tool_index = active_extruder;
#endif

View file

@ -81,11 +81,11 @@ void GcodeSuite::G34() {
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
const uint32_t previous_current = stepper.motor_current_setting[Z_AXIS];
stepper.set_digipot_current(1, target_current);
#elif ENABLED(HAS_MOTOR_CURRENT_DAC)
#elif HAS_MOTOR_CURRENT_DAC
const float target_current = parser.floatval('S', GANTRY_CALIBRATION_CURRENT);
const float previous_current = dac_amps(Z_AXIS, target_current);
stepper_dac.set_current_value(Z_AXIS, target_current);
#elif ENABLED(HAS_MOTOR_CURRENT_I2C)
#elif HAS_MOTOR_CURRENT_I2C
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
previous_current = dac_amps(Z_AXIS);
digipot_i2c.set_current(Z_AXIS, target_current)
@ -127,9 +127,9 @@ void GcodeSuite::G34() {
stepper.set_digipot_current(Z_AXIS, previous_current);
#elif HAS_MOTOR_CURRENT_PWM
stepper.set_digipot_current(1, previous_current);
#elif ENABLED(HAS_MOTOR_CURRENT_DAC)
#elif HAS_MOTOR_CURRENT_DAC
stepper_dac.set_current_value(Z_AXIS, previous_current);
#elif ENABLED(HAS_MOTOR_CURRENT_I2C)
#elif HAS_MOTOR_CURRENT_I2C
digipot_i2c.set_current(Z_AXIS, previous_current)
#elif HAS_TRINAMIC_CONFIG
#if AXIS_IS_TMC(Z)

View file

@ -34,7 +34,7 @@
#include "../../../feature/digipot/digipot.h"
#endif
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
#include "../../../feature/dac/stepper_dac.h"
#endif
@ -73,7 +73,7 @@ void GcodeSuite::M907() {
#endif
#endif
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
if (parser.seenval('S')) {
const float dac_percent = parser.value_float();
LOOP_LE_N(i, 4) stepper_dac.set_current_percent(i, dac_percent);
@ -92,7 +92,7 @@ void GcodeSuite::M907() {
TERN_(HAS_MOTOR_CURRENT_DAC, stepper_dac.set_current_value(parser.byteval('P', -1), parser.ushortval('S', 0)));
}
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
void GcodeSuite::M909() { stepper_dac.print_values(); }
void GcodeSuite::M910() { stepper_dac.commit_eeprom(); }

View file

@ -908,7 +908,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes.
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
case 908: M908(); break; // M908: Control digital trimpot directly.
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
case 909: M909(); break; // M909: Print digipot/DAC current value
case 910: M910(); break; // M910: Commit digipot/DAC value to external EEPROM
#endif

View file

@ -524,7 +524,7 @@ private:
static void G38(const int8_t subcode);
#endif
#if ENABLED(HAS_MESH)
#if HAS_MESH
static void G42();
#endif
@ -557,7 +557,7 @@ private:
static void G425();
#endif
#if ENABLED(HAS_RESUME_CONTINUE)
#if HAS_RESUME_CONTINUE
static void M0_M1();
#endif
@ -612,7 +612,7 @@ private:
static void M31();
#if ENABLED(SDSUPPORT)
#if ENABLED(HAS_MEDIA_SUBCALLS)
#if HAS_MEDIA_SUBCALLS
static void M32();
#endif
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
@ -743,7 +743,7 @@ private:
static void M149();
#endif
#if ENABLED(HAS_COLOR_LEDS)
#if HAS_COLOR_LEDS
static void M150();
#endif
@ -777,7 +777,7 @@ private:
static void M204();
static void M205();
#if ENABLED(HAS_M206_COMMAND)
#if HAS_M206_COMMAND
static void M206();
#endif
@ -791,11 +791,11 @@ private:
static void M211();
#if ENABLED(HAS_MULTI_EXTRUDER)
#if HAS_MULTI_EXTRUDER
static void M217();
#endif
#if ENABLED(HAS_HOTEND_OFFSET)
#if HAS_HOTEND_OFFSET
static void M218();
#endif
@ -813,7 +813,7 @@ private:
static void M240();
#endif
#if ENABLED(HAS_LCD_CONTRAST)
#if HAS_LCD_CONTRAST
static void M250();
#endif
@ -833,7 +833,7 @@ private:
static void M290();
#endif
#if ENABLED(HAS_BUZZER)
#if HAS_BUZZER
static void M300();
#endif
@ -845,7 +845,7 @@ private:
static void M302();
#endif
#if ENABLED(HAS_PID_HEATING)
#if HAS_PID_HEATING
static void M303();
#endif
@ -853,7 +853,7 @@ private:
static void M304();
#endif
#if ENABLED(HAS_USER_THERMISTORS)
#if HAS_USER_THERMISTORS
static void M305();
#endif
@ -894,7 +894,7 @@ private:
static void M402();
#endif
#if ENABLED(HAS_PRUSA_MMU2)
#if HAS_PRUSA_MMU2
static void M403();
#endif
@ -905,11 +905,11 @@ private:
static void M407();
#endif
#if ENABLED(HAS_FILAMENT_SENSOR)
#if HAS_FILAMENT_SENSOR
static void M412();
#endif
#if ENABLED(HAS_MULTI_LANGUAGE)
#if HAS_MULTI_LANGUAGE
static void M414();
#endif
@ -922,11 +922,11 @@ private:
static void M425();
#endif
#if ENABLED(HAS_M206_COMMAND)
#if HAS_M206_COMMAND
static void M428();
#endif
#if ENABLED(HAS_POWER_MONITOR)
#if HAS_POWER_MONITOR
static void M430();
#endif
@ -977,11 +977,11 @@ private:
static void M603();
#endif
#if ENABLED(HAS_DUPLICATION_MODE)
#if HAS_DUPLICATION_MODE
static void M605();
#endif
#if ENABLED(IS_KINEMATIC)
#if IS_KINEMATIC
static void M665();
#endif
@ -1006,7 +1006,7 @@ private:
static void M810_819();
#endif
#if ENABLED(HAS_BED_PROBE)
#if HAS_BED_PROBE
static void M851();
#endif
@ -1039,7 +1039,7 @@ private:
#if HAS_TRINAMIC_CONFIG
static void M122();
static void M906();
#if ENABLED(HAS_STEALTHCHOP)
#if HAS_STEALTHCHOP
static void M569();
#endif
#if ENABLED(MONITOR_DRIVER_STATUS)
@ -1066,7 +1066,7 @@ private:
static void M907();
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
static void M908();
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
static void M909();
static void M910();
#endif

View file

@ -59,7 +59,7 @@ public:
struct CommandLine {
char buffer[MAX_CMD_SIZE]; //!< The command buffer
bool skip_ok; //!< Skip sending ok when command is processed?
#if ENABLED(HAS_MULTI_SERIAL)
#if HAS_MULTI_SERIAL
serial_index_t port; //!< Serial port the command was received on
#endif
};

View file

@ -536,7 +536,7 @@ 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;
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
bool bed_show_target : 1;
#endif
} display_state = {

View file

@ -182,10 +182,10 @@ static uint8_t _card_percent = 0;
static uint16_t _remain_time = 0;
#if ENABLED(PAUSE_HEAT)
#if ENABLED(HAS_HOTEND)
#if HAS_HOTEND
uint16_t resume_hotend_temp = 0;
#endif
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
uint16_t resume_bed_temp = 0;
#endif
#endif

View file

@ -255,13 +255,13 @@ extern char print_filename[16];
extern millis_t dwin_heat_time;
typedef struct {
#if ENABLED(HAS_HOTEND)
#if HAS_HOTEND
celsius_t E_Temp = 0;
#endif
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
celsius_t Bed_Temp = 0;
#endif
#if ENABLED(HAS_FAN)
#if HAS_FAN
int16_t Fan_speed = 0;
#endif
int16_t print_speed = 100;
@ -344,13 +344,13 @@ void HMI_Move_E();
void HMI_Zoffset();
#if ENABLED(HAS_HOTEND)
#if HAS_HOTEND
void HMI_ETemp();
#endif
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
void HMI_BedTemp();
#endif
#if ENABLED(HAS_FAN)
#if HAS_FAN
void HMI_FanSpeed();
#endif

View file

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

View file

@ -35,7 +35,7 @@
#include "../../ui_api.h"
#include "../../../marlinui.h"
#if ENABLED(HAS_STEALTHCHOP)
#if HAS_STEALTHCHOP
#include "../../../../module/stepper/trinamic.h"
#endif

View file

@ -37,7 +37,7 @@
#include "../../../../gcode/gcode.h"
#if ENABLED(HAS_STEALTHCHOP)
#if HAS_STEALTHCHOP
#include "../../../../module/stepper/trinamic.h"
#include "../../../../module/stepper/indirection.h"
#endif
@ -396,7 +396,7 @@ void DGUSScreenHandler::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr) {
void DGUSScreenHandler::GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr) {
#if ENABLED(HAS_BED_PROBE)
#if HAS_BED_PROBE
int32_t value = swap32(*(int32_t *)val_ptr);
float Offset = value / 100.0f;
DEBUG_ECHOLNPAIR_F("\nget int6 offset >> ", value, 6);

View file

@ -122,7 +122,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
case 2: GOTO_SCREEN(ZOffsetScreen); break;
#endif
case 3: GOTO_SCREEN(StepsScreen); break;
#if ENABLED(HAS_MULTI_HOTEND)
#if HAS_MULTI_HOTEND
case 4: GOTO_SCREEN(NozzleOffsetScreen); break;
#endif
case 5: GOTO_SCREEN(MaxVelocityScreen); break;

View file

@ -106,7 +106,7 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) {
#if EITHER(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION)
case 2: SpinnerDialogBox::enqueueAndWait_P(F("G34")); break;
#endif
#if ENABLED(HAS_BED_PROBE)
#if HAS_BED_PROBE
case 3:
#ifndef BED_LEVELING_COMMANDS
#define BED_LEVELING_COMMANDS "G29"

View file

@ -49,7 +49,7 @@ static lv_obj_t *labelPause, *labelStop, *labelOperat;
static lv_obj_t *bar1, *bar1ValueText;
static lv_obj_t *buttonPause, *buttonOperat, *buttonStop, *buttonExt1, *buttonExt2, *buttonBedstate, *buttonFanstate, *buttonZpos;
#if ENABLED(HAS_MULTI_EXTRUDER)
#if HAS_MULTI_EXTRUDER
static lv_obj_t *labelExt2;
#endif

View file

@ -178,10 +178,10 @@ namespace ExtUI {
#if HAS_HEATED_BED
case BED: thermalManager.reset_bed_idle_timer(); return;
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
#if HAS_HEATED_CHAMBER
case CHAMBER: return; // Chamber has no idle timer
#endif
#if ENABLED(HAS_COOLER)
#if HAS_COOLER
case COOLER: return; // Cooler has no idle timer
#endif
default:
@ -241,10 +241,10 @@ namespace ExtUI {
bool isHeaterIdle(const heater_t heater) {
#if HEATER_IDLE_HANDLER
switch (heater) {
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
case BED: return thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out;
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
#if HAS_HEATED_CHAMBER
case CHAMBER: return false; // Chamber has no idle timer
#endif
default:
@ -264,10 +264,10 @@ namespace ExtUI {
celsius_float_t getActualTemp_celsius(const heater_t heater) {
switch (heater) {
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed());
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
#if HAS_HEATED_CHAMBER
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber());
#endif
default: return GET_TEMP_ADJUSTMENT(thermalManager.degHotend(heater - H0));
@ -280,10 +280,10 @@ namespace ExtUI {
celsius_float_t getTargetTemp_celsius(const heater_t heater) {
switch (heater) {
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed());
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
#if HAS_HEATED_CHAMBER
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber());
#endif
default: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetHotend(heater - H0));

View file

@ -111,13 +111,13 @@
#if PREHEAT_COUNT
typedef struct {
#if ENABLED(HAS_HOTEND)
#if HAS_HOTEND
celsius_t hotend_temp;
#endif
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
celsius_t bed_temp;
#endif
#if ENABLED(HAS_FAN)
#if HAS_FAN
uint16_t fan_speed;
#endif
} preheat_t;
@ -135,12 +135,12 @@
static int8_t constexpr e_index = 0;
#endif
static millis_t start_time;
#if ENABLED(IS_KINEMATIC)
#if IS_KINEMATIC
static xyze_pos_t all_axes_destination;
#endif
public:
static float menu_scale;
#if ENABLED(IS_KINEMATIC)
#if IS_KINEMATIC
static float offset;
#endif
template <typename T>

View file

@ -58,7 +58,7 @@
void menu_tmc();
void menu_backlash();
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
#include "../../feature/dac/stepper_dac.h"
@ -590,7 +590,7 @@ void menu_advanced_settings() {
SUBMENU(MSG_BACKLASH, menu_backlash);
#endif
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
#if HAS_MOTOR_CURRENT_DAC
SUBMENU(MSG_DRIVE_STRENGTH, menu_dac);
#endif
#if HAS_MOTOR_CURRENT_PWM

View file

@ -3818,10 +3818,10 @@ void MarlinSettings::reset() {
SERIAL_CHAR(' ', 'B'); // B (maps to E1 by default)
SERIAL_ECHOLN(stepper.motor_current_setting[4]);
#endif
#elif ENABLED(HAS_MOTOR_CURRENT_I2C) // i2c-based has any number of values
#elif HAS_MOTOR_CURRENT_I2C // i2c-based has any number of values
// Values sent over i2c are not stored.
// Indexes map directly to drivers, not axes.
#elif ENABLED(HAS_MOTOR_CURRENT_DAC) // DAC-based has 4 values, for X Y Z (I J K) E
#elif HAS_MOTOR_CURRENT_DAC // DAC-based has 4 values, for X Y Z (I J K) E
// Values sent over i2c are not stored. Uses indirect mapping.
#endif

View file

@ -340,16 +340,16 @@ class Temperature {
static const celsius_t hotend_maxtemp[HOTENDS];
static inline celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
#endif
#if ENABLED(HAS_HEATED_BED)
#if HAS_HEATED_BED
static bed_info_t temp_bed;
#endif
#if ENABLED(HAS_TEMP_PROBE)
#if HAS_TEMP_PROBE
static probe_info_t temp_probe;
#endif
#if ENABLED(HAS_TEMP_CHAMBER)
#if HAS_TEMP_CHAMBER
static chamber_info_t temp_chamber;
#endif
#if ENABLED(HAS_TEMP_COOLER)
#if HAS_TEMP_COOLER
static cooler_info_t temp_cooler;
#endif
#if HAS_TEMP_REDUNDANT
@ -441,7 +441,7 @@ class Temperature {
static lpq_ptr_t lpq_ptr;
#endif
#if ENABLED(HAS_HOTEND)
#if HAS_HOTEND
static temp_range_t temp_range[HOTENDS];
#endif
@ -477,7 +477,7 @@ class Temperature {
static millis_t preheat_end_time[HOTENDS];
#endif
#if ENABLED(HAS_AUTO_FAN)
#if HAS_AUTO_FAN
static millis_t next_auto_fan_check_ms;
#endif
@ -920,7 +920,7 @@ class Temperature {
static void checkExtruderAutoFans();
#if ENABLED(HAS_HOTEND)
#if HAS_HOTEND
static float get_pid_output_hotend(const uint8_t e);
#endif
#if ENABLED(PIDTEMPBED)

View file

@ -51,7 +51,7 @@
//
// DAC steppers
//
#define HAS_MOTOR_CURRENT_DAC
#define HAS_MOTOR_CURRENT_DAC 1
#define DAC_STEPPER_ORDER { 0, 1, 2, 3 }

View file

@ -34,7 +34,7 @@
//
// I2C based DAC like on the Printrboard REVF
#define HAS_MOTOR_CURRENT_DAC
#define HAS_MOTOR_CURRENT_DAC 1
// Channels available for DAC, For Rigidboard there are 4
#define DAC_STEPPER_ORDER { 0, 1, 2, 3 }

View file

@ -141,7 +141,7 @@
#endif // NO_EXTRUDRBOARD
// Enable control of stepper motor currents with the I2C based MCP4728 DAC used on Printrboard REVF
#define HAS_MOTOR_CURRENT_DAC
#define HAS_MOTOR_CURRENT_DAC 1
// Set default drive strength percents if not already defined - X, Y, Z, E axis
#ifndef DAC_MOTOR_CURRENT_DEFAULT

View file

@ -1123,7 +1123,7 @@ void CardReader::cdroot() {
#if DISABLED(SDSORT_USES_RAM)
selectFileByIndex(o1); // Pre-fetch the first entry and save it
strcpy(name1, longest_filename()); // so the loop only needs one fetch
#if ENABLED(HAS_FOLDER_SORTING)
#if HAS_FOLDER_SORTING
bool dir1 = flag.filenameIsDir;
#endif
#endif