Hello,
I'm trying to implemant a 3 push buttons panel in Marlin, instead of incremental rotary encoder. But something is wrong and i can't do it working.
Display is a I2C 128x64 Oled display, and it's already working.
I know that rotary encoder is cheap and it's easier to use it. But i think it's a good way to increase my understanding and knowledge of C++ and marlin firmware (i am not new to C++, but i am not an expert).
My Marlin's release is 1.1.8 and i am devellop on an Arduino Mega board to simulate the MKS Base 1.0 board of my DiscoEasy200 printer.
I was inspired by "TinyBoy2 128x64 OLED / Encoder Panel" and "RIGIDBOT_PANEL". What i have done :
• Create a pins_3_buttons_controller.h file:
This file is inspired by pin_RIGIDBOARD.h file. It contain following lines to define UP, DWN and ENC buttons, and to undifine EN1 and EN2 inputs :
#if ENABLED(OLED_PANEL_3_BUTTONS)
// Direction buttons
#define BTN_UP 37
#define BTN_DWN 35
// 'R' button
#undef BTN_ENC
#define BTN_ENC 31
// Disable encoder
#undef BTN_EN1
#define BTN_EN1 -1
#undef BTN_EN2
#define BTN_EN2 -1
#endif
• Adding following lines in Configuration.h file, near line 1607, to enable my 3 buttons panel :
//
// I2C 128x64 OLED / 3 Buttons Panel
//
#define OLED_PANEL_3_BUTTONS
• Adding following lines in Conditionals_LCD.h file, near line 97, to enable U8GLIB_SSD1306 and ULTIPANEL like on the "TinyBoy2 128x64 OLED / Encoder Panel":
#elif ENABLED(OLED_PANEL_3_BUTTONS)
#define U8GLIB_SSD1306
#define ULTIPANEL
• Adding following lines in pin.h, near line 255, to include my pins_3_buttons_controller.h file:
#if ENABLED(OLED_PANEL_3_BUTTONS)
#include "pins_3_buttons_controller.h" // Panel 3 buttons
In hardware side, my 3 buttons input is floating, and closed to ground when pressed (i follow EN_C implemant). UP is connected on digital pin37. DWN is connected on digital pin 35. ENC_C is connected on digital pin 31
So EN_C button is working, but i cannot do UP and DWN buttons working.
I have tryied to change "SET_INPUT" to "SET_INPUT_PULLUP" for UP and DWN in ultradlcd.cpp, in lines 4497 and 4500, but it's not working too.
Can you tell me what's wrong in what i have done please ?
And for general knowledge, why does all marlin's control panel use incremental rotary encoder and only one use buttons ? What the benefits of incremental rotary encoder ?
Thank you a lot, and sorry for my bad french english
Have a good day.
Edited 2 time(s). Last edit at 02/23/2018 05:44AM by pit34.