ThomasHeb / 4AxisFoamCutter

Arduino based CNC foam cutter with display and SD-Card
14 stars 8 forks source link

Code wont compile "'gc_command' was not declared in this scope" #8

Closed LarsBrinck closed 3 years ago

LarsBrinck commented 3 years ago

Hi Thomas, Thanks for your work with the foamcutter! I´ve been looking for a foamcutter that I can run from my mac and when I finally found your brilliant standalone solution I got around to built myself a small one like this: https://www.thingiverse.com/thing:3676825

Unfortunately I ran into troubles trying to compile the code to my Arduino. I guess there is some library or something missing. I´ve read the other issues here and tried to re-load the libraries as you suggested but I get the same error. Error Foamcutter Lars Brinck.txt

I get the red line error in line 1184 in the lcd.cpp file

Can you see what is wrong or do you need more info?

ThomasHeb commented 3 years ago

Hello Lars,

there are many errors in the log and I guess some are just based on the others. There is a redefinition of some macros like max and min, this looks like the arduino.h is linked. I think the SdFat brings the arduino.h back to the linker. Your errors are showing some linked files that are not included in the version I used. Please use SdFat by Bill Greiman, Version 1.2.3.

Or use this libs https://github.com/ThomasHeb/4AxisFoamCutter/tree/master/03_Firmware/libraries

Only the file u8g2_font.c is missing (path /libraries/U8g2/src/clib/), due to > 25MB.

close the Arduino IDE. save u8g2_font.c from your lib folder delete the libs in your lib folder (sdfat and u8g2) copy the libs from the link above. add u8g2_font.c under /libraries/U8g2/src/clib/ Start Arduino IDE and compile Foamcutter.

LarsBrinck commented 3 years ago

Hello Thomas -

Thanks for helping.

I found it! Or my friend did :) - we tried doing the same install on his computer and it compiled. Then he asked me if I had changed anything. And I had changed the settings in the config.h file:

define USE_LIMIT_SWITCHES 0

define USE_BUTTONS 0

So changing the USE_BUTTONS to 1 again made it compile again.

In the lcd.cpp file at line 957 the string gc_command is defined after the #if statement

if (USE_BUTTONS == 1)

char   gc_c[20];
String gc_command;
String gc_step;
float  speed;

so I got the error gc_command was not declared because with USE_BUTTONS set to 0 it doesn't get declared.

Since I don´t want the buttons for now the quickfix was to declare before the #if statement

char   gc_c[20];
String gc_command;
String gc_step;
float  speed;

if (USE_BUTTONS == 1)

//char   gc_c[20];
//String gc_command;
//String gc_step;
//float  speed;

Now it compiles with USE_BUTTONS set to 0. I´ll proceed from here and upload it to the Arduino board and see if the steppers will come to life.

ThomasHeb commented 3 years ago

Hi Lars,

good job and thank you for the feedback. I will integrate and correct this in the next changes. Let me know, if you need any further support.

LarsBrinck commented 3 years ago

Thanks Thomas. I´ll close this issue and open a new if I get stuck again.