implement dynamic userbutton overwrite. fix #2434

This commit is contained in:
Thomas Göttgens
2023-04-18 14:22:37 +02:00
parent 1621fbb5ab
commit e0bb95ca94
5 changed files with 20 additions and 14 deletions

View File

@@ -218,10 +218,10 @@ void setup()
// If the button is connected to GPIO 12, don't enable the ability to use
// meshtasticAdmin on the device.
pinMode(BUTTON_PIN, INPUT);
pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT);
#ifdef BUTTON_NEED_PULLUP
gpio_pullup_en((gpio_num_t)BUTTON_PIN);
gpio_pullup_en((gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN));
delay(10);
#endif
@@ -389,10 +389,7 @@ void setup()
// scanEInkDevice();
#endif
#if HAS_BUTTON
// Buttons & LED
buttonThread = new ButtonThread();
#endif
// LED init
#ifdef LED_PIN
pinMode(LED_PIN, OUTPUT);
@@ -417,6 +414,11 @@ void setup()
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER)
router = new FloodingRouter();
#if HAS_BUTTON
// Buttons. Moved here cause we need NodeDB to be initialized
buttonThread = new ButtonThread();
#endif
playStartMelody();
// fixed screen override?