0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-03-11 00:53:08 +00:00

🎨 Misc. format, cleanup

This commit is contained in:
Scott Lahteine 2024-08-15 23:48:27 -05:00
parent 986344640f
commit ecfff5099a
8 changed files with 46 additions and 42 deletions

View file

@ -841,8 +841,8 @@
// Lasko "MyHeat Personal Heater" (200w) modified with a Fotek SSR-10DA to control only the heating element
// and placed inside the small Creality printer enclosure tent.
//
#define DEFAULT_chamberKp 37.04
#define DEFAULT_chamberKi 1.40
#define DEFAULT_chamberKp 37.04
#define DEFAULT_chamberKi 1.40
#define DEFAULT_chamberKd 655.17
// M309 P37.04 I1.04 D655.17

View file

@ -40,7 +40,7 @@
#define PCT_TO_PWM(X) ((X) * 255 / 100)
#define PWM_TO_PCT(X) ((X) * 100 / 255)
#define PCT_TO_SERVO(X) ((X) * 180 / 100)
#define CUTTER_PWM_TO_SPWR(X) (CUTTER_UNIT_IS(PERCENT) ? PWM_TO_PCT(X) : (CUTTER_UNIT_IS(RPM) ? PWM_TO_RPM(X) : X))
#define CUTTER_PWM_TO_SPWR(X) (CUTTER_UNIT_IS(PERCENT) ? PWM_TO_PCT(X) : (CUTTER_UNIT_IS(RPM) ? PWM_TO_RPM(X) : X))
// Laser/Cutter operation mode
enum CutterMode : int8_t {

View file

@ -96,7 +96,7 @@ void GcodeSuite::M3_M4(const bool is_M4) {
}
else if (parser.seenval('O')) { // pwr in PWM units
const float v = parser.value_float();
cutter.menuPower = cutter.unitPower = CUTTER_PWM_TO_SPWR(constrain(v, 0, 255));
cutter.menuPower = cutter.unitPower = CUTTER_PWM_TO_SPWR(constrain(v, 0, 255));
}
else if (cutter.cutter_mode == CUTTER_MODE_STANDARD)
cutter.menuPower = cutter.unitPower = cutter.cpwr_to_upwr(SPEED_POWER_STARTUP);

View file

@ -540,7 +540,7 @@
#ifndef DEFAULT_chamberKd
#define DEFAULT_chamberKd 655.17
#endif
#endif
#endif
#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
#ifndef PID_FUNCTIONAL_RANGE
#define PID_FUNCTIONAL_RANGE 10
@ -920,7 +920,7 @@
#ifndef Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE
#define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_FEEDRATE
#endif
#endif
#endif
#ifndef NOZZLE_TO_PROBE_OFFSET
#define NOZZLE_TO_PROBE_OFFSET { 10, 10, 0 }
#endif
@ -1264,7 +1264,7 @@
#ifndef GRID_MAX_POINTS_Y
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
#endif
#endif
#endif
#if ENABLED(LCD_BED_LEVELING)
#ifndef MESH_EDIT_Z_STEP
#define MESH_EDIT_Z_STEP 0.025

View file

@ -696,7 +696,7 @@
#define BLTOUCH_HS_EXTRA_CLEARANCE 7
#endif
#endif
#endif
#endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
#ifndef Z_STEPPER_ALIGN_STEPPER_XY
#ifndef Z_STEPPER_ALIGN_AMP
@ -1072,7 +1072,7 @@
#ifndef MANUAL_MOVE_DISTANCE_DEG
#define MANUAL_MOVE_DISTANCE_DEG 90, 45, 22.5, 5, 1
#endif
#endif
#endif
#if HAS_DISPLAY
#ifndef SHOW_BOOTSCREEN
#define SHOW_BOOTSCREEN
@ -1129,7 +1129,7 @@
#endif
#endif
#endif
#endif
#endif
#if HAS_FEEDRATE_EDIT
#ifndef SPEED_EDIT_MIN
#define SPEED_EDIT_MIN 10
@ -1284,7 +1284,7 @@
#define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE
#endif
#endif
#endif
#endif
#if HAS_MARLINUI_U8GLIB
#ifndef XYZ_HOLLOW_FRAME
#define XYZ_HOLLOW_FRAME
@ -1308,7 +1308,7 @@
#ifndef STATUS_CHAMBER_ANIM
#define STATUS_CHAMBER_ANIM
#endif
#endif
#endif
#if HAS_MARLINUI_U8GLIB || IS_DWIN_MARLINUI
#ifndef MENU_HOLLOW_FRAME
#define MENU_HOLLOW_FRAME
@ -1378,7 +1378,7 @@
#define DGUS_USERCONFIRM
#endif
#endif
#endif
#endif
#if ENABLED(ANYCUBIC_LCD_CHIRON)
#ifndef AC_SD_FOLDER_VIEW
#define AC_SD_FOLDER_VIEW
@ -1529,7 +1529,7 @@
#define PTC_PROBE_HEATING_OFFSET 0.5
#endif
#endif
#endif
#endif
#ifndef ARC_SUPPORT
#define ARC_SUPPORT
#endif
@ -1667,7 +1667,7 @@
#define TOOLCHANGE_PARK_XY_FEEDRATE 6000
#endif
#endif
#endif
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#ifndef PAUSE_PARK_RETRACT_FEEDRATE
#define PAUSE_PARK_RETRACT_FEEDRATE 60
@ -2219,7 +2219,7 @@
#ifndef TMC_ADV
#define TMC_ADV () { }
#endif
#endif
#endif
#if ENABLED(EXPERIMENTAL_I2CBUS)
#ifndef I2C_SLAVE_ADDRESS
#define I2C_SLAVE_ADDRESS 0
@ -2353,7 +2353,7 @@
#endif
#endif
#endif
#endif
#endif
#if ENABLED(COOLANT_CONTROL)
#ifndef COOLANT_MIST
#define COOLANT_MIST
@ -2616,7 +2616,7 @@
#ifndef I2CPE_ERR_ROLLING_AVERAGE
#define I2CPE_ERR_ROLLING_AVERAGE
#endif
#endif
#endif
#if ENABLED(JOYSTICK)
#ifndef JOY_X_PIN
#define JOY_X_PIN 5
@ -2745,7 +2745,7 @@
#endif
#endif
#endif
#endif
#endif
#if ENABLED(PRINTCOUNTER)
#ifndef SERVICE_WARNING_BUZZES
#define SERVICE_WARNING_BUZZES 3

View file

@ -1447,14 +1447,18 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
* Check for improper PROBING_MARGIN
*/
#if NONE(NOZZLE_AS_PROBE, IS_KINEMATIC)
static_assert(PROBING_MARGIN >= 0, "PROBING_MARGIN must be >= 0.");
#ifdef PROBING_MARGIN
static_assert(PROBING_MARGIN >= 0, "PROBING_MARGIN must be >= 0.");
#endif
static_assert(PROBING_MARGIN_BACK >= 0, "PROBING_MARGIN_BACK must be >= 0.");
static_assert(PROBING_MARGIN_FRONT >= 0, "PROBING_MARGIN_FRONT must be >= 0.");
static_assert(PROBING_MARGIN_LEFT >= 0, "PROBING_MARGIN_LEFT must be >= 0.");
static_assert(PROBING_MARGIN_RIGHT >= 0, "PROBING_MARGIN_RIGHT must be >= 0.");
#endif
#define _MARGIN(A) TERN(IS_KINEMATIC, PRINTABLE_RADIUS, ((A##_BED_SIZE) / 2))
static_assert(PROBING_MARGIN < _MARGIN(X), "PROBING_MARGIN is too large.");
#ifdef PROBING_MARGIN
static_assert(PROBING_MARGIN < _MARGIN(X), "PROBING_MARGIN is too large.");
#endif
static_assert(PROBING_MARGIN_BACK < _MARGIN(Y), "PROBING_MARGIN_BACK is too large.");
static_assert(PROBING_MARGIN_FRONT < _MARGIN(Y), "PROBING_MARGIN_FRONT is too large.");
static_assert(PROBING_MARGIN_LEFT < _MARGIN(X), "PROBING_MARGIN_LEFT is too large.");

View file

@ -622,27 +622,27 @@ void FTMotion::makeVector() {
// Apply shaping if active on each axis
#if HAS_X_AXIS
if (shaping.x.ena) {
shaping.x.d_zi[shaping.zi_idx] = traj.x[makeVector_batchIdx];
traj.x[makeVector_batchIdx] *= shaping.x.Ai[0];
for (uint32_t i = 1U; i <= shaping.x.max_i; i++) {
const uint32_t udiffx = shaping.zi_idx - shaping.x.Ni[i];
traj.x[makeVector_batchIdx] += shaping.x.Ai[i] * shaping.x.d_zi[shaping.x.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffx : udiffx];
if (shaping.x.ena) {
shaping.x.d_zi[shaping.zi_idx] = traj.x[makeVector_batchIdx];
traj.x[makeVector_batchIdx] *= shaping.x.Ai[0];
for (uint32_t i = 1U; i <= shaping.x.max_i; i++) {
const uint32_t udiffx = shaping.zi_idx - shaping.x.Ni[i];
traj.x[makeVector_batchIdx] += shaping.x.Ai[i] * shaping.x.d_zi[shaping.x.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffx : udiffx];
}
}
#if HAS_Y_AXIS
if (shaping.y.ena) {
shaping.y.d_zi[shaping.zi_idx] = traj.y[makeVector_batchIdx];
traj.y[makeVector_batchIdx] *= shaping.y.Ai[0];
for (uint32_t i = 1U; i <= shaping.y.max_i; i++) {
const uint32_t udiffy = shaping.zi_idx - shaping.y.Ni[i];
traj.y[makeVector_batchIdx] += shaping.y.Ai[i] * shaping.y.d_zi[shaping.y.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffy : udiffy];
}
}
#if HAS_Y_AXIS
if (shaping.y.ena) {
shaping.y.d_zi[shaping.zi_idx] = traj.y[makeVector_batchIdx];
traj.y[makeVector_batchIdx] *= shaping.y.Ai[0];
for (uint32_t i = 1U; i <= shaping.y.max_i; i++) {
const uint32_t udiffy = shaping.zi_idx - shaping.y.Ni[i];
traj.y[makeVector_batchIdx] += shaping.y.Ai[i] * shaping.y.d_zi[shaping.y.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffy : udiffy];
}
}
#endif
if (++shaping.zi_idx == (FTM_ZMAX)) shaping.zi_idx = 0;
#endif
if (++shaping.zi_idx == (FTM_ZMAX)) shaping.zi_idx = 0;
#endif // HAS_X_AXIS
// Filled up the queue with regular and shaped steps
if (++makeVector_batchIdx == FTM_WINDOW_SIZE) {

View file

@ -17,7 +17,7 @@ def make_base_configs():
# Create a regex to match options and capture line parts
define_patt = re.compile(r'^(\s*)((//\s*)?#define\s+)([A-Z0-9_]+\b)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
ifndef_patt = re.compile(r'^(\s*#ifndef\s*.*?)(\s*//.*)?$', re.IGNORECASE)
ifstat_patt = re.compile(r'^(\s*#(if|ifn?def|else|elif|endif)\s*.*?)(\s*//.*)?$', re.IGNORECASE)
ifstat_patt = re.compile(r'^(\s*#(((if|ifn?def|elif)\s*.*?)|else|endif))(\s*//.*)?$', re.IGNORECASE)
coment_patt = re.compile(r'/\*.*?\*/', re.DOTALL)
contin_patt = re.compile(r'\\\n\s*')
@ -60,12 +60,12 @@ def make_base_configs():
ifelse_patt = re.compile(r'(\s*#(el)?if\s+)(.+)\n\s*#else')
ifelif_patt = re.compile(r'(\s*#if\s+)(.+)\n\s*#elif\s*(.+)')
out_text = '\n'.join(lines_out)
old_text = ''
while out_text != old_text:
while True:
old_text = out_text
out_text = ifelse_patt.sub(r'\1!(\3)', out_text)
out_text = ifelif_patt.sub(r'\1!(\2) && (\3)\n', out_text)
out_text = empty_patt.sub('', out_text)
if out_text == old_text: break
# Store the final result to Marlin/src/inc/BaseConfiguration.h BaseConfiguration_adv.h
outname = f'Base{file}'