Public Access
Boot stub: periodic heap status and key logging on serial
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
+15
-2
@@ -19,11 +19,21 @@ void setup() {
|
|||||||
d.drawString("Press keys...", 8, 56);
|
d.drawString("Press keys...", 8, 56);
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.printf("%s %s, free heap %u, psram %u\n", roro::kProductName,
|
}
|
||||||
roro::versionString(), ESP.getFreeHeap(), ESP.getPsramSize());
|
|
||||||
|
static void printStatus() {
|
||||||
|
Serial.printf("%s %s, free heap %u, min free heap %u, psram %u\n", roro::kProductName,
|
||||||
|
roro::versionString(), ESP.getFreeHeap(), ESP.getMinFreeHeap(),
|
||||||
|
ESP.getPsramSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
static uint32_t lastStatus = 0;
|
||||||
|
if (millis() - lastStatus > 3000) {
|
||||||
|
lastStatus = millis();
|
||||||
|
printStatus();
|
||||||
|
}
|
||||||
|
|
||||||
M5Cardputer.update();
|
M5Cardputer.update();
|
||||||
if (M5Cardputer.Keyboard.isChange() && M5Cardputer.Keyboard.isPressed()) {
|
if (M5Cardputer.Keyboard.isChange() && M5Cardputer.Keyboard.isPressed()) {
|
||||||
auto state = M5Cardputer.Keyboard.keysState();
|
auto state = M5Cardputer.Keyboard.keysState();
|
||||||
@@ -32,5 +42,8 @@ void loop() {
|
|||||||
auto& d = M5Cardputer.Display;
|
auto& d = M5Cardputer.Display;
|
||||||
d.fillRect(0, 80, d.width(), 20, TFT_BLACK);
|
d.fillRect(0, 80, d.width(), 20, TFT_BLACK);
|
||||||
d.drawString("key: " + s, 8, 80);
|
d.drawString("key: " + s, 8, 80);
|
||||||
|
Serial.printf("keys: word='%s' fn=%d opt=%d ctrl=%d alt=%d shift=%d enter=%d del=%d tab=%d\n",
|
||||||
|
s.c_str(), state.fn, state.opt, state.ctrl, state.alt, state.shift,
|
||||||
|
state.enter, state.del, state.tab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user