#define UART_RX 34
#define UART_TX 2
#define RESET_PIN 12
#include "confdialog.h"
void setup()
{
preferences.begin("AnsiTerminal", false);
ConfDialogApp::checkVersion();
pinMode(RESET_PIN, INPUT);
if (digitalRead(RESET_PIN) == 1)
preferences.clear();
PS2Controller.
begin(PS2Preset::KeyboardPort0_MousePort1);
ConfDialogApp::setupDisplay();
ConfDialogApp::loadConfiguration();
if (ConfDialogApp::getBootInfo() == BOOTINFO_ENABLED) {
Terminal.
write(
"* * FabGL - Serial Terminal * *\r\n");
Terminal.
write(
"* * 2019-2020 by Fabrizio Di Vittorio - www.fabgl.com * *\r\n\n");
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()]);
Terminal.printf("Free Memory : %d bytes\r\n", heap_caps_get_free_size(MALLOC_CAP_32BIT));
Terminal.printf("Version : %d.%d\r\n", TERMVERSION_MAJ, TERMVERSION_MIN);
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("BootInfo", BOOTINFO_ENABLED);
}
if (!keyDown) {
auto dlgApp = new ConfDialogApp;
dlgApp->run(DisplayController);
auto progToInstall = dlgApp->progToInstall;
delete dlgApp;
if (progToInstall > -1)
installProgram(progToInstall);
} else {
preferences.clear();
auto rebootApp = new RebootDialogApp;
rebootApp->run(DisplayController);
}
}
}
};
for (int i = 0; i < RESOLUTIONS_COUNT; ++i)
if (strcmp(RESOLUTIONS_CMDSTR[i], seq) == 0) {
preferences.putInt("TempResolution", i);
if (ConfDialogApp::getBootInfo() == BOOTINFO_ENABLED)
preferences.putInt("BootInfo", BOOTINFO_TEMPDISABLED);
ESP.restart();
}
};
}
void loop()
{
vTaskDelete(NULL);
}