#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 1
#include "confdialog.h"
void setup()
{
#if FABGLIB_TERMINAL_DEBUG_REPORT
Serial.
begin(115200); delay(500); Serial.write(
"\n\nReset\n\n");
#endif
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 FABGLIB_TERMINAL_DEBUG_REPORT
#endif
if (ConfDialogApp::getBootInfo() == BOOTINFO_ENABLED) {
Terminal.
write(
"* * FabGL - Serial Terminal * *\r\n");
Terminal.
write(
"* * 2019-2022 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);
}
int getViewPortHeight()
Determines vertical size of the viewport.
int getViewPortWidth()
Determines horizontal size of the viewport.
Represents the base abstract class for bitmapped display controllers.
bool isKeyboardAvailable()
Checks if keyboard has been detected and correctly initialized.
void emptyVirtualKeyQueue()
Empties the virtual keys queue.
void emptyQueue()
Empties the mouse status and events queue.
static void quickCheckHardware()
Disable re-try when a mouse is not found.
static Mouse * mouse()
Returns the instance of Mouse object automatically created by PS2Controller.
static Keyboard * keyboard()
Returns the instance of Keyboard object automatically created by PS2Controller.
static void begin(gpio_num_t port0_clkGPIO, gpio_num_t port0_datGPIO, gpio_num_t port1_clkGPIO=GPIO_UNUSED, gpio_num_t port1_datGPIO=GPIO_UNUSED)
Initializes PS2 device controller.
The PS2 device controller class.
int getRows()
Returns the number of lines.
void clear(bool moveCursor=true)
Clears the screen.
void setLogStream(Stream &stream)
Sets the stream where to output debugging logs.
int getColumns()
Returns the number of columns.
static int keyboardReaderTaskStackSize
Stack size of the task that reads keys from keyboard and send ANSI/VT codes to output stream in Termi...
size_t write(const uint8_t *buffer, size_t size)
Sends specified number of codes to the display.
void deactivate()
Deactivates this terminal.
Keyboard * keyboard()
Gets associated keyboard object.
static int inputQueueSize
Number of characters the terminal can "write" without pause (increase if you have loss of characters ...
void activate(TerminalTransition transition=TerminalTransition::None)
Activates this terminal for input and output.
void enableCursor(bool value)
Enables or disables cursor.
Delegate< VirtualKeyItem * > onVirtualKeyItem
Delegate called whenever a new virtual key is received from keyboard, including shift states.
bool begin(BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr)
Initializes the terminal.
Delegate< char const * > onUserSequence
Delegate called whenever a new user sequence has been received.
An ANSI-VT100 compatible display terminal.
This file is the all in one include file. Application can just include this file to use FabGL library...