🎨 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

@ -34,7 +34,7 @@ millis_t Stopwatch::startTimestamp;
millis_t Stopwatch::stopTimestamp;
bool Stopwatch::stop() {
Stopwatch::debug(PSTR("stop"));
debug(F("stop"));
if (isRunning() || isPaused()) {
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
@ -46,7 +46,7 @@ bool Stopwatch::stop() {
}
bool Stopwatch::pause() {
Stopwatch::debug(PSTR("pause"));
debug(F("pause"));
if (isRunning()) {
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerPaused());
@ -58,7 +58,7 @@ bool Stopwatch::pause() {
}
bool Stopwatch::start() {
Stopwatch::debug(PSTR("start"));
debug(F("start"));
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStarted());
@ -74,14 +74,14 @@ bool Stopwatch::start() {
}
void Stopwatch::resume(const millis_t with_time) {
Stopwatch::debug(PSTR("resume"));
debug(F("resume"));
reset();
if ((accumulator = with_time)) state = RUNNING;
}
void Stopwatch::reset() {
Stopwatch::debug(PSTR("reset"));
debug(F("reset"));
state = STOPPED;
startTimestamp = 0;
@ -95,12 +95,8 @@ millis_t Stopwatch::duration() {
#if ENABLED(DEBUG_STOPWATCH)
void Stopwatch::debug(const char func[]) {
if (DEBUGGING(INFO)) {
SERIAL_ECHOPGM("Stopwatch::");
SERIAL_ECHOPGM_P(func);
SERIAL_ECHOLNPGM("()");
}
void Stopwatch::debug(FSTR_P const func) {
if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::", func, "()");
}
#endif

View File

@ -21,14 +21,11 @@
*/
#pragma once
#include "../inc/MarlinConfig.h"
// Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
//#define DEBUG_STOPWATCH
#include "../core/macros.h" // for FORCE_INLINE
#include <stdint.h>
typedef uint32_t millis_t;
/**
* @brief Stopwatch class
* @details This class acts as a timer proving stopwatch functionality including
@ -113,11 +110,11 @@ class Stopwatch {
* @brief Print a debug message
* @details Print a simple debug message "Stopwatch::function"
*/
static void debug(const char func[]);
static void debug(FSTR_P const);
#else
static inline void debug(const char[]) {}
static inline void debug(FSTR_P const) {}
#endif
};

View File

@ -75,8 +75,8 @@ void vector_3::apply_rotation(const matrix_3x3 &matrix) {
matrix.vectors[0].z * _x + matrix.vectors[1].z * _y + matrix.vectors[2].z * _z };
}
void vector_3::debug(PGM_P const title) {
SERIAL_ECHOPGM_P(title);
void vector_3::debug(FSTR_P const title) {
SERIAL_ECHOF(title);
SERIAL_ECHOPAIR_F_P(SP_X_STR, x, 6);
SERIAL_ECHOPAIR_F_P(SP_Y_STR, y, 6);
SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z, 6);
@ -100,14 +100,14 @@ void matrix_3x3::set_to_identity() {
// Create a matrix from 3 vector_3 inputs
matrix_3x3 matrix_3x3::create_from_rows(const vector_3 &row_0, const vector_3 &row_1, const vector_3 &row_2) {
//row_0.debug(PSTR("row_0"));
//row_1.debug(PSTR("row_1"));
//row_2.debug(PSTR("row_2"));
//row_0.debug(F("row_0"));
//row_1.debug(F("row_1"));
//row_2.debug(F("row_2"));
matrix_3x3 new_matrix;
new_matrix.vectors[0] = row_0;
new_matrix.vectors[1] = row_1;
new_matrix.vectors[2] = row_2;
//new_matrix.debug(PSTR("new_matrix"));
//new_matrix.debug(F("new_matrix"));
return new_matrix;
}
@ -117,14 +117,14 @@ matrix_3x3 matrix_3x3::create_look_at(const vector_3 &target) {
x_row = vector_3(1, 0, -target.x / target.z).get_normal(),
y_row = vector_3::cross(z_row, x_row).get_normal();
// x_row.debug(PSTR("x_row"));
// y_row.debug(PSTR("y_row"));
// z_row.debug(PSTR("z_row"));
// x_row.debug(F("x_row"));
// y_row.debug(F("y_row"));
// z_row.debug(F("z_row"));
// create the matrix already correctly transposed
matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row);
// rot.debug(PSTR("rot"));
// rot.debug(F("rot"));
return rot;
}
@ -137,8 +137,8 @@ matrix_3x3 matrix_3x3::transpose(const matrix_3x3 &original) {
return new_matrix;
}
void matrix_3x3::debug(PGM_P const title) {
if (title) SERIAL_ECHOLNPGM_P(title);
void matrix_3x3::debug(FSTR_P const title) {
if (title) SERIAL_ECHOLNF(title);
LOOP_L_N(i, 3) {
LOOP_L_N(j, 3) {
if (vectors[i][j] >= 0.0) SERIAL_CHAR('+');

View File

@ -78,7 +78,7 @@ struct vector_3 {
operator xy_float_t() { return xy_float_t({ x, y }); }
operator xyz_float_t() { return xyz_float_t({ x, y, z }); }
void debug(PGM_P const title);
void debug(FSTR_P const title);
};
struct matrix_3x3 {
@ -91,7 +91,7 @@ struct matrix_3x3 {
void set_to_identity();
void debug(PGM_P const title);
void debug(FSTR_P const title);
void apply_rotation_xyz(float &x, float &y, float &z);
};