new message

This commit is contained in:
ackimixs
2025-12-20 13:07:16 +01:00
parent af2908afc9
commit e3286edaa4
2 changed files with 5 additions and 5 deletions

View File

@@ -91,7 +91,7 @@ void USB_Comm_Process(void) {
float p, i, d, v_min, v_max;
if (Comm_GetPID(pid, p, i, d, v_min, v_max)) {
char response[64];
snprintf(response, sizeof(response), "SET;PID;%.4f;%.4f;%.4f;%.4f,%.4f\n", p, i, d, v_min, v_max);
snprintf(response, sizeof(response), "SET;PID;%.4f;%.4f;%.4f;%.4f;%.4f\n", p, i, d, v_min, v_max);
USB_Comm_Send(response);
}
else {
@@ -133,14 +133,14 @@ void USB_Comm_Process(void) {
}
char response[128];
snprintf(response, sizeof(response), "SET;WAYPOINT;%d,%d,%.4f,%.4f,%.4f,%d\n", id, type, x, y, theta, active);
snprintf(response, sizeof(response), "SET;WAYPOINT;%d;%d;%.4f;%.4f;%.4f;%d\n", id, type, x, y, theta, active);
USB_Comm_Send(response);
}
else if (strcmp(token, "MOTOR") == 0) {
float l, r;
Comm_GetPWM(l, r);
char response[64];
snprintf(response, sizeof(response), "SET;MOTOR;%.2f,%.2f\n", l, r);
snprintf(response, sizeof(response), "SET;MOTOR;%.2f;%.2f\n", l, r);
USB_Comm_Send(response);
}
else if (strcmp(token, "ACTION") == 0) {

View File

@@ -151,7 +151,7 @@ void DiffBot::update(float dt) {
motor.stop(true);
char log[32];
sprintf(log, "SET;WAYPOINT;%d\n", index);
sprintf(log, "SET;WAYPOINT;REACH;%d\n", index);
CDC_Transmit_FS((uint8_t*)log, strlen(log));
resetPID();
@@ -165,7 +165,7 @@ void DiffBot::update(float dt) {
if (std::fabs(dx) < precisePos && std::fabs(dy) < precisePos) {
char log[32];
sprintf(log, "SET;WAYPOINT;%d\n", index);
sprintf(log, "SET;WAYPOINT;REACH;%d\n", index);
CDC_Transmit_FS((uint8_t*)log, strlen(log));
targets[index].active = false;