I am trying to make a change to 1.1.8 to add an E endstop, it will be a 4th axis. Anyway, I have the program endstops.cpp is where I am having a compile issue and I can't seem to figure it out, because I am new to C++.
here is the relevant code
There are 2 lines I added;
#define ENDSTOP_HIT_TEST_E() _ENDSTOP_HIT_TEST(E,'E')
ENDSTOP_HIT_TEST_E();
The error I have is this;
Marlin\endstops.cpp: In static member function 'static void Endstops::report_state()':
Marlin\endstops.cpp:198:52: error: 'E_MAX' was not declared in this scope
and line 198 is this;
#define ENDSTOP_HIT_TEST_E() _ENDSTOP_HIT_TEST(E,'E')
So I kind of understand that the #define is a preprocessor command to replace all instances of ENDSTOP_HIT_TEST_E() with _ENDSTOP_HIT_TEST(E,'E')
I only have and need the E Min, I do not have nor need a E Max
I believe this line
if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \
is causing the error but I am not sure.
Any help would be appreciated
Thanks
here is the relevant code
void Endstops::report_state() { if (endstop_hit_bits) { #if ENABLED(ULTRA_LCD) char chrX = ' ', chrY = ' ', chrZ = ' ', chrP = ' '; #define _SET_STOP_CHAR(A,C) (chr## A = C) #else #define _SET_STOP_CHAR(A,C) ; #endif #define _ENDSTOP_HIT_ECHO(A,C) do{ \ SERIAL_ECHOPAIR(" " STRINGIFY(A) ":", stepper.triggered_position_mm(A ##_AXIS)); \ _SET_STOP_CHAR(A,C); }while(0) #define _ENDSTOP_HIT_TEST(A,C) \ if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \ _ENDSTOP_HIT_ECHO(A,C) #define ENDSTOP_HIT_TEST_X() _ENDSTOP_HIT_TEST(X,'X') #define ENDSTOP_HIT_TEST_Y() _ENDSTOP_HIT_TEST(Y,'Y') #define ENDSTOP_HIT_TEST_Z() _ENDSTOP_HIT_TEST(Z,'Z') #define ENDSTOP_HIT_TEST_E() _ENDSTOP_HIT_TEST(E,'E') SERIAL_ECHO_START(); SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT); ENDSTOP_HIT_TEST_X(); ENDSTOP_HIT_TEST_Y(); ENDSTOP_HIT_TEST_Z(); ENDSTOP_HIT_TEST_E(); #if ENABLED(Z_MIN_PROBE_ENDSTOP) #define P_AXIS Z_AXIS if (TEST(endstop_hit_bits, Z_MIN_PROBE)) _ENDSTOP_HIT_ECHO(P, 'P'); #endif SERIAL_EOL(); #if ENABLED(ULTRA_LCD) lcd_status_printf_P(0, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP); #endif hit_on_purpose(); #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT) if (stepper.abort_on_endstop_hit) { card.sdprinting = false; card.closefile(); quickstop_stepper(); thermalManager.disable_all_heaters(); // switch off all heaters. } #endif } } // Endstops::report_state
There are 2 lines I added;
#define ENDSTOP_HIT_TEST_E() _ENDSTOP_HIT_TEST(E,'E')
ENDSTOP_HIT_TEST_E();
The error I have is this;
Marlin\endstops.cpp: In static member function 'static void Endstops::report_state()':
Marlin\endstops.cpp:198:52: error: 'E_MAX' was not declared in this scope
and line 198 is this;
#define ENDSTOP_HIT_TEST_E() _ENDSTOP_HIT_TEST(E,'E')
So I kind of understand that the #define is a preprocessor command to replace all instances of ENDSTOP_HIT_TEST_E() with _ENDSTOP_HIT_TEST(E,'E')
I only have and need the E Min, I do not have nor need a E Max
I believe this line
if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \
is causing the error but I am not sure.
Any help would be appreciated
Thanks