Add serial configuration commands

This commit is contained in:
2026-06-04 01:42:49 -06:00
parent 59c963e309
commit 83b7c73dc6
@@ -309,6 +309,52 @@ void handleDebugSerial() {
return; return;
} }
if (command.startsWith("relayname ")) {
int firstSpace = command.indexOf(' ');
int secondSpace = command.indexOf(' ', firstSpace + 1);
if (secondSpace > 0) {
int relayNumber = command.substring(firstSpace + 1, secondSpace).toInt();
if (relayNumber >= 1 && relayNumber <= MAX_RELAYS) {
appConfig.relays[relayNumber - 1].name =
command.substring(secondSpace + 1);
Serial.println("OK relay name updated");
return;
}
}
}
if (command.startsWith("tempname ")) {
int firstSpace = command.indexOf(' ');
int secondSpace = command.indexOf(' ', firstSpace + 1);
if (secondSpace > 0) {
int sensorNumber = command.substring(firstSpace + 1, secondSpace).toInt();
if (sensorNumber >= 1 && sensorNumber <= MAX_TEMP_SENSORS) {
appConfig.tempSensors[sensorNumber - 1].name =
command.substring(secondSpace + 1);
Serial.println("OK temp sensor name updated");
return;
}
}
}
if (command.startsWith("bmsname ")) {
appConfig.bms.name = command.substring(8);
Serial.println("OK bms name updated");
return;
}
if (command.startsWith("bmsaddr ")) {
appConfig.bms.address = command.substring(8);
Serial.println("OK bms address updated");
return;
}
if (command.length() > 0) { if (command.length() > 0) {
Serial.print("Unknown command: "); Serial.print("Unknown command: ");
Serial.println(command); Serial.println(command);