feat: make VT100 console opt-in, off by default
The Box-3 display supersedes the VT100 serial UI, and the UI was actively harmful to the link: each full refresh writes ~600 bytes through the blocking Serial at 115200 baud (~40-50 ms) from the same core 0 task as Link_Process, degrading the STATE rate from 20 Hz to 10-16 Hz and delaying touch commands. VT100_UI_ENABLED (config.h, off by default) restores the old behaviour for debugging without a Box-3; status messages become plain event log lines when disabled.
This commit is contained in:
@@ -110,6 +110,16 @@
|
||||
#define LINK_UART_TX_PIN 22
|
||||
#define LINK_UART_RX_PIN 21
|
||||
|
||||
/*
|
||||
* VT100 serial console UI (TeraTerm/minicom). Superseded by the Box-3
|
||||
* display: each full refresh blocks the core 0 task ~40-50 ms at
|
||||
* 115200 baud, degrading the link STATE rate from 20 Hz down to
|
||||
* 10-16 Hz and delaying touch command handling. Enable only for
|
||||
* debugging without a Box-3 attached; status messages are plain log
|
||||
* lines when disabled.
|
||||
*/
|
||||
//#define VT100_UI_ENABLED
|
||||
|
||||
/* our samplerate */
|
||||
#define SAMPLE_RATE 44100
|
||||
|
||||
|
||||
@@ -209,6 +209,7 @@ void Status_PrintAll(void)
|
||||
|
||||
void Status_Process(void)
|
||||
{
|
||||
#ifdef VT100_UI_ENABLED
|
||||
status_cnt ++;
|
||||
if (status_cnt > 1000 * 3)
|
||||
{
|
||||
@@ -223,6 +224,7 @@ void Status_Process(void)
|
||||
loopMeterCount = 0;
|
||||
Status_PrintAll();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -230,9 +232,14 @@ void Status_Process(void)
|
||||
*/
|
||||
void Status_ValueChangedFloat(const char *descr, float value)
|
||||
{
|
||||
#ifdef VT100_UI_ENABLED
|
||||
status_cnt = 0;
|
||||
memset(statusMsg, 0, sizeof(statusMsg));
|
||||
sprintf(statusMsg, "%s: %0.2f", descr, value);
|
||||
#else
|
||||
/* the Box-3 is the main display: keep events as plain log lines */
|
||||
Serial.printf("[status] %s: %0.2f\n", descr, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -240,9 +247,13 @@ void Status_ValueChangedFloat(const char *descr, float value)
|
||||
*/
|
||||
void Status_ValueChangedInt(const char *descr, int value)
|
||||
{
|
||||
#ifdef VT100_UI_ENABLED
|
||||
status_cnt = 0;
|
||||
memset(statusMsg, 0, sizeof(statusMsg));
|
||||
sprintf(statusMsg, "%s: %d", descr, value);
|
||||
#else
|
||||
Serial.printf("[status] %s: %d\n", descr, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -250,7 +261,11 @@ void Status_ValueChangedInt(const char *descr, int value)
|
||||
*/
|
||||
void Status_TestMsg(const char *text)
|
||||
{
|
||||
#ifdef VT100_UI_ENABLED
|
||||
status_cnt = 0;
|
||||
memset(statusMsg, 0, sizeof(statusMsg));
|
||||
sprintf(statusMsg, "%s", text);
|
||||
#else
|
||||
Serial.printf("[status] %s\n", text);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user