feat: Allow screenshot retrieval from device (#820)
## Summary * Add a small loop in main to be able to receive external commands, currently being sent via the debugging_monitor * Implemented command: cmd:SCREENSHOT sends the currently displayed screen to the monitor, which will then store it to screenshot.bmp ## Additional Context I was getting annoyed with taking tilted/unsharp photos of the device screen, so I added the ability to press Enter during the monitor execution and type SCREENSHOT to send a command. Could be extended in the future [screenshot.bmp](https://github.com/user-attachments/files/25213230/screenshot.bmp) --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? No
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -369,6 +369,21 @@ void loop() {
|
||||
lastMemPrint = millis();
|
||||
}
|
||||
|
||||
// Handle incoming serial commands
|
||||
if (Serial.available() > 0) {
|
||||
String line = Serial.readStringUntil('\n');
|
||||
if (line.startsWith("CMD:")) {
|
||||
String cmd = line.substring(4);
|
||||
cmd.trim();
|
||||
if (cmd == "SCREENSHOT") {
|
||||
Serial.printf("SCREENSHOT_START:%d\n", HalDisplay::BUFFER_SIZE);
|
||||
uint8_t* buf = display.getFrameBuffer();
|
||||
Serial.write(buf, HalDisplay::BUFFER_SIZE);
|
||||
Serial.printf("SCREENSHOT_END\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for any user activity (button press or release) or active background work
|
||||
static unsigned long lastActivityTime = millis();
|
||||
if (gpio.wasAnyPressed() || gpio.wasAnyReleased() || (currentActivity && currentActivity->preventAutoSleep())) {
|
||||
|
||||
Reference in New Issue
Block a user