Adafruit Library for RGB LCD Shield throws warning on latest IDE

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
klcobley
 
Posts: 8
Joined: Tue Jul 26, 2016 10:27 am

Adafruit Library for RGB LCD Shield throws warning on latest IDE

Post by klcobley »

Having updated my arduino IDE to 2.1.0, I now find my project throws warnings related to the Adafruit Library for the RGB LCD Shield which is didn't used to in 1.8 (yes I've had arduino IDE for a while :-) ). The compiler report is:

Code: Select all

C:\xxx\Arduino\libraries\Adafruit_RGBLCDShield\Adafruit_RGBLCDShield.cpp: In member function 'void Adafruit_RGBLCDShield::begin(uint8_t, uint8_t, uint8_t)':
C:\xxx\Arduino\libraries\Adafruit_RGBLCDShield\Adafruit_RGBLCDShield.cpp:119:43: warning: unused parameter 'cols' [-Wunused-parameter]
 void Adafruit_RGBLCDShield::begin(uint8_t cols, uint8_t lines,
                                           ^~~~
the relevant parts of my code are:

Code: Select all

#include <Wire.h>
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>
#include <Arduino.h>

//... some stuff deleted...

Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();//instantiate the display

//initialisation
void setup()
{
  Serial.begin(9600);// Start the serial port for debugging
  lcd.begin(16, 2);// set up the LCD's number of columns and rows:

//... rest of setup and main loop etc.

I appreciate that its a warning, and that probably everything is fine, but I like to compile free of warnings where I can so as to know I'm not making silly mistakes with things which still compile :-)

Is it just me (most likely) or is there a problem with the library ? I tried adding the third optional parameter to my call but it made no difference - its the columns variable it objects to..) and this was taken from the original example code..

The version of the library is 1.2.0

Many thanks,

Kevin.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit Library for RGB LCD Shield throws warning on latest IDE

Post by adafruit_support_carter »

Yep, it's just a warn, and a pretty benign one, so can ignore.

A simple fix is to add a line like:

Code: Select all

(void)cols;
in the Adafruit_RGBLCDShield::begin() function.

But of course the bigger question is why it's there to begin with. :)

User avatar
klcobley
 
Posts: 8
Joined: Tue Jul 26, 2016 10:27 am

Re: Adafruit Library for RGB LCD Shield throws warning on latest IDE

Post by klcobley »

Thanks - I'm glad its not just me !

Not used to errors in your libraries :-)

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit Library for RGB LCD Shield throws warning on latest IDE

Post by adafruit_support_carter »

An actual error would be different. It would stop compilation and would need to be fixed. The wording in the message would have "error" also, instead of "warning".

The fact this is showing up now is most likely due to changes in the compilation flags being used by the Board Support Package.

User avatar
klcobley
 
Posts: 8
Joined: Tue Jul 26, 2016 10:27 am

Re: Adafruit Library for RGB LCD Shield throws warning on latest IDE

Post by klcobley »

sorry - should be more precise with language - ofc not an error, a warning as I said in the OP

but it is an "error" of the human kind in so much as the code looks like it was changed but the inputs not tidied up, which is what I meant :-)

Your solution will work for me and its probably a good way to go fixing the library so as not to break old code?

many thanks.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit Library for RGB LCD Shield throws warning on latest IDE

Post by adafruit_support_carter »

Yep, the change won't break anything. It's really does nothing. But it fools the compiler into thinking the parameter is being used and will suppress the warning.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”