Hi all,
Its been quite a few years since I did any programming and I'm just starting with the Arduino IDE.
I installed the Adafruit_SSD1306 and Adafruit_GFX libraries from Github and tried compiling the 128x64 example sketch. It throws an error here.
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
The define is correct in the header file
#define SSD1306_128_64
// #define SSD1306_128_32
// #define SSD1306_96_16
/*=========================================================================*/
#if defined SSD1306_128_64 && defined SSD1306_128_32
#error "Only one SSD1306 display can be specified at once in SSD1306.h"
#endif
#if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16
#error "At least one SSD1306 display must be specified in SSD1306.h"
#endif
#if defined SSD1306_128_64
#define SSD1306_LCDWIDTH 128
#define SSD1306_LCDHEIGHT 64
#endif
#if defined SSD1306_128_32
#define SSD1306_LCDWIDTH 128
#define SSD1306_LCDHEIGHT 32
#endif
#if defined SSD1306_96_16
#define SSD1306_LCDWIDTH 96
#define SSD1306_LCDHEIGHT 16
#endif
I have tried changing the defines, commenting out the three defines and multiple defines to see if I could get the compiler to throw any of the two errors
#if defined SSD1306_128_64 && defined SSD1306_128_32
#error "Only one SSD1306 display can be specified at once in SSD1306.h"
#endif
#if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16
#error "At least one SSD1306 display must be specified in SSD1306.h"
#endif
without success.
I opened another instance of the IDE and loaded the 32 line height example, expecting it to also error. To my surprise it compiled without error.
I'm at a loss to understand why the 32 line version compiled with the 64 line define active.
I've ran a compare on the two source files, there are only 2 code lines different. one is the compare that throws the number of lines error and the other one is an i2c address change.
I did the header file changes in Notepad++ and saved the file before recompiling. Does the IDE reread the library source when it recompiles, or does it assume it hasn't changed.
Is there anybody who can explain this, please
John