 
 	if (len == 0) return false;
 
+	wifi.Send(chlID,F("processCommand"));
+	wifi.Send(chlID,cmd);
+
 	switch (buf[0]) {
 		case 'G': case 'g':
 			code = strtoul(&buf[1], &endptr, 10);
 			if (endptr == &buf[1]) {
-				Serial.println(F("ERROR: missing G command code"));
+				wifi.Send(chlID,F("ERROR: missing G command code"));
 				return false;
 			}
 			if (code == 0) {

	moveServoRot(defaultServoPos, servoSpeed, false, false);
	moveServoHRot(defaultServoPos, servoSpeed, false, false);
	moveServoH(defaultServoPos, servoSpeed, true, true);
}

/*

					} else if (code == 1) {
						wait = true;
					} else {
						wifi.Send(chlID,F("ERROR: invalid G command wait flag (bad number)"));
						return false;
					}
				} else {
					wifi.Send(chlID,F("ERROR: invalid G command wait flag (no number)"));
					return false;
				}
			}
			do {
				// absorb spaces
				for (; *endptr == ' ' || *endptr == '\t'; ++endptr);
				wifi.Send(chlID,endptr);
			} while (parseCommandGServo(&endptr, speedControl, wait));
			break;
		case 'F': case 'f':
			code = strtoul(&buf[1], &endptr, 10);
			if (endptr == &buf[1]) {
				wifi.Send(chlID,F("ERROR: missing F speed parameter"));
				return false;
			}
			if (code >= 0 && code <= 255) {
				servoSpeed = code;
				wifi.Send(chlID,F("OK"));
				return true;
			} else {
				wifi.Send(chlID,F("ERROR: invalid F speed parameter"));
				return false;
			}
			break;
		case 'M': case 'm':
			code = strtoul(&buf[1], &endptr, 10);
			if (endptr == &buf[1]) {
				wifi.Send(chlID,F("ERROR: missing M address parameter"));
				return false;
			}
			switch (code) {
				case 100:
					wifi.Send(chlID,F("OK"));
					softwareReset();
					break;
				case 101:
					wifi.Send(chlID,String(freeRam(), DEC));
					break;
				case 112:
					detachServos();
					wifi.Send(chlID,F("OK"));
					break;
				default:
					wifi.Send(chlID,F("ERROR: invalid M address parameter"));
					return false;
			};
			break;
		default:
			wifi.Send(chlID,F("ERROR: invalid command"));
			return false;
	};
}

const uint8_t MAX_CMD_LEN = 128;
char buf[MAX_CMD_LEN + 1], c;
uint8_t len = 0;

void loop() {
	len = wifi.ReceiveMessage(buf);
	if (len > 0) {
		processCommand(buf);
	}
}
