#include <err.h> #include <stdio.h> #include "frontend_setsetpoint.h" #include "setpoint_common.h" #include "frontend_common.h" int frontend_setsetpoint( struct backend_conn * conn, struct frontend_setpoint_data * setpoint_data, int mask) { if (conn == NULL) { return -1; } char buffer[2048]; /* Set the P, I, and D */ if (mask & SET_X) { if (snprintf(buffer, 2048, "setsetpointx %f\n", setpoint_data->x) >= 2048) { errx(0, "Buffer to small to format!"); } ucart_backendWrite(conn, buffer); } if (mask & SET_Y) { if (snprintf(buffer, 2048, "setsetpointy %f\n", setpoint_data->y) >= 2048) { errx(0, "Buffer to small to format!"); } ucart_backendWrite(conn, buffer); } if (mask & SET_Z) { if (snprintf(buffer, 2048, "setsetpointz %f\n", setpoint_data->z) >= 2048) { errx(0, "Buffer to small to format!"); } ucart_backendWrite(conn, buffer); } return 0; }