Init button after syslog, allow gpio0 for button

This commit is contained in:
MichaelDvP
2021-03-04 16:14:30 +01:00
parent 7299be15df
commit 6c783b015f

View File

@@ -192,10 +192,10 @@ void System::start(uint32_t heap_start) {
get_settings();
commands_init(); // console & api commands
button_init(false); // the special button
led_init(false); // init LED
syslog_init(false); // init SysLog
adc_init(false); // analog ADC
syslog_init(false); // init SysLog
button_init(false); // the special button
network_init(); // network
EMSESP::init_tx(); // start UART
}
@@ -263,19 +263,19 @@ void System::button_init(bool refresh) {
get_settings();
}
if (pbutton_gpio_) {
// Allow 0 for Boot-button on NodeMCU-32s?
// if (pbutton_gpio_) {
if (!myPButton_.init(pbutton_gpio_, HIGH)) {
LOG_INFO(F("External multi-functional button not detected"));
} else {
LOG_INFO(F("External multi-functional button enabled"));
}
myPButton_.onClick(BUTTON_Debounce, button_OnClick);
myPButton_.onDblClick(BUTTON_DblClickDelay, button_OnDblClick);
myPButton_.onLongPress(BUTTON_LongPressDelay, button_OnLongPress);
myPButton_.onVLongPress(BUTTON_VLongPressDelay, button_OnVLongPress);
}
// }
}
// set the LED to on or off when in normal operating mode
@@ -591,7 +591,7 @@ void System::show_system(uuid::console::Shell & shell) {
#ifndef EMSESP_STANDALONE
shell.printfln(F("SDK version: %s"), ESP.getSdkVersion());
shell.printfln(F("CPU frequency: %u MHz"), ESP.getCpuFreqMHz());
shell.printfln(F("Free heap: %lu bytes"), (uint32_t)ESP.getFreeHeap());
shell.printfln(F("Free heap: %lu bytes"), (uint32_t)ESP.getFreeHeap());
shell.println();
switch (WiFi.status()) {