Commits

Trammell Hudson committed 04ea431

try to track transiting; does not work

  • Participants
  • Parent commits e9fdf18

Comments (0)

Files changed (1)

 	int position;
 	int speed;
 	int amps;
+	int transiting; // reset by the done flag
 };
 
 
 		return 0;
 	}
 
+	if (strcmp(type, "DR") == 0)
+	{
+		// reset the transiting flag when we have reached
+		// the destination point.  it is only enabled
+		// by sending a command to move the axis.
+		// this seems broken.
+		if (x && controller->servo[0].transiting)
+		{
+			printf("x transit done\n");
+			controller->servo[0].transiting = 0;
+		}
+		if (y && controller->servo[1].transiting)
+		{
+			printf("y transit done\n");
+			controller->servo[1].transiting = 0;
+		}
+		return 0;
+	}
+
 	// unknown, but who cares
 	return 0;
 }
 		rem = sizeof(controller->buf);
 	}
 
-	ssize_t rc = read(controller->fd, controller->buf + controller->offset, rem);
+	ssize_t rc = read(
+		controller->fd,
+		controller->buf + controller->offset,
+		rem
+	);
+
 	if (rc < 0)
 	{
 		if (errno == EINTR || errno == EWOULDBLOCK)
 	const int pos
 )
 {
+	servo_t * const servo = &controller->servo[channel];
+	servo->transiting = 1;
+
 	printf("%s: channel %d pos %d\n", controller->device, channel, pos);
 	controller_send(controller, "!p %d %d\r\n", channel, pos);
 	return 0;