Using buttons without a LCD
Hey guys,
I am wondering if there is any possibility to get some keys working without a display? Sounds weird but maybe makes more sense considering this:
As I am using a Minitronics from RepRapWorld there are almost no pins left on my controller board (even if, i don't necessarily want one). What I want to do is making the Z_PROBE_HEIGHT calibration a little bit easier. I want to use 3 buttons in total:
Key 1: If pushed for about 3 seconds the controller enters the calibration mode (or leaves it)
Key 2: Moves Z 0.05 mm upwards
Key 3: Moves Z 0.05 mm downwards
When key 1 is pushed for another 3 seconds in calibration mode the current Z_PROBE_HEIGHT is read from EEPROM, the current Z-Value is also read, some math is done and the new (correct) Z_PROBE_HEIGHT value is written into EEPROM. That would make my life way simpler.
Even though this doesn't makes sense for everyone reading this I really would appreciate your help!
I already tried to manage it for a couple of hours but couldn't get it working. What I did was the following:
inspired by: https://www.repetier.com/documentation/repetier-firmware/rf-installation/
in Configuration.h
#define FEATURE_CONTROLLER 0
#define FEATURE_UI_KEYS 1
in ui.h
I am wondering if there is any possibility to get some keys working without a display? Sounds weird but maybe makes more sense considering this:
As I am using a Minitronics from RepRapWorld there are almost no pins left on my controller board (even if, i don't necessarily want one). What I want to do is making the Z_PROBE_HEIGHT calibration a little bit easier. I want to use 3 buttons in total:
Key 1: If pushed for about 3 seconds the controller enters the calibration mode (or leaves it)
Key 2: Moves Z 0.05 mm upwards
Key 3: Moves Z 0.05 mm downwards
When key 1 is pushed for another 3 seconds in calibration mode the current Z_PROBE_HEIGHT is read from EEPROM, the current Z-Value is also read, some math is done and the new (correct) Z_PROBE_HEIGHT value is written into EEPROM. That would make my life way simpler.
Even though this doesn't makes sense for everyone reading this I really would appreciate your help!
I already tried to manage it for a couple of hours but couldn't get it working. What I did was the following:
inspired by: https://www.repetier.com/documentation/repetier-firmware/rf-installation/
in Configuration.h
#define FEATURE_CONTROLLER 0
#define FEATURE_UI_KEYS 1
in ui.h
#define UI_ACTION_CUSTOM 114 //value is not in use, only for testing #define UI_DISPLAY_TYPE 1 #define UI_HAS_KEYS 1 void ui_init_keys() { UI_KEYS_INIT_BUTTON_LOW(19); //button connects line to GND (btw, any need to activate the a pullup resistor?) } void ui_check_keys(int &action) { UI_KEYS_BUTTON_LOW(19,UI_ACTION_CUSTOM); } in ui.cpp ..... #if UI_HAS_KEYS == 1 if(action & UI_ACTION_TOPMENU) // Go to start menu { menuLevel = 0; } action &= 8191; // strip out higher level flags if(action >= 2000 && action < 3000) { setStatusP(Com::translatedF(UI_TEXT_STRING_ACTION_ID)); } else switch(action) { case UI_ACTION_CUSTOM: Com::printF("testing"); break; case UI_ACTION_OK: ..... I also tried some other code-changes but always either get an compile error or nothing happens at all. Does anyone has a solution for this problem? Best regards Stefan BTW: All buttons and connections are working when I compile a custom project. Just not the implementation with Repetier Firmware.
Comments
#define USER_KEY1_PIN UI_DISPLAY_D5_PIN // D5 to display (not used for graphics controller), change to other pin if you use character LCD !
#define USER_KEY1_ACTION UI_ACTION_FAN_SUSPEND
#define USER_KEY2_PIN UI_DISPLAY_D6_PIN // D6 to display (not used for graphics controller)...
#define USER_KEY2_ACTION UI_ACTION_SD_PRI_PAU_CONT
#define USER_KEY3_PIN UI_DISPLAY_D7_PIN // D7 to display (not used for graphics controller)...
#define USER_KEY3_ACTION UI_ACTION_LIGHTS_ONOFF
#define USER_KEY4_PIN -1
#define USER_KEY4_ACTION UI_ACTION_DUMMY
The action will then be executed, but there is no way to have 3sec delay to run a function. Also what you want needs a bit of extra logic to work. With lcd the dev version has a function for that problem but that is not working with 3 buttons and no display.