marlin
"Macro function fails due to wrong parameter type.
SERIAL_ECHOPAIR macro is defined to take two parameters, a string and a float, double or unsigned long. The macro is invoked giving it as a second parameter an integer, thus the error. Issue 2004: https://github.com/MarlinFirmware/Marlin/issues/2004 "
Bug fixed by commit 2db384a21d6
| Type | IncompatibleType |
| Config | "!DISABLE_M503 && MESH_BED_LEVELING" (2nd degree) |
| Fix-in | code |
| Location | configuration |
#ifdef MESH_BED_LEVELING
#define MESH_NUM_X_POINTS 7
#define MESH_NUM_Y_POINTS 7
#endif
#define SERIAL_ECHOPAIR(name,value) do{ serial_echopair_P_l(name,value); }while(0)
void serial_echopair_P_l(const char *s_P, unsigned long v) { printf("%s", s_P); printf("%l", v);}
#ifndef DISABLE_M503
void Config_PrintSettings(bool forReplay){
#ifdef MESH_BED_LEVELING
SERIAL_ECHOPAIR(" X", MESH_NUM_X_POINTS); // ERROR
SERIAL_ECHOPAIR(" Y", MESH_NUM_Y_POINTS); // ERROR
#endif
}
#endif
int main(int argc, char **argv)
{
Config_PrintSettings(false);
return 0;
}
diff --git a/simple/2db384a.c b/simple/2db384a.c
--- a/simple/2db384a.c
+++ b/simple/2db384a.c
@@ -11,8 +11,8 @@ void serial_echopair_P_l(const char *s_P, unsigned long v) { printf("%s", s_P);
void Config_PrintSettings(bool forReplay){
#ifdef MESH_BED_LEVELING
- SERIAL_ECHOPAIR(" X", MESH_NUM_X_POINTS); // ERROR
- SERIAL_ECHOPAIR(" Y", MESH_NUM_Y_POINTS); // ERROR
+ SERIAL_ECHOPAIR(" X", (unsigned long)MESH_NUM_X_POINTS);
+ SERIAL_ECHOPAIR(" Y", (unsigned long)MESH_NUM_Y_POINTS);
#endif
}
#ifdef MESH_BED_LEVELING
#define MESH_NUM_X_POINTS 7
#define MESH_NUM_Y_POINTS 7
#endif
int main(int argc, char **argv)
{
#ifndef DISABLE_M503
void Config_PrintSettings(bool forReplay){
#ifdef MESH_BED_LEVELING
printf("%s%d"," X", MESH_NUM_X_POINTS); // ERROR
printf("%s%d"," Y", MESH_NUM_Y_POINTS); // ERROR
#endif
}
#endif
return 0;
}
. call Marlin/configuration_store.cpp:592: void Config_PrintSettings(bool forReplay)
. 680: SERIAL_ECHOPAIR(" X", MESH_NUM_X_POINTS);
. 681: SERIAL_ECHOPAIR(" Y", MESH_NUM_Y_POINTS);
// SERIAL_ECHOPAIR takes a float, double or unsigned long as second param. MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS are declared as INTs.