From 80230d2ff7e9c9cc391753301914376719956ad1 Mon Sep 17 00:00:00 2001 From: "ucart@co3050-12" <dawehr@iastate.edu> Date: Fri, 27 Jan 2017 20:43:51 -0600 Subject: [PATCH] communication commands now builds but the new callbacks need to be implementded. there is now no such thing as a message sub type. There is only a message type. this simplifies the commands struct greatly. the commands.c file was aprox 1400 lines and now it is about 150... --- quad/sw/modular_quad_pid/src/callbacks.c | 4 ++-- quad/sw/modular_quad_pid/src/communication.h | 2 +- quad/sw/modular_quad_pid/src/log_data.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/quad/sw/modular_quad_pid/src/callbacks.c b/quad/sw/modular_quad_pid/src/callbacks.c index c5dbafd02..fd3dbf2f4 100644 --- a/quad/sw/modular_quad_pid/src/callbacks.c +++ b/quad/sw/modular_quad_pid/src/callbacks.c @@ -23,7 +23,7 @@ int cb_getpacketlogs(modular_structs_t* structs) { // Message logging number of messages received and size of payload received int length = snprintf(buf, sizeof buf, "%d,%d", n_msg_received, total_payload_received); - send_data(MessageTypes[5].ID, MessageTypes[5].subtypes[1].ID, 0, buf, length >= sizeof(buf) ? 255 : length + 1); + send_data(MessageTypes[LOG_TYPE_ID].ID, 0, buf, length >= sizeof(buf) ? 255 : length + 1); return 0; } @@ -88,6 +88,6 @@ int cb_getval(modular_structs_t* structs) { // Message logging number of messages received and size of payload received int length = snprintf(buf, sizeof buf, "%f", structs->parameter_struct.yaw_angle_pid.Kp); - send_data(MessageTypes[2].ID, MessageTypes[2].subtypes[0].ID, 0, buf, length >= sizeof(buf) ? 255 : length + 1); + send_data(MessageTypes[GETVAL_TYPE_ID].ID, 0, buf, length >= sizeof(buf) ? 255 : length + 1); return 0; } diff --git a/quad/sw/modular_quad_pid/src/communication.h b/quad/sw/modular_quad_pid/src/communication.h index 12516af08..92c7c86d0 100644 --- a/quad/sw/modular_quad_pid/src/communication.h +++ b/quad/sw/modular_quad_pid/src/communication.h @@ -16,6 +16,6 @@ int initUartComms(); void process_received(modular_structs_t *structs); void uart_interrupt_handler(XUartPs *InstancePtr); -int send_data(u16 type_id, u16 subtype_id, u16 msg_id, char* data, size_t size); +int send_data(u16 type_id, u16 msg_id, char* data, size_t size); #endif diff --git a/quad/sw/modular_quad_pid/src/log_data.c b/quad/sw/modular_quad_pid/src/log_data.c index 2b4bfe550..5d8d1b5d3 100644 --- a/quad/sw/modular_quad_pid/src/log_data.c +++ b/quad/sw/modular_quad_pid/src/log_data.c @@ -147,7 +147,7 @@ void printLogging(){ strcat(buf,header); strcat(buf,units); - send_data(MessageTypes[LOG_TYPE_ID].ID, MessageTypes[5].subtypes[0].ID, 0, buf, strlen(buf) + 1); + send_data(MessageTypes[LOG_TYPE_ID].ID, 0, buf, strlen(buf) + 1); //uart0_sendBytes(buf, strlen(buf)); //usleep(100000); @@ -155,7 +155,7 @@ void printLogging(){ /* print & send log data */ for(i = 0; i < arrayIndex; i++){ char* logLine = format(logArray[i]); - send_data(MessageTypes[5].ID, MessageTypes[5].subtypes[0].ID, 0, logLine, strlen(logLine) + 1); + send_data(MessageTypes[LOG_TYPE_ID].ID, 0, logLine, strlen(logLine) + 1); free(logLine); } } -- GitLab