Add serial configuration commands
This commit is contained in:
@@ -309,6 +309,52 @@ void handleDebugSerial() {
|
||||
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) {
|
||||
Serial.print("Unknown command: ");
|
||||
Serial.println(command);
|
||||
|
||||
Reference in New Issue
Block a user