optimized by Claude for faster processing + lower memory usage

This commit is contained in:
Aditya Pulipaka
2025-11-16 20:14:11 -06:00
parent 676e4d78a8
commit 9c04f6264e
4 changed files with 15 additions and 16 deletions

View File

@@ -60,12 +60,11 @@ void setup() {
void loop() {
if (Serial.available() > 0) {
String inputString = Serial.readStringUntil('\n'); // Read the full input
inputString.trim(); // Remove leading/trailing whitespace, including \n and \r
// this might need to be changed if we have trouble getting serial to read.
char c = Serial.read();
while(Serial.available()) Serial.read(); // flush remaining
// determine whether control is on or off based on serial input.
if (inputString == "0") controller.outputOn=0;
else controller.outputOn=1;
controller.outputOn = (c != '0');
}
tDiffMicros = micros() - tprior;