Skip to content

Commit

Permalink
AnsiTerminal: changed version, added Serial port info
Browse files Browse the repository at this point in the history
  • Loading branch information
fdivitto committed Apr 1, 2021
1 parent c4a4f93 commit 8875883
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
14 changes: 10 additions & 4 deletions examples/VGA/AnsiTerminal/AnsiTerminal.ino
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,20 @@ void setup()

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.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("Screen Size : %d x %d\r\n", DisplayController->getScreenWidth(), DisplayController->getScreenHeight());
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("Mouse : %s\r\n", PS2Controller.mouse()->isMouseAvailable() ? "Yes" : "No");
//Terminal.printf("Mouse : %s\r\n", PS2Controller.mouse()->isMouseAvailable() ? "Yes" : "No");
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.printf("Free Memory : %d bytes\r\n", heap_caps_get_free_size(MALLOC_CAP_32BIT));
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("BootInfo", BOOTINFO_ENABLED);
Expand Down
14 changes: 11 additions & 3 deletions examples/VGA/AnsiTerminal/confdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Preferences preferences;


#define TERMVERSION_MAJ 1
#define TERMVERSION_MIN 3
#define TERMVERSION_MIN 4


static const char * BAUDRATES_STR[] = { "110", "300", "600", "1200", "2400", "4800", "9600", "14400", "19200", "38400", "57600", "115200", "128000", "230400", "250000", "256000", "500000", "1000000", "2000000" };
Expand Down Expand Up @@ -316,8 +316,7 @@ struct ConfDialogApp : public uiApp {
fontComboBox->selectedItem() != getFontIndex() ||
columnsComboBox->selectedItem() != getColumnsIndex() ||
rowsComboBox->selectedItem() != getRowsIndex() ||
bgColorComboBox->selectedColor() != getBGColor() ||
serctlCheckBox->checked() != getSerCtl();
bgColorComboBox->selectedColor() != getBGColor();

preferences.putInt("TermType", termComboBox->selectedItem());
preferences.putInt("KbdLayout", kbdComboBox->selectedItem());
Expand Down Expand Up @@ -415,6 +414,15 @@ struct ConfDialogApp : public uiApp {
static int getSerCtl() {
return preferences.getInt("SerCtl", SERCTL_DISABLED);
}

static char const * getSerParamStr() {
static char outstr[13];
snprintf(outstr, sizeof(outstr), "%s,%c%c%c", BAUDRATES_STR[getBaudRateIndex()],
DATALENS_STR[getDataLenIndex()][0],
PARITY_STR[getParityIndex()][0],
STOPBITS_STR[getStopBitsIndex() - 1][0]);
return outstr;
}

// if version in preferences doesn't match, reset preferences
static void checkVersion() {
Expand Down

0 comments on commit 8875883

Please sign in to comment.