Where to enable user interface encoder in Marlin?

I am trying to configure Marlin for a Ramps 1.6 board. I have an I2C 4x20 character LCD enabled. I have the LCD working with

#define LCD_SAINSMART_I2C_2004


I have a separate encoder, with push button, but I can't find where to enable it. It seems that combo display-encoder-buzzer boards are enabled as a set. Some common name, like the define I used for the display. But I can't find any useful information that includes a I2C LCD with an encoder.

I'm looking for a configuration that would enable my LCD and encoder, or just some way to enable the encoder by itself.

For some configurations I found the following. But when I connect my encoder to those pins nothing happens when I try it. So I think I need to enable them somewhere.

//encoder pins
#define BTN_EN1 31
#define BTN_EN2 33
#define BTN_ENC 35


It seems that ULTIPANEL must be defined. The code for the encoder was included long ago with the Ultipanel (display and encoder) and does not exist on its own.

#define LCD_SAINSMART_I2C_2004   //  I2C LCD

#define ULTIPANEL                // enable code for encoder.

//encoder pins
#define BTN_EN1 37
#define BTN_EN2 35
#define BTN_ENC 31

• I notice that the BTN_ENx definitions differ from those posted in your question. These are the correct pins I guess, or can they be set to any pins, which the encoder is connected to? Also, did you have any links, or sources, for the code having been included and now no longer exists? The statement seems a bit confused. Presumably the code is still included, but requires the #define ULTIPANEL to enable it? – Greenonline Sep 29 '19 at 18:03
• They can be to any available pin. Whatever is used, as long as it is defined the same, would work. I said the encoder code does not exist "on it's own". When the UNIPANEL became available someone wrote the code to use the complete LCD and Encoder as a set. Not as two separate components that would both have to be each selected. This is not a surprise, code grows organically, as is needed. I have not been able to locate the actual code. I got it working and didn't feel like spending more time looking for it at this time. But I do want to find it. – Rudy Sep 30 '19 at 1:14