Welcome! Log In Create A New Profile

Advanced

Enabling #define RGB_LED results in compiler error

Posted by Aethelstan 
Enabling #define RGB_LED results in compiler error
May 08, 2017 03:21AM
Hi, just downloaded 1.1 release as I wanted to RGB LED functionality. However, when I enable #define RGB_LED in Configuration.h and compile I get an error. Compiling with the define commented out is ok. It seems to be in Marlin_main.cpp, the errors are shown below. My coding skills are very basic so I'm not sure how to interpret these errors, but I suspect this is a single syntax mistake that cascades. My Arduino IDE is 1.8.2. Can anyone help me understand what to look for, please?

sketch\Marlin_main.cpp: In function 'void gcode_M190()':

Marlin_main.cpp:6890: error: expected 'while' before 'float'

         const float temp_diff = fabs(target_temp - temp);

               ^

Marlin_main.cpp:6890: error: expected '(' before 'float'

Marlin_main.cpp:6890: error: expected primary-expression before 'float'

Marlin_main.cpp:6890: error: expected ')' before 'float'

Marlin_main.cpp:6890: error: expected ';' before 'float'

Marlin_main.cpp:6890: error: 'temp' was not declared in this scope

         const float temp_diff = fabs(target_temp - temp);

                                                    ^

Marlin_main.cpp:6908: error: break statement not within loop or switch

           if (old_temp - temp < MIN_COOLING_SLOPE_DEG_BED) break;

                                                            ^

sketch\Marlin_main.cpp: At global scope:

Marlin_main.cpp:6914: error: expected unqualified-id before 'while'

     } while (wait_for_heatup && TEMP_BED_CONDITIONS);

       ^

Marlin_main.cpp:6916: error: expected unqualified-id before 'if'

     if (wait_for_heatup) LCD_MESSAGEPGM(MSG_BED_DONE);

     ^

In file included from sketch\Marlin.h:32:0,

                 from sketch\Marlin_main.cpp:223:

ultralcd.h:64: error: expected unqualified-id before ')' token

   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))

                                              ^

sketch\Marlin_main.cpp:6916:26: note: in expansion of macro 'LCD_MESSAGEPGM'

     if (wait_for_heatup) LCD_MESSAGEPGM(MSG_BED_DONE);

                          ^

In file included from sketch\Marlin_main.cpp:223:0:

Marlin.h:358: error: expected unqualified-id before 'do'

   #define KEEPALIVE_STATE(n) do{ busy_state = n; }while(0)

                              ^

sketch\Marlin_main.cpp:6917:5: note: in expansion of macro 'KEEPALIVE_STATE'

     KEEPALIVE_STATE(IN_HANDLER);

     ^

Marlin.h:358: error: expected unqualified-id before 'while'

   #define KEEPALIVE_STATE(n) do{ busy_state = n; }while(0)

                                                   ^

sketch\Marlin_main.cpp:6917:5: note: in expansion of macro 'KEEPALIVE_STATE'

     KEEPALIVE_STATE(IN_HANDLER);

     ^

Marlin_main.cpp:6918: error: expected declaration before '}' token

   }

   ^

exit status 1
expected 'while' before 'float'
Re: Enabling #define RGB_LED results in compiler error
May 08, 2017 03:57AM
Compiles without issue with 1.6.13, ill download the newer IDE and try again.

Update: compiled on 1.8.2 also...

My testing was get a fresh copy of marlin
enable RGB_LED
download 1.8.2 ardunio ide.
set board type to mega2560
hit verify..

What board did you select and what does you full configuration.h look like?

Also if you got to tools|board|manager change the type to updatable, is there anything that needs updating?

Edited 2 time(s). Last edit at 05/08/2017 04:12AM by Dust.
Re: Enabling #define RGB_LED results in compiler error
May 08, 2017 07:09AM
I'm compiling for a Mega 2560 with ramps 1.4 EEB. Also attached is the RepRap Discount full graphic controller which is enabled and U8glib.h is included at the start of my Configuration.h. SHOW_CUSTOM_BOOTSCREEN is enabled. All other changes are things like axis directions, endstops, pid values and thermistor types. I have no updates available for my boards. I am about to go to work, but will compile it when I get home with the graphic controller disabled and the include commented it out. That is the only thing I can think of that would have any affect when compared with the unmodified config.I have attached my Configuration.h.

Many thanks for your help, I do appreciate it.
Attachments:
open | download - Configuration.h (57 KB)
Re: Enabling #define RGB_LED results in compiler error
May 08, 2017 07:41AM
I have created a fresh folder with untouched files. If I copy my config over then it refuses to compile with RGB_LED enabled. If I use the vanilla config with only that change, then it compiles. I will start afresh and compile with each single change and see where it falls over. thumbs up
Re: Enabling #define RGB_LED results in compiler error
May 08, 2017 08:14AM
Having the same issue and logged a problem on the github page.

Another user confirmed the issue when enabling heated bed option . No other feedback yet .
[github.com]
Re: Enabling #define RGB_LED results in compiler error
May 09, 2017 01:45AM
I can confirm that enabling RGB_LED and setting TEMP_SENSOR_BED to anything other than 0 are the conditions required to trigger this issue.
Re: Enabling #define RGB_LED results in compiler error
May 09, 2017 04:53AM
Good spotting...

Looking just above that error see in Marlin_main.cpp

      #if ENABLED(PRINTER_EVENT_LEDS)
        // Gradually change LED strip from blue to violet as bed heats up
        if (!wants_to_cool) {
          const uint8_t red = map(constrain(temp, start_temp, target_temp), start_temp, target_temp, 0, 255);
          if (red != old_red) set_led_color((old_red = red), 0, 255);
        }
      }
      #endif

the } directly above the # in #endif is in error. Delete that line (line 6921 in the version I have)

ie make it

      #if ENABLED(PRINTER_EVENT_LEDS)
        // Gradually change LED strip from blue to violet as bed heats up
        if (!wants_to_cool) {
          const uint8_t red = map(constrain(temp, start_temp, target_temp), start_temp, target_temp, 0, 255);
          if (red != old_red) set_led_color((old_red = red), 0, 255);
        }
      #endif

I've updated the github issue with these details. One day ill learn how to submit the fix to the real code...

Edited 2 time(s). Last edit at 05/09/2017 05:03AM by Dust.
Re: Enabling #define RGB_LED results in compiler error
May 09, 2017 07:35AM
Brilliant, thanks ever so much smiling smiley
Re: Enabling #define RGB_LED results in compiler error
May 09, 2017 09:08AM
Thanks everybody.smiling smiley
Re: Enabling #define RGB_LED results in compiler error
May 09, 2017 03:29PM
Quote
Dust
Good spotting...

I've updated the github issue with these details. One day ill learn how to submit the fix to the real code...

*unhelpful remark removed* I recommend Visual Studio with the Visual Micro plugin.

*Admin note: rude, unhelpful comments will be removed.

Edited 1 time(s). Last edit at 05/09/2017 04:12PM by NewPerfection.
Re: Enabling #define RGB_LED results in compiler error
May 10, 2017 02:34PM
Quote
AlpinaV8
Quote
Dust
Good spotting...

I've updated the github issue with these details. One day ill learn how to submit the fix to the real code...
*unhelpful remark removed* I recommend Visual Studio with the Visual Micro plugin.
*Admin note: rude, unhelpful comments will be removed.

What's rude on recommending a compiler / tools which would have eliminated these kinds of compiler errors?
My recommendation was on tools which are free, highly available and a class far far away from Arduino !

Anyway, not my intention to hurt someones feelings...

Edited 1 time(s). Last edit at 05/10/2017 02:35PM by AlpinaV8.
Sorry, only registered users may post in this forum.

Click here to login