🎨 Misc. code cleanup
This commit is contained in:
parent
390878e78a
commit
0c8a53e507
|
@ -210,7 +210,7 @@ void serialprintPGM(PGM_P str);
|
||||||
#define _SEP_N_P_REF() _SEP_N_P
|
#define _SEP_N_P_REF() _SEP_N_P
|
||||||
#define _SEP_1_P(s) serialprintPGM(s);
|
#define _SEP_1_P(s) serialprintPGM(s);
|
||||||
#define _SEP_2_P(s,v) serial_echopair_PGM(s,v);
|
#define _SEP_2_P(s,v) serial_echopair_PGM(s,v);
|
||||||
#define _SEP_3_P(s,v,V...) _SEP_2_P(s,v); DEFER(_SEP_N_P_REF)()(TWO_ARGS(V),V);
|
#define _SEP_3_P(s,v,V...) _SEP_2_P(s,v); DEFER2(_SEP_N_P_REF)()(TWO_ARGS(V),V);
|
||||||
#define SERIAL_ECHOPAIR_P(V...) do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0)
|
#define SERIAL_ECHOPAIR_P(V...) do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0)
|
||||||
|
|
||||||
// Print up to 20 pairs of values followed by newline. Odd elements must be PSTR pointers.
|
// Print up to 20 pairs of values followed by newline. Odd elements must be PSTR pointers.
|
||||||
|
@ -219,7 +219,7 @@ void serialprintPGM(PGM_P str);
|
||||||
#define _SELP_N_P_REF() _SELP_N_P
|
#define _SELP_N_P_REF() _SELP_N_P
|
||||||
#define _SELP_1_P(s) { serialprintPGM(s); SERIAL_EOL(); }
|
#define _SELP_1_P(s) { serialprintPGM(s); SERIAL_EOL(); }
|
||||||
#define _SELP_2_P(s,v) { serial_echopair_PGM(s,v); SERIAL_EOL(); }
|
#define _SELP_2_P(s,v) { serial_echopair_PGM(s,v); SERIAL_EOL(); }
|
||||||
#define _SELP_3_P(s,v,V...) { _SEP_2_P(s,v); DEFER(_SELP_N_P_REF)()(TWO_ARGS(V),V); }
|
#define _SELP_3_P(s,v,V...) { _SEP_2_P(s,v); DEFER2(_SELP_N_P_REF)()(TWO_ARGS(V),V); }
|
||||||
#define SERIAL_ECHOLNPAIR_P(V...) do{ EVAL(_SELP_N_P(TWO_ARGS(V),V)); }while(0)
|
#define SERIAL_ECHOLNPAIR_P(V...) do{ EVAL(_SELP_N_P(TWO_ARGS(V),V)); }while(0)
|
||||||
|
|
||||||
#ifdef AllowDifferentTypeInList
|
#ifdef AllowDifferentTypeInList
|
||||||
|
|
|
@ -66,7 +66,7 @@ uint8_t MCP4728::analogWrite(const uint8_t channel, const uint16_t value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write all input resistor values to EEPROM using SequencialWrite method.
|
* Write all input resistor values to EEPROM using SequentialWrite method.
|
||||||
* This will update both input register and EEPROM value
|
* This will update both input register and EEPROM value
|
||||||
* This will also write current Vref, PowerDown, Gain settings to EEPROM
|
* This will also write current Vref, PowerDown, Gain settings to EEPROM
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -164,12 +164,7 @@ Joystick joystick;
|
||||||
xyz_float_t move_dist{0};
|
xyz_float_t move_dist{0};
|
||||||
float hypot2 = 0;
|
float hypot2 = 0;
|
||||||
LOOP_XYZ(i) if (norm_jog[i]) {
|
LOOP_XYZ(i) if (norm_jog[i]) {
|
||||||
move_dist[i] = seg_time * norm_jog[i] *
|
move_dist[i] = seg_time * norm_jog[i] * TERN(EXTENSIBLE_UI, manual_feedrate_mm_s, planner.settings.max_feedrate_mm_s)[i];
|
||||||
#if ENABLED(EXTENSIBLE_UI)
|
|
||||||
manual_feedrate_mm_s[i];
|
|
||||||
#else
|
|
||||||
planner.settings.max_feedrate_mm_s[i];
|
|
||||||
#endif
|
|
||||||
hypot2 += sq(move_dist[i]);
|
hypot2 += sq(move_dist[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void GcodeSuite::M290() {
|
||||||
const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
|
const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
|
||||||
babystep.add_mm(Z_AXIS, offs);
|
babystep.add_mm(Z_AXIS, offs);
|
||||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||||
if (!parser.seen('P') || parser.value_bool()) mod_probe_offset(offs);
|
if (parser.boolval('P', true)) mod_probe_offset(offs);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -271,7 +271,7 @@ void home_delta() {
|
||||||
// Do this here all at once for Delta, because
|
// Do this here all at once for Delta, because
|
||||||
// XYZ isn't ABC. Applying this per-tower would
|
// XYZ isn't ABC. Applying this per-tower would
|
||||||
// give the impression that they are the same.
|
// give the impression that they are the same.
|
||||||
LOOP_XYZ(i) set_axis_is_at_home((AxisEnum)i);
|
LOOP_ABC(i) set_axis_is_at_home((AxisEnum)i);
|
||||||
|
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
|
|
|
@ -1072,7 +1072,7 @@ void MarlinSettings::postprocess() {
|
||||||
{
|
{
|
||||||
_FIELD_TEST(tmc_stepper_current);
|
_FIELD_TEST(tmc_stepper_current);
|
||||||
|
|
||||||
tmc_stepper_current_t tmc_stepper_current = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
tmc_stepper_current_t tmc_stepper_current{0};
|
||||||
|
|
||||||
#if HAS_TRINAMIC_CONFIG
|
#if HAS_TRINAMIC_CONFIG
|
||||||
#if AXIS_IS_TMC(X)
|
#if AXIS_IS_TMC(X)
|
||||||
|
@ -1134,7 +1134,7 @@ void MarlinSettings::postprocess() {
|
||||||
_FIELD_TEST(tmc_hybrid_threshold);
|
_FIELD_TEST(tmc_hybrid_threshold);
|
||||||
|
|
||||||
#if ENABLED(HYBRID_THRESHOLD)
|
#if ENABLED(HYBRID_THRESHOLD)
|
||||||
tmc_hybrid_threshold_t tmc_hybrid_threshold = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
tmc_hybrid_threshold_t tmc_hybrid_threshold{0};
|
||||||
#if AXIS_HAS_STEALTHCHOP(X)
|
#if AXIS_HAS_STEALTHCHOP(X)
|
||||||
tmc_hybrid_threshold.X = stepperX.get_pwm_thrs();
|
tmc_hybrid_threshold.X = stepperX.get_pwm_thrs();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1538,7 +1538,7 @@ void MarlinSettings::postprocess() {
|
||||||
EEPROM_READ(dummyf);
|
EEPROM_READ(dummyf);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
for (uint8_t q = 4; q--;) EEPROM_READ(dummyf);
|
for (uint8_t q = XYZE; q--;) EEPROM_READ(dummyf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EEPROM_READ(TERN(CLASSIC_JERK, dummyf, planner.junction_deviation_mm));
|
EEPROM_READ(TERN(CLASSIC_JERK, dummyf, planner.junction_deviation_mm));
|
||||||
|
@ -2256,7 +2256,7 @@ void MarlinSettings::postprocess() {
|
||||||
const xyz_float_t &backlash_distance_mm = backlash.distance_mm;
|
const xyz_float_t &backlash_distance_mm = backlash.distance_mm;
|
||||||
const uint8_t &backlash_correction = backlash.correction;
|
const uint8_t &backlash_correction = backlash.correction;
|
||||||
#else
|
#else
|
||||||
float backlash_distance_mm[XYZ];
|
xyz_float_t backlash_distance_mm;
|
||||||
uint8_t backlash_correction;
|
uint8_t backlash_correction;
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(BACKLASH_GCODE) && defined(BACKLASH_SMOOTHING_MM)
|
#if ENABLED(BACKLASH_GCODE) && defined(BACKLASH_SMOOTHING_MM)
|
||||||
|
|
|
@ -250,7 +250,7 @@ class Stepper {
|
||||||
#ifndef PWM_MOTOR_CURRENT
|
#ifndef PWM_MOTOR_CURRENT
|
||||||
#define PWM_MOTOR_CURRENT DEFAULT_PWM_MOTOR_CURRENT
|
#define PWM_MOTOR_CURRENT DEFAULT_PWM_MOTOR_CURRENT
|
||||||
#endif
|
#endif
|
||||||
#define MOTOR_CURRENT_COUNT 3
|
#define MOTOR_CURRENT_COUNT XYZ
|
||||||
#elif HAS_MOTOR_CURRENT_SPI
|
#elif HAS_MOTOR_CURRENT_SPI
|
||||||
static constexpr uint32_t digipot_count[] = DIGIPOT_MOTOR_CURRENT;
|
static constexpr uint32_t digipot_count[] = DIGIPOT_MOTOR_CURRENT;
|
||||||
#define MOTOR_CURRENT_COUNT COUNT(Stepper::digipot_count)
|
#define MOTOR_CURRENT_COUNT COUNT(Stepper::digipot_count)
|
||||||
|
|
|
@ -113,10 +113,7 @@
|
||||||
|
|
||||||
void move_extruder_servo(const uint8_t e) {
|
void move_extruder_servo(const uint8_t e) {
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
#if EXTRUDERS & 1
|
if ((EXTRUDERS & 1) && e < EXTRUDERS - 1) {
|
||||||
if (e < EXTRUDERS - 1)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
MOVE_SERVO(_SERVO_NR(e), servo_angles[_SERVO_NR(e)][e & 1]);
|
MOVE_SERVO(_SERVO_NR(e), servo_angles[_SERVO_NR(e)][e & 1]);
|
||||||
safe_delay(500);
|
safe_delay(500);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue