No casting needed for SERIAL_ECHOPAIR

This commit is contained in:
Scott Lahteine 2016-04-06 22:40:45 -07:00
parent 573d772c92
commit dc19b69697
5 changed files with 38 additions and 33 deletions

View file

@ -180,10 +180,10 @@ void gcode_M100() {
x = code_value(); x = code_value();
SERIAL_ECHOLNPGM("Corrupting free memory block.\n"); SERIAL_ECHOLNPGM("Corrupting free memory block.\n");
ptr = (unsigned char*) __brkval; ptr = (unsigned char*) __brkval;
SERIAL_ECHOPAIR("\n__brkval : ", (long) ptr); SERIAL_ECHOPAIR("\n__brkval : ", ptr);
ptr += 8; ptr += 8;
sp = top_of_stack(); sp = top_of_stack();
SERIAL_ECHOPAIR("\nStack Pointer : ", (long) sp); SERIAL_ECHOPAIR("\nStack Pointer : ", sp);
SERIAL_ECHOLNPGM("\n"); SERIAL_ECHOLNPGM("\n");
n = sp - ptr - 64; // -64 just to keep us from finding interrupt activity that n = sp - ptr - 64; // -64 just to keep us from finding interrupt activity that
// has altered the stack. // has altered the stack.
@ -204,10 +204,10 @@ void gcode_M100() {
if (m100_not_initialized || code_seen('I')) { // If no sub-command is specified, the first time if (m100_not_initialized || code_seen('I')) { // If no sub-command is specified, the first time
SERIAL_ECHOLNPGM("Initializing free memory block.\n"); // this happens, it will Initialize. SERIAL_ECHOLNPGM("Initializing free memory block.\n"); // this happens, it will Initialize.
ptr = (unsigned char*) __brkval; // Repeated M100 with no sub-command will not destroy the ptr = (unsigned char*) __brkval; // Repeated M100 with no sub-command will not destroy the
SERIAL_ECHOPAIR("\n__brkval : ", (long) ptr); // state of the initialized free memory pool. SERIAL_ECHOPAIR("\n__brkval : ", ptr); // state of the initialized free memory pool.
ptr += 8; ptr += 8;
sp = top_of_stack(); sp = top_of_stack();
SERIAL_ECHOPAIR("\nStack Pointer : ", (long) sp); SERIAL_ECHOPAIR("\nStack Pointer : ", sp);
SERIAL_ECHOLNPGM("\n"); SERIAL_ECHOLNPGM("\n");
n = sp - ptr - 64; // -64 just to keep us from finding interrupt activity that n = sp - ptr - 64; // -64 just to keep us from finding interrupt activity that
// has altered the stack. // has altered the stack.
@ -217,7 +217,7 @@ void gcode_M100() {
*(ptr + i) = (unsigned char) 0xe5; *(ptr + i) = (unsigned char) 0xe5;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (*(ptr + i) != (unsigned char) 0xe5) { if (*(ptr + i) != (unsigned char) 0xe5) {
SERIAL_ECHOPAIR("? address : ", (unsigned long) ptr + i); SERIAL_ECHOPAIR("? address : ", ptr + i);
SERIAL_ECHOPAIR("=", *(ptr + i)); SERIAL_ECHOPAIR("=", *(ptr + i));
SERIAL_ECHOLNPGM("\n"); SERIAL_ECHOLNPGM("\n");
} }

View file

@ -101,13 +101,15 @@ extern const char echomagic[] PROGMEM;
#define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x) #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
#define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x) #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
#define SERIAL_ECHOPAIR(name,value) do{ serial_echopair_P(PSTR(name),(value)); }while(0) #define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value)))
void serial_echopair_P(const char* s_P, int v); void serial_echopair_P(const char* s_P, int v);
void serial_echopair_P(const char* s_P, long v); void serial_echopair_P(const char* s_P, long v);
void serial_echopair_P(const char* s_P, float v); void serial_echopair_P(const char* s_P, float v);
void serial_echopair_P(const char* s_P, double v); void serial_echopair_P(const char* s_P, double v);
void serial_echopair_P(const char* s_P, unsigned long v); void serial_echopair_P(const char* s_P, unsigned long v);
FORCE_INLINE void serial_echopair_P(const char* s_P, bool v) { serial_echopair_P(s_P, (int)v); }
FORCE_INLINE void serial_echopair_P(const char* s_P, void *v) { serial_echopair_P(s_P, (unsigned long)v); }
// Things to write to serial from Program memory. Saves 400 to 2k of RAM. // Things to write to serial from Program memory. Saves 400 to 2k of RAM.
FORCE_INLINE void serialprintPGM(const char* str) { FORCE_INLINE void serialprintPGM(const char* str) {

View file

@ -1170,7 +1170,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
static void set_axis_is_at_home(AxisEnum axis) { static void set_axis_is_at_home(AxisEnum axis) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("set_axis_is_at_home(", (unsigned long)axis); SERIAL_ECHOPAIR("set_axis_is_at_home(", axis);
SERIAL_ECHOLNPGM(") >>>"); SERIAL_ECHOLNPGM(") >>>");
} }
#endif #endif
@ -1258,7 +1258,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
} }
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", (unsigned long)axis); SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis);
SERIAL_ECHOLNPGM(")"); SERIAL_ECHOLNPGM(")");
} }
#endif #endif
@ -1653,7 +1653,7 @@ static void setup_for_endstop_move() {
if (doRaise) { if (doRaise) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("Raise Z (after) by ", (float)Z_RAISE_AFTER_PROBING); SERIAL_ECHOPAIR("Raise Z (after) by ", Z_RAISE_AFTER_PROBING);
SERIAL_EOL; SERIAL_EOL;
SERIAL_ECHO("> SERVO_ENDSTOPS > raise_z_after_probing()"); SERIAL_ECHO("> SERVO_ENDSTOPS > raise_z_after_probing()");
SERIAL_EOL; SERIAL_EOL;
@ -1749,7 +1749,7 @@ static void setup_for_endstop_move() {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("probe_pt >>>"); SERIAL_ECHOLNPGM("probe_pt >>>");
SERIAL_ECHOPAIR("> ProbeAction:", (unsigned long)probe_action); SERIAL_ECHOPAIR("> ProbeAction:", probe_action);
SERIAL_EOL; SERIAL_EOL;
DEBUG_POS("", current_position); DEBUG_POS("", current_position);
} }
@ -1970,7 +1970,7 @@ static void setup_for_endstop_move() {
static void homeaxis(AxisEnum axis) { static void homeaxis(AxisEnum axis) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR(">>> homeaxis(", (unsigned long)axis); SERIAL_ECHOPAIR(">>> homeaxis(", axis);
SERIAL_ECHOLNPGM(")"); SERIAL_ECHOLNPGM(")");
} }
#endif #endif
@ -2158,7 +2158,7 @@ static void homeaxis(AxisEnum axis) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("<<< homeaxis(", (unsigned long)axis); SERIAL_ECHOPAIR("<<< homeaxis(", axis);
SERIAL_ECHOLNPGM(")"); SERIAL_ECHOLNPGM(")");
} }
#endif #endif
@ -2486,7 +2486,7 @@ inline void gcode_G28() {
feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s) feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (float)(MIN_Z_HEIGHT_FOR_HOMING)); SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
SERIAL_EOL; SERIAL_EOL;
DEBUG_POS("> (home_all_axis || homeZ)", current_position); DEBUG_POS("> (home_all_axis || homeZ)", current_position);
DEBUG_POS("> (home_all_axis || homeZ)", destination); DEBUG_POS("> (home_all_axis || homeZ)", destination);
@ -3117,7 +3117,7 @@ inline void gcode_G28() {
if (probePointCounter) { if (probePointCounter) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("z_before = (between) ", (float)(Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS])); SERIAL_ECHOPAIR("z_before = (between) ", (Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS]));
SERIAL_EOL; SERIAL_EOL;
} }
#endif #endif
@ -3125,7 +3125,7 @@ inline void gcode_G28() {
else { else {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("z_before = (before) ", (float)Z_RAISE_BEFORE_PROBING); SERIAL_ECHOPAIR("z_before = (before) ", Z_RAISE_BEFORE_PROBING);
SERIAL_EOL; SERIAL_EOL;
} }
#endif #endif
@ -3483,6 +3483,9 @@ inline void gcode_G92() {
inline void gcode_M0_M1() { inline void gcode_M0_M1() {
char* args = current_command_args; char* args = current_command_args;
uint8_t test_value = 12;
SERIAL_ECHOPAIR("TEST", test_value);
millis_t codenum = 0; millis_t codenum = 0;
bool hasP = false, hasS = false; bool hasP = false, hasS = false;
if (code_seen('P')) { if (code_seen('P')) {

View file

@ -328,7 +328,7 @@ void Config_StoreSettings() {
// Report storage size // Report storage size
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Settings Stored (", (unsigned long)i); SERIAL_ECHOPAIR("Settings Stored (", i);
SERIAL_ECHOLNPGM(" bytes)"); SERIAL_ECHOLNPGM(" bytes)");
} }
@ -507,7 +507,7 @@ void Config_RetrieveSettings() {
// Report settings retrieved and length // Report settings retrieved and length
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHO(ver); SERIAL_ECHO(ver);
SERIAL_ECHOPAIR(" stored settings retrieved (", (unsigned long)i); SERIAL_ECHOPAIR(" stored settings retrieved (", i);
SERIAL_ECHOLNPGM(" bytes)"); SERIAL_ECHOLNPGM(" bytes)");
} }
@ -730,9 +730,9 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOLNPGM("Mesh bed leveling:"); SERIAL_ECHOLNPGM("Mesh bed leveling:");
CONFIG_ECHO_START; CONFIG_ECHO_START;
} }
SERIAL_ECHOPAIR(" M420 S", (unsigned long)mbl.active); SERIAL_ECHOPAIR(" M420 S", mbl.active);
SERIAL_ECHOPAIR(" X", (unsigned long)MESH_NUM_X_POINTS); SERIAL_ECHOPAIR(" X", MESH_NUM_X_POINTS);
SERIAL_ECHOPAIR(" Y", (unsigned long)MESH_NUM_Y_POINTS); SERIAL_ECHOPAIR(" Y", MESH_NUM_Y_POINTS);
SERIAL_EOL; SERIAL_EOL;
for (uint8_t y = 0; y < MESH_NUM_Y_POINTS; y++) { for (uint8_t y = 0; y < MESH_NUM_Y_POINTS; y++) {
for (uint8_t x = 0; x < MESH_NUM_X_POINTS; x++) { for (uint8_t x = 0; x < MESH_NUM_X_POINTS; x++) {
@ -783,14 +783,14 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOLNPGM("Material heatup parameters:"); SERIAL_ECHOLNPGM("Material heatup parameters:");
CONFIG_ECHO_START; CONFIG_ECHO_START;
} }
SERIAL_ECHOPAIR(" M145 S0 H", (unsigned long)plaPreheatHotendTemp); SERIAL_ECHOPAIR(" M145 S0 H", plaPreheatHotendTemp);
SERIAL_ECHOPAIR(" B", (unsigned long)plaPreheatHPBTemp); SERIAL_ECHOPAIR(" B", plaPreheatHPBTemp);
SERIAL_ECHOPAIR(" F", (unsigned long)plaPreheatFanSpeed); SERIAL_ECHOPAIR(" F", plaPreheatFanSpeed);
SERIAL_EOL; SERIAL_EOL;
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOPAIR(" M145 S1 H", (unsigned long)absPreheatHotendTemp); SERIAL_ECHOPAIR(" M145 S1 H", absPreheatHotendTemp);
SERIAL_ECHOPAIR(" B", (unsigned long)absPreheatHPBTemp); SERIAL_ECHOPAIR(" B", absPreheatHPBTemp);
SERIAL_ECHOPAIR(" F", (unsigned long)absPreheatFanSpeed); SERIAL_ECHOPAIR(" F", absPreheatFanSpeed);
SERIAL_EOL; SERIAL_EOL;
#endif // ULTIPANEL #endif // ULTIPANEL
@ -805,7 +805,7 @@ void Config_PrintSettings(bool forReplay) {
if (forReplay) { if (forReplay) {
for (uint8_t i = 0; i < EXTRUDERS; i++) { for (uint8_t i = 0; i < EXTRUDERS; i++) {
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOPAIR(" M301 E", (unsigned long)i); SERIAL_ECHOPAIR(" M301 E", i);
SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, i)); SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, i));
SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, i))); SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, i)));
SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, i))); SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, i)));
@ -848,7 +848,7 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOLNPGM("LCD Contrast:"); SERIAL_ECHOLNPGM("LCD Contrast:");
CONFIG_ECHO_START; CONFIG_ECHO_START;
} }
SERIAL_ECHOPAIR(" M250 C", (unsigned long)lcd_contrast); SERIAL_ECHOPAIR(" M250 C", lcd_contrast);
SERIAL_EOL; SERIAL_EOL;
#endif #endif
@ -882,7 +882,7 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries"); SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
CONFIG_ECHO_START; CONFIG_ECHO_START;
} }
SERIAL_ECHOPAIR(" M209 S", (unsigned long)(autoretract_enabled ? 1 : 0)); SERIAL_ECHOPAIR(" M209 S", (autoretract_enabled ? 1 : 0));
SERIAL_EOL; SERIAL_EOL;
#endif // FWRETRACT #endif // FWRETRACT

View file

@ -294,20 +294,20 @@ void checkHitEndstops() {
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT); SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
if (TEST(endstop_hit_bits, X_MIN)) { if (TEST(endstop_hit_bits, X_MIN)) {
SERIAL_ECHOPAIR(" X:", (float)endstops_trigsteps[X_AXIS] / axis_steps_per_unit[X_AXIS]); SERIAL_ECHOPAIR(" X:", endstops_trigsteps[X_AXIS] / axis_steps_per_unit[X_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X"); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
} }
if (TEST(endstop_hit_bits, Y_MIN)) { if (TEST(endstop_hit_bits, Y_MIN)) {
SERIAL_ECHOPAIR(" Y:", (float)endstops_trigsteps[Y_AXIS] / axis_steps_per_unit[Y_AXIS]); SERIAL_ECHOPAIR(" Y:", endstops_trigsteps[Y_AXIS] / axis_steps_per_unit[Y_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y"); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
} }
if (TEST(endstop_hit_bits, Z_MIN)) { if (TEST(endstop_hit_bits, Z_MIN)) {
SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]); SERIAL_ECHOPAIR(" Z:", endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z"); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
} }
#if ENABLED(Z_MIN_PROBE_ENDSTOP) #if ENABLED(Z_MIN_PROBE_ENDSTOP)
if (TEST(endstop_hit_bits, Z_MIN_PROBE)) { if (TEST(endstop_hit_bits, Z_MIN_PROBE)) {
SERIAL_ECHOPAIR(" Z_MIN_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]); SERIAL_ECHOPAIR(" Z_MIN_PROBE:", endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP"); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
} }
#endif #endif