#define UART_URX 3
#define UART_UTX 1
#define UART_SRX 34
#define UART_STX 2
#define RTS 13
#define CTS 35
#define RESET_PIN 39
#define RESET_PIN_ACTIVE 0
#define USERESETPIN 0
#include "confdialog.h"
void setup()
{
disableCore0WDT();
delay(100);
disableCore1WDT();
preferences.begin("AnsiTerminal", false);
ConfDialogApp::checkVersion();
#if USERESETPIN
pinMode(RESET_PIN, INPUT);
if (digitalRead(RESET_PIN) == RESET_PIN_ACTIVE)
preferences.clear();
#endif
PS2Controller.
begin(PS2Preset::KeyboardPort0_MousePort1);
ConfDialogApp::setupDisplay();
ConfDialogApp::loadConfiguration();
if (ConfDialogApp::getBootInfo() == BOOTINFO_ENABLED) {
Terminal.
write(
"* * FabGL - Serial Terminal * *\r\n");
Terminal.
write(
"* * 2019-2021 by Fabrizio Di Vittorio - www.fabgl.com * *\r\n\n");
Terminal.printf("Version : %d.%d\r\n", TERMVERSION_MAJ, TERMVERSION_MIN);
Terminal.printf(
"Terminal Size : %d x %d\r\n", Terminal.
getColumns(), Terminal.
getRows());
Terminal.printf(
"Keyboard Layout : %s\r\n", PS2Controller.
keyboard()->
isKeyboardAvailable() ? SupportedLayouts::names()[ConfDialogApp::getKbdLayoutIndex()] :
"No Keyboard");
Terminal.printf("Terminal Type : %s\r\n", SupportedTerminals::names()[(int)ConfDialogApp::getTermType()]);
if (ConfDialogApp::getSerCtl() == SERCTL_ENABLED)
Terminal.printf("Serial Port : USB RX-Pin[%d] TX-Pin[%d]\r\n", UART_URX, UART_UTX);
else
Terminal.printf("Serial Port : Serial RX-Pin[%d] TX-Pin[%d]\r\n", UART_SRX, UART_STX);
Terminal.printf("Serial Parameters : %s\r\n", ConfDialogApp::getSerParamStr());
Terminal.
write(
"\r\nPress F12 to change terminal configuration and CTRL-ALT-F12 to reset settings\r\n\n");
} else if (ConfDialogApp::getBootInfo() == BOOTINFO_TEMPDISABLED) {
preferences.putInt(PREF_BOOTINFO, BOOTINFO_ENABLED);
}
if (vkItem->CTRL && (vkItem->LALT || vkItem->RALT)) {
preferences.clear();
auto rebootApp = new RebootDialogApp;
rebootApp->run(DisplayController);
} else if (!vkItem->CTRL && !vkItem->LALT && !vkItem->RALT && !vkItem->down) {
auto dlgApp = new ConfDialogApp;
dlgApp->run(DisplayController);
auto progToInstall = dlgApp->progToInstall;
delete dlgApp;
if (progToInstall > -1)
installProgram(progToInstall);
}
}
};
for (int i = 0; i < RESOLUTIONS_COUNT; ++i)
if (strcmp(RESOLUTIONS_CMDSTR[i], seq) == 0) {
preferences.putInt(PREF_TEMPRESOLUTION, i);
if (ConfDialogApp::getBootInfo() == BOOTINFO_ENABLED)
preferences.putInt(PREF_BOOTINFO, BOOTINFO_TEMPDISABLED);
ESP.restart();
}
};
}
void loop()
{
vTaskDelete(NULL);
}