Skip to content
Snippets Groups Projects
Commit 80230d2f authored by dawehr's avatar dawehr
Browse files

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...
parent d8b25942
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......@@ -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
......@@ -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);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment