So you had
#define ADC_KEYPAD_PIN 4
which is equivalent to D58 just as analog input?
Guess you already say in DisplayList.h this section:
#if FEATURE_CONTROLLER == CONTROLLER_ZONESTAR
// Keypad
#if !defined(ADC_KEYPAD_PIN) || (ADC_KEYPAD_PIN < 0)
#error CONTROLLER_ZONESTAR requres ADC_KEYPAD_PIN = 1 defined in Configuration.h
#endif
// This must be defined in the Configuration.h since used in ADC tables
//#define ADC_KEYPAD_PIN 1 // A1 (D30, analog numbering)
// Display
// Define UI_DISPLAY_TYPE = DISPLAY_SR with pins to override default settings
// that work for original Zonestar hardware.
// For instance:
// #define UI_DISPLAY_TYPE DISPLAY_SR
// #define UI_DISPLAY_DATA_PIN 29
// #define UI_DISPLAY_CLOCK_PIN 28
// #define UI_DISPLAY_ENABLE_PIN -1 // for 2-wire or pin number for 3-wire
#undef UI_DISPLAY_TYPE
#define UI_DISPLAY_TYPE DISPLAY_4BIT
#if MOTHERBOARD == 39 // ZRIB
#define BEEPER_TYPE 1
#define UI_DISPLAY_RS_PIN 16
#define UI_DISPLAY_RW_PIN -1
#define UI_DISPLAY_ENABLE_PIN 17
#define UI_DISPLAY_D4_PIN 23
#define UI_DISPLAY_D5_PIN 25
#define UI_DISPLAY_D6_PIN 27
#define UI_DISPLAY_D7_PIN 29
#define UI_RESET_PIN 41
#elif MOTHERBOARD == 703 // MEGATRONICS 3
#define UI_DISPLAY_RS_PIN 32
#define UI_DISPLAY_RW_PIN -1
#define UI_DISPLAY_ENABLE_PIN 31
#define UI_DISPLAY_D4_PIN 14
#define UI_DISPLAY_D5_PIN 30
#define UI_DISPLAY_D6_PIN 39
#define UI_DISPLAY_D7_PIN 15
#define BEEPER_TYPE 1
#elif MOTHERBOARD == 63 // Melzi
#define UI_DISPLAY_ENABLE_PIN 29
#define UI_DISPLAY_RS_PIN 28
#define UI_DISPLAY_RW_PIN -1
#define UI_DISPLAY_D4_PIN 10
#define UI_DISPLAY_D5_PIN 11
#define UI_DISPLAY_D6_PIN 16
#define UI_DISPLAY_D7_PIN 17
#else
#error Unknown display - board combination. Please add your pin mapping in DisplayList.h
#endif
#define UI_DISPLAY_CHARSET 1
#define UI_COLS 20
#define UI_ROWS 4
// UI
#define UI_HAS_KEYS 1
#define UI_HAS_BACK_KEY 1
#define UI_DELAYPERCHAR 50
#define UI_INVERT_MENU_DIRECTION 1
// Opportunity to override the Enter key via Configuration.h
// By default it duplicates the Right key, but could be set to
// anything else, e.g. UI_ACTION_TOP_MENU.
#ifndef ADC_KEYPAD_CENTER_ACTION
#define ADC_KEYPAD_CENTER_ACTION UI_ACTION_OK
#endif
#ifdef UI_MAIN
// Nothing to init since ADC is read in a loop if ADC_KEYPAD_PIN > -1
inline void uiInitKeys() {}
// Read and decode ADC keypad (fast reads)
void uiCheckKeys(uint16_t &action) {
struct {
uint16_t min;
uint16_t max;
uint16_t action;
} keys[] = {
{ 300, 500, UI_ACTION_BACK }, // Left
{ 570, 870, UI_ACTION_PREVIOUS }, // Up
{ 1150, 1450, ADC_KEYPAD_CENTER_ACTION }, // Center
{ 1900, 2200, UI_ACTION_OK }, // Right
{ 2670, 2870, UI_ACTION_NEXT } // Down
};
const uint8_t numOfKeys = sizeof(keys) / sizeof(keys[0]);
extern volatile uint16_t osAnalogInputValues[ANALOG_INPUTS];
uint16_t adc = osAnalogInputValues[KEYPAD_ANALOG_INDEX] >> (ANALOG_REDUCE_BITS);
if (adc < 4000) {
for (int8_t i = 0; i < numOfKeys; ++i) {
if ((adc > keys[i].min) && (adc < keys[i].max)) {
action = keys[i].action;
return;
}
}
}
}
// Read and decode ADC keypad (slow reads)
inline void uiCheckSlowKeys(uint16_t &action) {}
#endif // UI_MAIN
#endif // CONTROLLER_ZONESTAR
Which has no case for the mks board so guess you modified it to your pin numbers already. If the board works as I think with varying resistance you should see different adc values. You could add some test code to write the adc value to serial so you see it in your hosts console.
After
uint16_t adc = osAnalogInputValues[KEYPAD_ANALOG_INDEX] >> (ANALOG_REDUCE_BITS);
add
Com::printFLN(PSTR("Key:"), (int32_t)adc);
Then you see if it changes while pressing a key or not.
Also make sure no function is using pin D58 for anything else or it might override it to digital function.