Merge pull request #9325 from thinkyhead/bf2_simple_patches

[2.0.x] Optimize some strings, arc length calculation
2.0.x
Scott Lahteine 7 years ago committed by GitHub
commit c19327f1bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -116,7 +116,7 @@ void I2CPositionEncoder::update() {
SERIAL_ECHOPGM("New position reads as "); SERIAL_ECHOPGM("New position reads as ");
SERIAL_ECHO(get_position()); SERIAL_ECHO(get_position());
SERIAL_ECHOPGM("("); SERIAL_CHAR('(');
SERIAL_ECHO(mm_from_count(get_position())); SERIAL_ECHO(mm_from_count(get_position()));
SERIAL_ECHOLNPGM(")"); SERIAL_ECHOLNPGM(")");
#endif #endif

@ -1732,7 +1732,7 @@
d = t + normal.z * z1; d = t + normal.z * z1;
SERIAL_ECHOPGM("D from 1st point: "); SERIAL_ECHOPGM("D from 1st point: ");
SERIAL_ECHO_F(d, 6); SERIAL_ECHO_F(d, 6);
SERIAL_ECHO(" Z error: "); SERIAL_ECHOPGM(" Z error: ");
SERIAL_ECHO_F(normal.z*z1-get_z_correction(UBL_PROBE_PT_1_X, UBL_PROBE_PT_1_Y),6); SERIAL_ECHO_F(normal.z*z1-get_z_correction(UBL_PROBE_PT_1_X, UBL_PROBE_PT_1_Y),6);
SERIAL_EOL(); SERIAL_EOL();
@ -1741,7 +1741,7 @@
SERIAL_EOL(); SERIAL_EOL();
SERIAL_ECHOPGM("D from 2nd point: "); SERIAL_ECHOPGM("D from 2nd point: ");
SERIAL_ECHO_F(d, 6); SERIAL_ECHO_F(d, 6);
SERIAL_ECHO(" Z error: "); SERIAL_ECHOPGM(" Z error: ");
SERIAL_ECHO_F(normal.z*z2-get_z_correction(UBL_PROBE_PT_2_X, UBL_PROBE_PT_2_Y),6); SERIAL_ECHO_F(normal.z*z2-get_z_correction(UBL_PROBE_PT_2_X, UBL_PROBE_PT_2_Y),6);
SERIAL_EOL(); SERIAL_EOL();
@ -1749,7 +1749,7 @@
d = t + normal.z * z3; d = t + normal.z * z3;
SERIAL_ECHOPGM("D from 3rd point: "); SERIAL_ECHOPGM("D from 3rd point: ");
SERIAL_ECHO_F(d, 6); SERIAL_ECHO_F(d, 6);
SERIAL_ECHO(" Z error: "); SERIAL_ECHOPGM(" Z error: ");
SERIAL_ECHO_F(normal.z*z3-get_z_correction(UBL_PROBE_PT_3_X, UBL_PROBE_PT_3_Y),6); SERIAL_ECHO_F(normal.z*z3-get_z_correction(UBL_PROBE_PT_3_X, UBL_PROBE_PT_3_Y),6);
SERIAL_EOL(); SERIAL_EOL();
@ -1766,7 +1766,7 @@
SERIAL_ECHOPAIR(" Z error: (", Z_SAFE_HOMING_X_POINT ); SERIAL_ECHOPAIR(" Z error: (", Z_SAFE_HOMING_X_POINT );
SERIAL_ECHOPAIR(",", Z_SAFE_HOMING_Y_POINT ); SERIAL_ECHOPAIR(",", Z_SAFE_HOMING_Y_POINT );
SERIAL_ECHO(") = "); SERIAL_ECHOPGM(") = ");
SERIAL_ECHO_F( get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT),6); SERIAL_ECHO_F( get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT),6);
SERIAL_EOL(); SERIAL_EOL();
*/ */

@ -93,7 +93,7 @@ void GcodeSuite::M852() {
if (!ijk) { if (!ijk) {
SERIAL_ECHO_START(); SERIAL_ECHO_START();
SERIAL_ECHO(MSG_SKEW_FACTOR " XY: "); SERIAL_ECHOPGM(MSG_SKEW_FACTOR " XY: ");
SERIAL_ECHO_F(planner.xy_skew_factor, 6); SERIAL_ECHO_F(planner.xy_skew_factor, 6);
SERIAL_EOL(); SERIAL_EOL();
#if ENABLED(SKEW_CORRECTION_FOR_Z) #if ENABLED(SKEW_CORRECTION_FOR_Z)

@ -86,7 +86,8 @@ void plan_arc(
if (angular_travel == 0 && current_position[p_axis] == cart[p_axis] && current_position[q_axis] == cart[q_axis]) if (angular_travel == 0 && current_position[p_axis] == cart[p_axis] && current_position[q_axis] == cart[q_axis])
angular_travel = RADIANS(360); angular_travel = RADIANS(360);
const float mm_of_travel = HYPOT(angular_travel * radius, FABS(linear_travel)); const float flat_mm = radius * angular_travel,
mm_of_travel = linear_travel ? HYPOT(flat_mm, linear_travel) : flat_mm;
if (mm_of_travel < 0.001) return; if (mm_of_travel < 0.001) return;
uint16_t segments = FLOOR(mm_of_travel / (MM_PER_ARC_SEGMENT)); uint16_t segments = FLOOR(mm_of_travel / (MM_PER_ARC_SEGMENT));

@ -286,13 +286,13 @@ void GCodeParser::unknown_command_error() {
SERIAL_ECHO(codenum); SERIAL_ECHO(codenum);
SERIAL_ECHOLNPGM(")"); SERIAL_ECHOLNPGM(")");
#if ENABLED(FASTER_GCODE_PARSER) #if ENABLED(FASTER_GCODE_PARSER)
SERIAL_ECHO(" args: \""); SERIAL_ECHOPGM(" args: \"");
for (char c = 'A'; c <= 'Z'; ++c) for (char c = 'A'; c <= 'Z'; ++c)
if (seen(c)) { SERIAL_CHAR(c); SERIAL_CHAR(' '); } if (seen(c)) { SERIAL_CHAR(c); SERIAL_CHAR(' '); }
#else #else
SERIAL_ECHOPAIR(" args: \"", command_args); SERIAL_ECHOPAIR(" args: \"", command_args);
#endif #endif
SERIAL_ECHOPGM("\""); SERIAL_CHAR('"');
if (string_arg) { if (string_arg) {
SERIAL_ECHOPGM(" string: \""); SERIAL_ECHOPGM(" string: \"");
SERIAL_ECHO(string_arg); SERIAL_ECHO(string_arg);

@ -2266,7 +2266,7 @@ void MarlinSettings::reset(
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
#if ENABLED(SKEW_CORRECTION_FOR_Z) #if ENABLED(SKEW_CORRECTION_FOR_Z)
SERIAL_ECHO_P(port, " M852 I"); SERIAL_ECHOPGM_P(port, " M852 I");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6);
SERIAL_ECHOPGM_P(port, " J"); SERIAL_ECHOPGM_P(port, " J");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xz_skew_factor), 6); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xz_skew_factor), 6);
@ -2274,7 +2274,7 @@ void MarlinSettings::reset(
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.yz_skew_factor), 6); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.yz_skew_factor), 6);
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#else #else
SERIAL_ECHO_P(port, " M852 S"); SERIAL_ECHOPGM_P(port, " M852 S");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6);
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#endif #endif
@ -2289,7 +2289,7 @@ void MarlinSettings::reset(
SERIAL_ECHOLNPGM_P(port, "Stepper driver current:"); SERIAL_ECHOLNPGM_P(port, "Stepper driver current:");
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHO_P(port, " M906"); SERIAL_ECHOPGM_P(port, " M906");
#if ENABLED(X_IS_TMC2130) || ENABLED(X_IS_TMC2208) #if ENABLED(X_IS_TMC2130) || ENABLED(X_IS_TMC2208)
SERIAL_ECHOPAIR_P(port, " X ", stepperX.getCurrent()); SERIAL_ECHOPAIR_P(port, " X ", stepperX.getCurrent());
#endif #endif
@ -2335,7 +2335,7 @@ void MarlinSettings::reset(
SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:"); SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:");
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHO_P(port, " M914"); SERIAL_ECHOPGM_P(port, " M914");
#if ENABLED(X_IS_TMC2130) #if ENABLED(X_IS_TMC2130)
SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt()); SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt());
#endif #endif

@ -373,7 +373,7 @@ void Planner::recalculate_trapezoids() {
} }
} }
/* /**
* Recalculate the motion plan according to the following algorithm: * Recalculate the motion plan according to the following algorithm:
* *
* 1. Go over every block in reverse order... * 1. Go over every block in reverse order...
@ -403,7 +403,6 @@ void Planner::recalculate() {
recalculate_trapezoids(); recalculate_trapezoids();
} }
#if ENABLED(AUTOTEMP) #if ENABLED(AUTOTEMP)
void Planner::getHighESpeed() { void Planner::getHighESpeed() {

@ -144,7 +144,7 @@ void PrintCounter::showStats() {
SERIAL_ECHOPGM("Filament used: "); SERIAL_ECHOPGM("Filament used: ");
SERIAL_ECHO(this->data.filamentUsed / 1000); SERIAL_ECHO(this->data.filamentUsed / 1000);
SERIAL_ECHOPGM("m"); SERIAL_CHAR('m');
SERIAL_EOL(); SERIAL_EOL();
} }

Loading…
Cancel
Save