MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.24k stars 19.22k forks source link

Compile Error - Using IIC Character LCD (20x4) #9615

Closed davigre closed 6 years ago

davigre commented 6 years ago

src.zip

I want to use ONLY 20x4 LCD with YwRobot IIC encoder ( NO Click Encoder )

So I enabled LCD_I2C_SAINSMART_YWROBOT option in 'Configuration.h':

//
// Sainsmart YW Robot (LCM1602) LCD Display
//
// Note: This controller requires F.Malpartida's LiquidCrystal_I2C library
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
//
#define LCD_I2C_SAINSMART_YWROBOT

in file 'Conditionals_LCD.h' I found this:

/**
   * I2C PANELS
   */

  #if ENABLED(LCD_I2C_SAINSMART_YWROBOT)

    // Note: This controller requires F.Malpartida's LiquidCrystal_I2C library
    // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

    #define LCD_I2C_TYPE_PCF8575
    #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
    #define ULTIPANEL  // <- ULTIPANEL was defined.

  #elif ENABLED(LCD_I2C_PANELOLU2)

    // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
 ...

As I don't have a Click Encoder I disabled NEWPANEL in 'Conditionals_LCD.h' file:

#if ENABLED(ULTIPANEL)
    //#define NEWPANEL  // Disable this if you actually have no click-encoder panel
    #define ULTRA_LCD
    #ifndef LCD_WIDTH
      #define LCD_WIDTH 20
    #endif
    #ifndef LCD_HEIGHT
      #define LCD_HEIGHT 4
    #endif
  #elif ENABLED(ULTRA_LCD)  // no panel but just LCD

When I compile I get an error:

`#error "ULTIPANEL requires some kind of encoder."``

As you can see I don't have an ULTIPANEL.

Thank's

davigre commented 6 years ago

Can I undefine 'ULTIPANEL' and define 'ULTRA_LCD' in 'Conditionals_LCD.h' and define LCD_WIDTH 20 and LCD_HEIGHT 4 in 'Configuration.h'?

/**
   * I2C PANELS
   */

  #if ENABLED(LCD_I2C_SAINSMART_YWROBOT)

    // Note: This controller requires F.Malpartida's LiquidCrystal_I2C library
    // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

    #define LCD_I2C_TYPE_PCF8575
    #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
    //#define ULTIPANEL
    #define ULTRA_LCD

  #elif ENABLED(LCD_I2C_PANELOLU2)

Configuration.h:

//
// Sainsmart YW Robot (LCM1602) LCD Display
//
// Note: This controller requires F.Malpartida's LiquidCrystal_I2C library
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
//
#define LCD_I2C_SAINSMART_YWROBOT
#define LCD_WIDTH 20
#define LCD_HEIGHT 4

It compiles now.

thinkyhead commented 6 years ago

Thanks for pointing this one out. We've been trying to do some cleanup of the LCD options and conditionals to make it possible to use displays without a controller, but there's a lot of mixup in the code as to which of the conditions and lcd options refer to a display, which refer to a controller, and which refer to capabilities. This is just one of those things we haven't fully sorted out. Your solution is essentially correct. I'll make sure to patch this today.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.