🎨 Apply F() to various reports

This commit is contained in:
Scott Lahteine
2021-09-27 13:46:42 -05:00
parent cabd538fdd
commit 24dbeceb45
30 changed files with 286 additions and 289 deletions

View File

@ -269,28 +269,28 @@ void GcodeSuite::G28() {
#endif
#if HAS_HOMING_CURRENT
auto debug_current = [](PGM_P const s, const int16_t a, const int16_t b) {
DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b);
auto debug_current = [](FSTR_P const s, const int16_t a, const int16_t b) {
DEBUG_ECHOF(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b);
};
#if HAS_CURRENT_HOME(X)
const int16_t tmc_save_current_X = stepperX.getMilliamps();
stepperX.rms_current(X_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(PSTR("X"), tmc_save_current_X, X_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F("X"), tmc_save_current_X, X_CURRENT_HOME);
#endif
#if HAS_CURRENT_HOME(X2)
const int16_t tmc_save_current_X2 = stepperX2.getMilliamps();
stepperX2.rms_current(X2_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(PSTR("X2"), tmc_save_current_X2, X2_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F("X2"), tmc_save_current_X2, X2_CURRENT_HOME);
#endif
#if HAS_CURRENT_HOME(Y)
const int16_t tmc_save_current_Y = stepperY.getMilliamps();
stepperY.rms_current(Y_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(PSTR("Y"), tmc_save_current_Y, Y_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F("Y"), tmc_save_current_Y, Y_CURRENT_HOME);
#endif
#if HAS_CURRENT_HOME(Y2)
const int16_t tmc_save_current_Y2 = stepperY2.getMilliamps();
stepperY2.rms_current(Y2_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(PSTR("Y2"), tmc_save_current_Y2, Y2_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F("Y2"), tmc_save_current_Y2, Y2_CURRENT_HOME);
#endif
#if HAS_CURRENT_HOME(I)
const int16_t tmc_save_current_I = stepperI.getMilliamps();
@ -310,7 +310,7 @@ void GcodeSuite::G28() {
#if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
const int16_t tmc_save_current_Z = stepperZ.getMilliamps();
stepperZ.rms_current(Z_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(PSTR("Z"), tmc_save_current_Z, Z_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F("Z"), tmc_save_current_Z, Z_CURRENT_HOME);
#endif
#endif

View File

@ -97,10 +97,9 @@ void ac_cleanup(TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index)) {
TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index, true));
}
void print_signed_float(PGM_P const prefix, const_float_t f) {
void print_signed_float(FSTR_P const prefix, const_float_t f) {
SERIAL_ECHOPGM(" ");
SERIAL_ECHOPGM_P(prefix);
SERIAL_CHAR(':');
SERIAL_ECHOF(prefix, AS_CHAR(':'));
if (f >= 0) SERIAL_CHAR('+');
SERIAL_ECHO_F(f, 2);
}
@ -111,24 +110,23 @@ void print_signed_float(PGM_P const prefix, const_float_t f) {
static void print_calibration_settings(const bool end_stops, const bool tower_angles) {
SERIAL_ECHOPGM(".Height:", delta_height);
if (end_stops) {
print_signed_float(PSTR("Ex"), delta_endstop_adj.a);
print_signed_float(PSTR("Ey"), delta_endstop_adj.b);
print_signed_float(PSTR("Ez"), delta_endstop_adj.c);
print_signed_float(F("Ex"), delta_endstop_adj.a);
print_signed_float(F("Ey"), delta_endstop_adj.b);
print_signed_float(F("Ez"), delta_endstop_adj.c);
}
if (end_stops && tower_angles) {
SERIAL_ECHOPGM(" Radius:", delta_radius);
SERIAL_EOL();
SERIAL_ECHOLNPGM(" Radius:", delta_radius);
SERIAL_CHAR('.');
SERIAL_ECHO_SP(13);
}
if (tower_angles) {
print_signed_float(PSTR("Tx"), delta_tower_angle_trim.a);
print_signed_float(PSTR("Ty"), delta_tower_angle_trim.b);
print_signed_float(PSTR("Tz"), delta_tower_angle_trim.c);
print_signed_float(F("Tx"), delta_tower_angle_trim.a);
print_signed_float(F("Ty"), delta_tower_angle_trim.b);
print_signed_float(F("Tz"), delta_tower_angle_trim.c);
}
if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR
if (end_stops != tower_angles)
SERIAL_ECHOPGM(" Radius:", delta_radius);
}
SERIAL_EOL();
}
@ -137,11 +135,11 @@ static void print_calibration_settings(const bool end_stops, const bool tower_an
*/
static void print_calibration_results(const float z_pt[NPP + 1], const bool tower_points, const bool opposite_points) {
SERIAL_ECHOPGM(". ");
print_signed_float(PSTR("c"), z_pt[CEN]);
print_signed_float(F("c"), z_pt[CEN]);
if (tower_points) {
print_signed_float(PSTR(" x"), z_pt[__A]);
print_signed_float(PSTR(" y"), z_pt[__B]);
print_signed_float(PSTR(" z"), z_pt[__C]);
print_signed_float(F(" x"), z_pt[__A]);
print_signed_float(F(" y"), z_pt[__B]);
print_signed_float(F(" z"), z_pt[__C]);
}
if (tower_points && opposite_points) {
SERIAL_EOL();
@ -149,9 +147,9 @@ static void print_calibration_results(const float z_pt[NPP + 1], const bool towe
SERIAL_ECHO_SP(13);
}
if (opposite_points) {
print_signed_float(PSTR("yz"), z_pt[_BC]);
print_signed_float(PSTR("zx"), z_pt[_CA]);
print_signed_float(PSTR("xy"), z_pt[_AB]);
print_signed_float(F("yz"), z_pt[_BC]);
print_signed_float(F("zx"), z_pt[_CA]);
print_signed_float(F("xy"), z_pt[_AB]);
}
SERIAL_EOL();
}
@ -653,13 +651,13 @@ void GcodeSuite::G33() {
}
}
else { // dry run
PGM_P const enddryrun = PSTR("End DRY-RUN");
SERIAL_ECHOPGM_P(enddryrun);
FSTR_P const enddryrun = F("End DRY-RUN");
SERIAL_ECHOF(enddryrun);
SERIAL_ECHO_SP(35);
SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
char mess[21];
strcpy_P(mess, enddryrun);
strcpy_P(mess, FTOP(enddryrun));
strcpy_P(&mess[11], PSTR(" sd:"));
if (zero_std_dev < 1)
sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev * 1000.0f));

View File

@ -51,7 +51,7 @@
* Also, there are two support functions that can be called from a developer's C code.
*
* uint16_t check_for_free_memory_corruption(PGM_P const free_memory_start);
* void M100_dump_routine(PGM_P const title, const char * const start, const uintptr_t size);
* void M100_dump_routine(FSTR_P const title, const char * const start, const uintptr_t size);
*
* Initial version by Roxy-3D
*/
@ -182,8 +182,8 @@ inline int32_t count_test_bytes(const char * const start_free_memory) {
}
}
void M100_dump_routine(PGM_P const title, const char * const start, const uintptr_t size) {
SERIAL_ECHOLNPGM_P(title);
void M100_dump_routine(FSTR_P const title, const char * const start, const uintptr_t size) {
SERIAL_ECHOLNF(title);
//
// Round the start and end locations to produce full lines of output
//
@ -196,8 +196,8 @@ inline int32_t count_test_bytes(const char * const start_free_memory) {
#endif // M100_FREE_MEMORY_DUMPER
inline int check_for_free_memory_corruption(PGM_P const title) {
SERIAL_ECHOPGM_P(title);
inline int check_for_free_memory_corruption(FSTR_P const title) {
SERIAL_ECHOF(title);
char *start_free_memory = free_memory_start, *end_free_memory = free_memory_end;
int n = end_free_memory - start_free_memory;
@ -217,7 +217,7 @@ inline int check_for_free_memory_corruption(PGM_P const title) {
// idle();
serial_delay(20);
#if ENABLED(M100_FREE_MEMORY_DUMPER)
M100_dump_routine(PSTR(" Memory corruption detected with end_free_memory<Heap\n"), (const char*)0x1B80, 0x0680);
M100_dump_routine(F(" Memory corruption detected with end_free_memory<Heap\n"), (const char*)0x1B80, 0x0680);
#endif
}
@ -281,7 +281,7 @@ inline void free_memory_pool_report(char * const start_free_memory, const int32_
"\nMemory Corruption detected in free memory area."
"\nLargest free block is ", max_cnt, " bytes at ", hex_address(max_addr)
);
SERIAL_ECHOLNPGM("check_for_free_memory_corruption() = ", check_for_free_memory_corruption(PSTR("M100 F ")));
SERIAL_ECHOLNPGM("check_for_free_memory_corruption() = ", check_for_free_memory_corruption(F("M100 F ")));
}
#if ENABLED(M100_FREE_MEMORY_CORRUPTOR)