Fix backtick back button to work reliably, improve Terminal Shell responsiveness, enhance HID Injector feedback
This commit is contained in:
@@ -159,20 +159,20 @@ void Shell::loop() {
|
||||
if (M5Cardputer.Keyboard.isChange() && M5Cardputer.Keyboard.isPressed()) {
|
||||
auto st = M5Cardputer.Keyboard.keysState();
|
||||
for (char c : st.word) {
|
||||
if (c == '`') { if (active >= 0) back(); continue; }
|
||||
if (c == '`' || c == 27) { if (active >= 0) { back(); continue; } }
|
||||
if (active < 0) {
|
||||
if (c == ';') { sel = (sel - 1 + nmods) % nmods; drawMenu(); }
|
||||
else if (c == '.') { sel = (sel + 1) % nmods; drawMenu(); }
|
||||
else if (c == '\r' || c == ' ') enter(sel);
|
||||
} else {
|
||||
mods[active]->onKey(c);
|
||||
bool consumed = mods[active]->onKey(c);
|
||||
if (!consumed && c == '`') back();
|
||||
}
|
||||
}
|
||||
if (st.enter && active < 0) enter(sel);
|
||||
}
|
||||
|
||||
if (active < 0) {
|
||||
// keep the selection glow breathing — repaints only the bar strip (flicker-free)
|
||||
if (millis() - lastTick > 90) { lastTick = millis(); drawMenu(false); }
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,12 +21,13 @@ public:
|
||||
void onEnter() override {
|
||||
active = false;
|
||||
sent = 0;
|
||||
say("HID ready, plug USB host");
|
||||
say("HID ready");
|
||||
#ifdef HAVE_TINYSB
|
||||
if (tud_mounted()) {
|
||||
active = true;
|
||||
sent = 0;
|
||||
say("Host detected - injecting");
|
||||
say("Host detected!");
|
||||
say("Injecting...");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -43,10 +43,13 @@ public:
|
||||
|
||||
void tick() override {
|
||||
if (!connected) return;
|
||||
while (ser.available()) {
|
||||
uint32_t start = millis();
|
||||
while (ser.available() && millis() - start < 10) {
|
||||
char c = ser.read();
|
||||
if (rxPos < sizeof(rxBuffer) - 1) rxBuffer[rxPos++] = c;
|
||||
if (rxPos >= sizeof(rxBuffer) - 1) rxPos = sizeof(rxBuffer) - 1;
|
||||
if (rxPos < sizeof(rxBuffer) - 1) {
|
||||
rxBuffer[rxPos++] = c;
|
||||
if (c == '\n') rxPos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user