fix messages
This commit is contained in:
@@ -56,13 +56,13 @@ func (s *DeviceState) handleWriteCommand(cmd string) string {
|
||||
return "ERRORE: I comandi 'W' sono accettati solo in modalità programmazione."
|
||||
}
|
||||
|
||||
// Parse command format: "W<id> <value>"
|
||||
parts := strings.Fields(cmd)
|
||||
// Parse command format: "W<id>=<value>"
|
||||
parts := strings.SplitN(cmd, "=", 2)
|
||||
if len(parts) != 2 {
|
||||
return "ERRORE: Formato comando non valido"
|
||||
}
|
||||
|
||||
// Extract parameter ID
|
||||
// Extract parameter ID (remove "W" prefix from first part)
|
||||
idStr := strings.TrimPrefix(parts[0], "W")
|
||||
id, err := strconv.Atoi(idStr)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user