From 41b7d72d06a32e7a207d4509d2966527078febd7 Mon Sep 17 00:00:00 2001 From: "ucart@co3050-12" <dawehr@iastate.edu> Date: Fri, 27 Jan 2017 18:01:46 -0600 Subject: [PATCH] starting some of the commands changes to make things simpler but not complete --- groundStation/src/backend/commands.c | 1411 ++-------------------- groundStation/src/backend/commands.h | 28 +- quad/sw/modular_quad_pid/src/callbacks.c | 2 +- 3 files changed, 117 insertions(+), 1324 deletions(-) diff --git a/groundStation/src/backend/commands.c b/groundStation/src/backend/commands.c index 5c42238af..36f42bcd4 100644 --- a/groundStation/src/backend/commands.c +++ b/groundStation/src/backend/commands.c @@ -55,1338 +55,123 @@ command_cb cb_beginupdate __attribute__((weak, alias("cb_default"))); command_cb cb_log __attribute__((weak, alias("cb_default"))); command_cb cb_response __attribute__((weak, alias("cb_default"))); -/* Callbacks for configuration (setters)*/ -command_cb cb_setrollp __attribute__((weak, alias("cb_default"))); -command_cb cb_setrolli __attribute__((weak, alias("cb_default"))); -command_cb cb_setrolld __attribute__((weak, alias("cb_default"))); -command_cb cb_setpitchp __attribute__((weak, alias("cb_default"))); -command_cb cb_setpitchi __attribute__((weak, alias("cb_default"))); -command_cb cb_setpitchd __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawp __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawi __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawd __attribute__((weak, alias("cb_default"))); -command_cb cb_setrollratep __attribute__((weak, alias("cb_default"))); -command_cb cb_setrollratei __attribute__((weak, alias("cb_default"))); -command_cb cb_setrollrated __attribute__((weak, alias("cb_default"))); -command_cb cb_setpitchratep __attribute__((weak, alias("cb_default"))); -command_cb cb_setpitchratei __attribute__((weak, alias("cb_default"))); -command_cb cb_setpitchrated __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawratep __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawratei __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawrated __attribute__((weak, alias("cb_default"))); -command_cb cb_setlocalxp __attribute__((weak, alias("cb_default"))); -command_cb cb_setlocalxi __attribute__((weak, alias("cb_default"))); -command_cb cb_setlocalxd __attribute__((weak, alias("cb_default"))); -command_cb cb_setlocalyp __attribute__((weak, alias("cb_default"))); -command_cb cb_setlocalyi __attribute__((weak, alias("cb_default"))); -command_cb cb_setlocalyd __attribute__((weak, alias("cb_default"))); -command_cb cb_setaltp __attribute__((weak, alias("cb_default"))); -command_cb cb_setalti __attribute__((weak, alias("cb_default"))); -command_cb cb_setaltd __attribute__((weak, alias("cb_default"))); -command_cb cb_setrollsp __attribute__((weak, alias("cb_default"))); -command_cb cb_setpitchsp __attribute__((weak, alias("cb_default"))); -command_cb cb_setyawsp __attribute__((weak, alias("cb_default"))); -command_cb cb_setaltsp __attribute__((weak, alias("cb_default"))); -command_cb cb_setlonsp __attribute__((weak, alias("cb_default"))); -command_cb cb_setlatsp __attribute__((weak, alias("cb_default"))); - -/* Default callbacks for getters */ -command_cb cb_getrollp __attribute__((weak, alias("cb_default"))); -command_cb cb_getrolli __attribute__((weak, alias("cb_default"))); -command_cb cb_getrolld __attribute__((weak, alias("cb_default"))); -command_cb cb_getpitchp __attribute__((weak, alias("cb_default"))); -command_cb cb_getpitchi __attribute__((weak, alias("cb_default"))); -command_cb cb_getpitchd __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawp __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawi __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawd __attribute__((weak, alias("cb_default"))); -command_cb cb_getrollratep __attribute__((weak, alias("cb_default"))); -command_cb cb_getrollratei __attribute__((weak, alias("cb_default"))); -command_cb cb_getrollrated __attribute__((weak, alias("cb_default"))); -command_cb cb_getpitchratep __attribute__((weak, alias("cb_default"))); -command_cb cb_getpitchratei __attribute__((weak, alias("cb_default"))); -command_cb cb_getpitchrated __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawratep __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawratei __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawrated __attribute__((weak, alias("cb_default"))); -command_cb cb_getlocalxp __attribute__((weak, alias("cb_default"))); -command_cb cb_getlocalxi __attribute__((weak, alias("cb_default"))); -command_cb cb_getlocalxd __attribute__((weak, alias("cb_default"))); -command_cb cb_getlocalyp __attribute__((weak, alias("cb_default"))); -command_cb cb_getlocalyi __attribute__((weak, alias("cb_default"))); -command_cb cb_getlocalyd __attribute__((weak, alias("cb_default"))); -command_cb cb_getaltp __attribute__((weak, alias("cb_default"))); -command_cb cb_getalti __attribute__((weak, alias("cb_default"))); -command_cb cb_getaltd __attribute__((weak, alias("cb_default"))); -command_cb cb_getrollsp __attribute__((weak, alias("cb_default"))); -command_cb cb_getpitchsp __attribute__((weak, alias("cb_default"))); -command_cb cb_getyawsp __attribute__((weak, alias("cb_default"))); -command_cb cb_getaltsp __attribute__((weak, alias("cb_default"))); -command_cb cb_getlonsp __attribute__((weak, alias("cb_default"))); -command_cb cb_getlatsp __attribute__((weak, alias("cb_default"))); - -/* Default callbacks for responses */ -command_cb cb_resprollp __attribute__((weak, alias("cb_default"))); -command_cb cb_resprolli __attribute__((weak, alias("cb_default"))); -command_cb cb_resprolld __attribute__((weak, alias("cb_default"))); -command_cb cb_resppitchp __attribute__((weak, alias("cb_default"))); -command_cb cb_resppitchi __attribute__((weak, alias("cb_default"))); -command_cb cb_resppitchd __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawp __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawi __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawd __attribute__((weak, alias("cb_default"))); -command_cb cb_resprollratep __attribute__((weak, alias("cb_default"))); -command_cb cb_resprollratei __attribute__((weak, alias("cb_default"))); -command_cb cb_resprollrated __attribute__((weak, alias("cb_default"))); -command_cb cb_resppitchratep __attribute__((weak, alias("cb_default"))); -command_cb cb_resppitchratei __attribute__((weak, alias("cb_default"))); -command_cb cb_resppitchrated __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawratep __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawratei __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawrated __attribute__((weak, alias("cb_default"))); -command_cb cb_resplocalxp __attribute__((weak, alias("cb_default"))); -command_cb cb_resplocalxi __attribute__((weak, alias("cb_default"))); -command_cb cb_resplocalxd __attribute__((weak, alias("cb_default"))); -command_cb cb_resplocalyp __attribute__((weak, alias("cb_default"))); -command_cb cb_resplocalyi __attribute__((weak, alias("cb_default"))); -command_cb cb_resplocalyd __attribute__((weak, alias("cb_default"))); -command_cb cb_respaltp __attribute__((weak, alias("cb_default"))); -command_cb cb_respalti __attribute__((weak, alias("cb_default"))); -command_cb cb_respaltd __attribute__((weak, alias("cb_default"))); -command_cb cb_resprollsp __attribute__((weak, alias("cb_default"))); -command_cb cb_resppitchsp __attribute__((weak, alias("cb_default"))); -command_cb cb_respyawsp __attribute__((weak, alias("cb_default"))); -command_cb cb_respaltsp __attribute__((weak, alias("cb_default"))); -command_cb cb_resplonsp __attribute__((weak, alias("cb_default"))); -command_cb cb_resplatsp __attribute__((weak, alias("cb_default"))); +/* Callbacks for configuration */ +command_cb cb_setval __attribute__((weak, alias("cb_default"))); +command_cb cb_getval __attribute__((weak, alias("cb_default"))); +command_cb cb_respval __attribute__((weak, alias("cb_default"))); /* Command structure */ struct MessageType MessageTypes[MAX_TYPE] = { // DEBUG { - // Message Type ID: Misc. callbacks + // ID DEBUG_TYPE_ID, - - // Debug Subtypes - { - // NONE subtype - { - // ID - DEBUG_SUBTYPE_ID, - // Command text - "debug", - // Type of the command data - stringType, - // Function pointer - &cb_debug - }, - // NONE subtype - { - // ID - PACKETLOG_SUBTYPE_ID, - // Command text - "packetlog", - // Type of the command data - stringType, - // Function pointer - &cb_packetlog - }, - // NONE subtype - { - // ID - GETPACKETLOGS_SUBTYPE_ID, - // Command text - "getpacketlogs", - // Type of the command data - stringType, - // Function pointer - &cb_getpacketlogs - } - } + // Command text + "debug", + // Type of the command data + stringType, + // Function pointer + &cb_debug }, - - // CALIBRATION + // PACKETLOG { - // Message Type ID: Callbacks for configuration (setters) - SETTER_TYPE_ID, - - // Calibration Subtypes (PID coefficients) - { - // roll p constant subtype - { - // ID - SETROLLP_SUBTYPE_ID, - // Command text - "setrollp", - // Type of the command data - floatType, - // Function pointer - &cb_setrollp - }, - // roll i constant subtype - { - // ID - SETROLLI_SUBTYPE_ID, - // Command text - "setrolli", - // Type of the command data - floatType, - // Function pointer - &cb_setrolli - }, - // roll d constant subtype - { - // ID - SETROLLD_SUBTYPE_ID, - // Command text - "setrolld", - // Type of the command data - floatType, - // Function pointer - &cb_setrolld - }, - // pitch p constant subtype - { - // ID - SETPITCHP_SUBTYPE_ID, - // Command text - "setpitchp", - // Type of the command data - floatType, - // Function pointer - &cb_setpitchp - }, - // pitch i constant subtype - { - // ID - SETPITCHI_SUBTYPE_ID, - // Command text - "setpitchi", - // Type of the command data - floatType, - // Function pointer - &cb_setpitchi - }, - // pitch d constant subtype - { - // ID - SETPITCHD_SUBTYPE_ID, - // Command text - "setpitchd", - // Type of the command data - floatType, - // Function pointer - &cb_setpitchd - }, - // yaw p constant subtype - { - // ID - SETYAWP_SUBTYPE_ID, - // Command text - "setyawp", - // Type of the command data - floatType, - // Function pointer - &cb_setyawp - }, - // yaw i constant subtype - { - // ID - SETYAWI_SUBTYPE_ID, - // Command text - "setyawi", - // Type of the command data - floatType, - // Function pointer - &cb_setyawi - }, - // yaw d constant subtype - { - // ID - SETYAWD_SUBTYPE_ID, - // Command text - "setyawd", - // Type of the command data - floatType, - // Function pointer - &cb_setyawd - }, - // rollrate p constant subtype - { - // ID - SETROLLRATEP_SUBTYPE_ID, - // Command text - "setrollratep", - // Type of the command data - floatType, - // Function pointer - &cb_setrollratep - }, - // rollrate i constant subtype - { - // ID - SETROLLRATEI_SUBTYPE_ID, - // Command text - "setrollratei", - // Type of the command data - floatType, - // Function pointer - &cb_setrollratei - }, - // rollrate d constant subtype - { - // ID - SETROLLRATED_SUBTYPE_ID, - // Command text - "setrollrated", - // Type of the command data - floatType, - // Function pointer - &cb_setrollrated - }, - // pitchrate p constant subtype - { - // ID - SETPITCHRATEP_SUBTYPE_ID, - // Command text - "setpitchratep", - // Type of the command data - floatType, - // Function pointer - &cb_setpitchratep - }, - // pitchrate i constant subtype - { - // ID - SETPITCHRATEI_SUBTYPE_ID, - // Command text - "setpitchratei", - // Type of the command data - floatType, - // Function pointer - &cb_setpitchratei - }, - // pitchrate d constant subtype - { - // ID - SETPITCHRATED_SUBTYPE_ID, - // Command text - "setpitchrated", - // Type of the command data - floatType, - // Function pointer - &cb_setpitchrated - }, - // yawrate p constant subtype - { - // ID - SETYAWRATEP_SUBTYPE_ID, - // Command text - "setyawratep", - // Type of the command data - floatType, - // Function pointer - &cb_setyawratep - }, - // yawrate i constant subtype - { - // ID - SETYAWRATEI_SUBTYPE_ID, - // Command text - "setyawratei", - // Type of the command data - floatType, - // Function pointer - &cb_setyawratei - }, - // yawrate d constant subtype - { - // ID - SETYAWRATED_SUBTYPE_ID, - // Command text - "setyawrated", - // Type of the command data - floatType, - // Function pointer - &cb_setyawrated - }, - // localx p constant subtype - { - // ID - SETLOCALXP_SUBTYPE_ID, - // Command text - "setlocalxp", - // Type of the command data - floatType, - // Function pointer - &cb_setlocalxp - }, - // localx i constant subtype - { - // ID - SETLOCALXI_SUBTYPE_ID, - // Command text - "setlocalxi", - // Type of the command data - floatType, - // Function pointer - &cb_setlocalxi - }, - // localx d constant subtype - { - // ID - SETLOCALXD_SUBTYPE_ID, - // Command text - "setlocalxd", - // Type of the command data - floatType, - // Function pointer - &cb_setlocalxd - }, - // localy p constant subtype - { - // ID - SETLOCALYP_SUBTYPE_ID, - // Command text - "setlocalyp", - // Type of the command data - floatType, - // Function pointer - &cb_setlocalyp - }, - // localy i constant subtype - { - // ID - SETLOCALYI_SUBTYPE_ID, - // Command text - "setlocalyi", - // Type of the command data - floatType, - // Function pointer - &cb_setlocalyi - }, - // localy d constant subtype - { - // ID - SETLOCALYD_SUBTYPE_ID, - // Command text - "setlocalyd", - // Type of the command data - floatType, - // Function pointer - &cb_setlocalyd - }, - // alt p constant subtype - { - // ID - SETALTP_SUBTYPE_ID, - // Command text - "setaltp", - // Type of the command data - floatType, - // Function pointer - &cb_setaltp - }, - // alt i constant subtype - { - // ID - SETALTI_SUBTYPE_ID, - // Command text - "setalti", - // Type of the command data - floatType, - // Function pointer - &cb_setalti - }, - // alt d constant subtype - { - // ID - SETALTD_SUBTYPE_ID, - // Command text - "setaltd", - // Type of the command data - floatType, - // Function pointer - &cb_setaltd - }, - // rollsp setpoint subtype - { - // ID - SETROLLSP_SUBTYPE_ID, - // Command text - "setrollsp", - // Type of the command data - floatType, - // Function pointer - &cb_setrollsp - }, - // pitchsp setpoint subtype - { - // ID - SETPITCHSP_SUBTYPE_ID, - // Command text - "setpitchsp", - // Type of the command data - floatType, - // Function pointer - &cb_setpitchsp - }, - // yawsp setpoint subtype - { - // ID - SETYAWSP_SUBTYPE_ID, - // Command text - "setyawsp", - // Type of the command data - floatType, - // Function pointer - &cb_setyawsp - }, - // altsp setpoint subtype - { - // ID - SETALTSP_SUBTYPE_ID, - // Command text - "setaltsp", - // Type of the command data - floatType, - // Function pointer - &cb_setaltsp - }, - // lonsp setpoint subtype - { - // ID - SETLONSP_SUBTYPE_ID, - // Command text - "setlonsp", - // Type of the command data - floatType, - // Function pointer - &cb_setlonsp - }, - // latsp setpoint subtype - { - // ID - SETLATSP_SUBTYPE_ID, - // Command text - "setlatsp", - // Type of the command data - floatType, - // Function pointer - &cb_setlatsp - } - } + // ID + PACKETLOG_TYPE_ID, + // Command text + "packetlog", + // Type of the command data + stringType, + // Function pointer + &cb_packetlog }, - - // REQUEST + // GETPACKETLOGS { - // Message Type ID - GETTER_TYPE_ID, - - // Calibration Subtypes (PID coefficients) - { - // roll p constant subtype - { - // ID - GETROLLP_SUBTYPE_ID, - // Command text - "getrollp", - // Type of the command data - floatType, - // Function pointer - &cb_getrollp - }, - // roll i constant subtype - { - // ID - GETROLLI_SUBTYPE_ID, - // Command text - "getrolli", - // Type of the command data - floatType, - // Function pointer - &cb_getrolli - }, - // roll d constant subtype - { - // ID - GETROLLD_SUBTYPE_ID, - // Command text - "getrolld", - // Type of the command data - floatType, - // Function pointer - &cb_getrolld - }, - // pitch p constant subtype - { - // ID - GETPITCHP_SUBTYPE_ID, - // Command text - "getpitchp", - // Type of the command data - floatType, - // Function pointer - &cb_getpitchp - }, - // pitch i constant subtype - { - // ID - GETPITCHI_SUBTYPE_ID, - // Command text - "getpitchi", - // Type of the command data - floatType, - // Function pointer - &cb_getpitchi - }, - // pitch d constant subtype - { - // ID - GETPITCHD_SUBTYPE_ID, - // Command text - "getpitchd", - // Type of the command data - floatType, - // Function pointer - &cb_getpitchd - }, - // yaw p constant subtype - { - // ID - GETYAWP_SUBTYPE_ID, - // Command text - "getyawp", - // Type of the command data - floatType, - // Function pointer - &cb_getyawp - }, - // yaw i constant subtype - { - // ID - GETYAWI_SUBTYPE_ID, - // Command text - "getyawi", - // Type of the command data - floatType, - // Function pointer - &cb_getyawi - }, - // yaw d constant subtype - { - // ID - GETYAWD_SUBTYPE_ID, - // Command text - "getyawd", - // Type of the command data - floatType, - // Function pointer - &cb_getyawd - }, - // rollrate p constant subtype - { - // ID - GETROLLRATEP_SUBTYPE_ID, - // Command text - "getrollratep", - // Type of the command data - floatType, - // Function pointer - &cb_getrollratep - }, - // rollrate i constant subtype - { - // ID - GETROLLRATEI_SUBTYPE_ID, - // Command text - "getrollratei", - // Type of the command data - floatType, - // Function pointer - &cb_getrollratei - }, - // rollrate d constant subtype - { - // ID - GETROLLRATED_SUBTYPE_ID, - // Command text - "getrollrated", - // Type of the command data - floatType, - // Function pointer - &cb_getrollrated - }, - // pitchrate p constant subtype - { - // ID - GETPITCHRATEP_SUBTYPE_ID, - // Command text - "getpitchratep", - // Type of the command data - floatType, - // Function pointer - &cb_getpitchratep - }, - // pitchrate i constant subtype - { - // ID - GETPITCHRATEI_SUBTYPE_ID, - // Command text - "getpitchratei", - // Type of the command data - floatType, - // Function pointer - &cb_getpitchratei - }, - // pitchrate d constant subtype - { - // ID - GETPITCHRATED_SUBTYPE_ID, - // Command text - "getpitchrated", - // Type of the command data - floatType, - // Function pointer - &cb_getpitchrated - }, - // yawrate p constant subtype - { - // ID - GETYAWRATEP_SUBTYPE_ID, - // Command text - "getyawratep", - // Type of the command data - floatType, - // Function pointer - &cb_getyawratep - }, - // yawrate i constant subtype - { - // ID - GETYAWRATEI_SUBTYPE_ID, - // Command text - "getyawratei", - // Type of the command data - floatType, - // Function pointer - &cb_getyawratei - }, - // yawrate d constant subtype - { - // ID - GETYAWRATED_SUBTYPE_ID, - // Command text - "getyawrated", - // Type of the command data - floatType, - // Function pointer - &cb_getyawrated - }, - // localx p constant subtype - { - // ID - GETLOCALXP_SUBTYPE_ID, - // Command text - "getlocalxp", - // Type of the command data - floatType, - // Function pointer - &cb_getlocalxp - }, - // localx i constant subtype - { - // ID - GETLOCALXI_SUBTYPE_ID, - // Command text - "getlocalxi", - // Type of the command data - floatType, - // Function pointer - &cb_getlocalxi - }, - // localx d constant subtype - { - // ID - GETLOCALXD_SUBTYPE_ID, - // Command text - "getlocalxd", - // Type of the command data - floatType, - // Function pointer - &cb_getlocalxd - }, - // localy p constant subtype - { - // ID - GETLOCALYP_SUBTYPE_ID, - // Command text - "getlocalyp", - // Type of the command data - floatType, - // Function pointer - &cb_getlocalyp - }, - // localy i constant subtype - { - // ID - GETLOCALYI_SUBTYPE_ID, - // Command text - "getlocalyi", - // Type of the command data - floatType, - // Function pointer - &cb_getlocalyi - }, - // localy d constant subtype - { - // ID - GETLOCALYD_SUBTYPE_ID, - // Command text - "getlocalyd", - // Type of the command data - floatType, - // Function pointer - &cb_getlocalyd - }, - // alt p constant subtype - { - // ID - GETALTP_SUBTYPE_ID, - // Command text - "getaltp", - // Type of the command data - floatType, - // Function pointer - &cb_getaltp - }, - // alt i constant subtype - { - // ID - GETALTI_SUBTYPE_ID, - // Command text - "getalti", - // Type of the command data - floatType, - // Function pointer - &cb_getalti - }, - // alt d constant subtype - { - // ID - GETALTD_SUBTYPE_ID, - // Command text - "getaltd", - // Type of the command data - floatType, - // Function pointer - &cb_getaltd - }, - // rollsp setpoint subtype - { - // ID - GETROLLSP_SUBTYPE_ID, - // Command text - "getrollsp", - // Type of the command data - floatType, - // Function pointer - &cb_getrollsp - }, - // pitchsp getpoint subtype - { - // ID - GETPITCHSP_SUBTYPE_ID, - // Command text - "getpitchsp", - // Type of the command data - floatType, - // Function pointer - &cb_getpitchsp - }, - // yawsp getpoint subtype - { - // ID - GETYAWSP_SUBTYPE_ID, - // Command text - "getyawsp", - // Type of the command data - floatType, - // Function pointer - &cb_getyawsp - }, - // altsp getpoint subtype - { - // ID - GETALTSP_SUBTYPE_ID, - // Command text - "getaltsp", - // Type of the command data - floatType, - // Function pointer - &cb_getaltsp - }, - // lonsp getpoint subtype - { - // ID - GETLONSP_SUBTYPE_ID, - // Command text - "getlonsp", - // Type of the command data - floatType, - // Function pointer - &cb_getlonsp - }, - // latsp getpoint subtype - { - // ID - GETLATSP_SUBTYPE_ID, - // Command text - "getlatsp", - // Type of the command data - floatType, - // Function pointer - &cb_getlatsp - } - - } - }, - - // RESPONSE - { - // Message Type ID - RESP_TYPE_ID, - - // Calibration Subtypes (PID coefficients) - { - // roll p constant subtype - { - // ID - RESPROLLP_SUBTYPE_ID, - // Command text - "resprollp", - // Type of the command data - floatType, - // Function pointer - &cb_resprollp - }, - // roll i constant subtype - { - // ID - RESPROLLI_SUBTYPE_ID, - // Command text - "resprolli", - // Type of the command data - floatType, - // Function pointer - &cb_resprolli - }, - // roll d constant subtype - { - // ID - RESPROLLD_SUBTYPE_ID, - // Command text - "resprolld", - // Type of the command data - floatType, - // Function pointer - &cb_resprolld - }, - // pitch p constant subtype - { - // ID - RESPPITCHP_SUBTYPE_ID, - // Command text - "resppitchp", - // Type of the command data - floatType, - // Function pointer - &cb_resppitchp - }, - // pitch i constant subtype - { - // ID - RESPPITCHI_SUBTYPE_ID, - // Command text - "resppitchi", - // Type of the command data - floatType, - // Function pointer - &cb_resppitchi - }, - // pitch d constant subtype - { - // ID - RESPPITCHD_SUBTYPE_ID, - // Command text - "resppitchd", - // Type of the command data - floatType, - // Function pointer - &cb_resppitchd - }, - // yaw p constant subtype - { - // ID - RESPYAWP_SUBTYPE_ID, - // Command text - "respyawp", - // Type of the command data - floatType, - // Function pointer - &cb_respyawp - }, - // yaw i constant subtype - { - // ID - RESPYAWI_SUBTYPE_ID, - // Command text - "respyawi", - // Type of the command data - floatType, - // Function pointer - &cb_respyawi - }, - // yaw d constant subtype - { - // ID - RESPYAWD_SUBTYPE_ID, - // Command text - "respyawd", - // Type of the command data - floatType, - // Function pointer - &cb_respyawd - }, - // rollrate p constant subtype - { - // ID - RESPROLLRATEP_SUBTYPE_ID, - // Command text - "resprollratep", - // Type of the command data - floatType, - // Function pointer - &cb_resprollratep - }, - // rollrate i constant subtype - { - // ID - RESPROLLRATEI_SUBTYPE_ID, - // Command text - "resprollratei", - // Type of the command data - floatType, - // Function pointer - &cb_resprollratei - }, - // rollrate d constant subtype - { - // ID - RESPROLLRATED_SUBTYPE_ID, - // Command text - "resprollrated", - // Type of the command data - floatType, - // Function pointer - &cb_resprollrated - }, - // pitchrate p constant subtype - { - // ID - RESPPITCHRATEP_SUBTYPE_ID, - // Command text - "resppitchratep", - // Type of the command data - floatType, - // Function pointer - &cb_resppitchratep - }, - // pitchrate i constant subtype - { - // ID - RESPPITCHRATEI_SUBTYPE_ID, - // Command text - "resppitchratei", - // Type of the command data - floatType, - // Function pointer - &cb_resppitchratei - }, - // pitchrate d constant subtype - { - // ID - RESPPITCHRATED_SUBTYPE_ID, - // Command text - "resppitchrated", - // Type of the command data - floatType, - // Function pointer - &cb_resppitchrated - }, - // yawrate p constant subtype - { - // ID - RESPYAWRATEP_SUBTYPE_ID, - // Command text - "respyawratep", - // Type of the command data - floatType, - // Function pointer - &cb_respyawratep - }, - // yawrate i constant subtype - { - // ID - RESPYAWRATEI_SUBTYPE_ID, - // Command text - "respyawratei", - // Type of the command data - floatType, - // Function pointer - &cb_respyawratei - }, - // yawrate d constant subtype - { - // ID - RESPYAWRATED_SUBTYPE_ID, - // Command text - "respyawrated", - // Type of the command data - floatType, - // Function pointer - &cb_respyawrated - }, - // localx p constant subtype - { - // ID - RESPLOCALXP_SUBTYPE_ID, - // Command text - "resplocalxp", - // Type of the command data - floatType, - // Function pointer - &cb_resplocalxp - }, - // localx i constant subtype - { - // ID - RESPLOCALXI_SUBTYPE_ID, - // Command text - "resplocalxi", - // Type of the command data - floatType, - // Function pointer - &cb_resplocalxi - }, - // localx d constant subtype - { - // ID - RESPLOCALXD_SUBTYPE_ID, - // Command text - "resplocalxd", - // Type of the command data - floatType, - // Function pointer - &cb_resplocalxd - }, - // localy p constant subtype - { - // ID - RESPLOCALYP_SUBTYPE_ID, - // Command text - "resplocalyp", - // Type of the command data - floatType, - // Function pointer - &cb_resplocalyp - }, - // localy i constant subtype - { - // ID - RESPLOCALYI_SUBTYPE_ID, - // Command text - "resplocalyi", - // Type of the command data - floatType, - // Function pointer - &cb_resplocalyi - }, - // localy d constant subtype - { - // ID - RESPLOCALYD_SUBTYPE_ID, - // Command text - "resplocalyd", - // Type of the command data - floatType, - // Function pointer - &cb_resplocalyd - }, - // alt p constant subtype - { - // ID - RESPALTP_SUBTYPE_ID, - // Command text - "respaltp", - // Type of the command data - floatType, - // Function pointer - &cb_respaltp - }, - // alt i constant subtype - { - // ID - RESPALTI_SUBTYPE_ID, - // Command text - "respalti", - // Type of the command data - floatType, - // Function pointer - &cb_respalti - }, - // alt d constant subtype - { - // ID - RESPALTD_SUBTYPE_ID, - // Command text - "respaltd", - // Type of the command data - floatType, - // Function pointer - &cb_respaltd - }, - // rollsp setpoint subtype - { - // ID - RESPROLLSP_SUBTYPE_ID, - // Command text - "resprollsp", - // Type of the command data - floatType, - // Function pointer - &cb_resprollsp - }, - // pitchsp resppoint subtype - { - // ID - RESPPITCHSP_SUBTYPE_ID, - // Command text - "resppitchsp", - // Type of the command data - floatType, - // Function pointer - &cb_resppitchsp - }, - // yawsp resppoint subtype - { - // ID - RESPYAWSP_SUBTYPE_ID, - // Command text - "respyawsp", - // Type of the command data - floatType, - // Function pointer - &cb_respyawsp - }, - // altsp resppoint subtype - { - // ID - RESPALTSP_SUBTYPE_ID, - // Command text - "respaltsp", - // Type of the command data - floatType, - // Function pointer - &cb_respaltsp - }, - // lonsp resppoint subtype - { - // ID - RESPLONSP_SUBTYPE_ID, - // Command text - "resplonsp", - // Type of the command data - floatType, - // Function pointer - &cb_resplonsp - }, - // latsp resppoint subtype - { - // ID - RESPLATSP_SUBTYPE_ID, - // Command text - "resplatsp", - // Type of the command data - floatType, - // Function pointer - &cb_resplatsp - } - } + // ID + GETPACKETLOGS_TYPE_ID, + // Command text + "getpacketlogs", + // Type of the command data + stringType, + // Function pointer + &cb_getpacketlogs }, // UPDATE { - // Message Type ID + // ID UPDATE_TYPE_ID, - - // Update Subtypes - { - // NONE subtype - { - // ID - UPDATE_SUBTYPE_ID, - // Command text - "update", - // Type of the command data - stringType, - // Function pointer - &cb_update - }, - // BEGIN update - { - // ID - BEGINUPDATE_SUBTYPE_ID, - // Command text - "beginupdate", - // Type of the command data - stringType, - // Function pointer - &cb_beginupdate - } - } + // Command text + "update", + // Type of the command data + stringType, + // Function pointer + &cb_update + }, + // BEGINUPDATE + { + // ID + BEGINUPDATE_TYPE_ID, + // Command text + "beginupdate", + // Type of the command data + stringType, + // Function pointer + &cb_beginupdate }, - // LOG { - // Message Type ID + // ID LOG_TYPE_ID, - - // Log Subtypes - { - // NONE subtype - { - // ID - LOG_SUBTYPE_ID, - // Command text - "log", - // Type of the command data - stringType, - // Function pointer - &cb_log - }, - // Response subtype - { - // ID - RESPONSE_SUBTYPE_ID, - // Command text - "response", - // Type of the command data - stringType, - // Function pointer - &cb_response - } - } + // Command text + "log", + // Type of the command data + stringType, + // Function pointer + &cb_log }, + // RESPONSE + { + // ID + RESPONSE_TYPE_ID, + // Command text + "response", + // Type of the command data + stringType, + // Function pointer + &cb_response + }, + // SETVAL + { + // ID + SETVAL_TYPE_ID, + // Command text + "setval", + // Type of the command data + floatType, + // Function pointer + &cb_setval + }, + // GETVAL + { + // ID + GETVAL_TYPE_ID, + // Command text + "getval", + // Type of the command data + floatType, + // Function pointer + &cb_getval + }, + // RESPVAL + { + // ID + RESPVAL_TYPE_ID, + // Command text + "respval", + // Type of the command data + floatType, + // Function pointer + &cb_respval + } }; diff --git a/groundStation/src/backend/commands.h b/groundStation/src/backend/commands.h index 9e57ae11a..e54e0ee5a 100644 --- a/groundStation/src/backend/commands.h +++ b/groundStation/src/backend/commands.h @@ -10,9 +10,6 @@ // ---------------------- // Helper stuff -#define MAX_TYPE 6 -#define MAX_SUBTYPE 100 - enum Message{ BEGIN_CHAR = 0xBE, END_CHAR = 0xED @@ -26,20 +23,31 @@ enum DataType stringType }; +// message type IDs used to know what kind of message we are dealing with +// DO NOT change this enum or you will break backwards compatibility. +enum MessageTypeID{ + DEBUG_TYPE_ID, + PACKETLOG_TYPE_ID, + GETPACKETLOGS_TYPE_ID, + UPDATE_TYPE_ID, + BEGINUPDATE_TYPE_ID, + LOG_TYPE_ID, + RESPONSE_TYPE_ID, + SETVAL_TYPE_ID, + GETVAL_TYPE_ID, + RESPVAL_TYPE_ID, + // This last type is just used to keep track of the size + MAX_TYPE +}; + // MESSAGE SUBTYPES -struct MessageSubtype{ +struct MessageType{ char ID; char cmdText[100]; char cmdDataType; command_cb * functionPtr; }; -// MESSAGE TYPES -struct MessageType{ - char ID; - struct MessageSubtype subtypes[MAX_SUBTYPE]; -}; - /* Defined in commands.c */ extern struct MessageType MessageTypes[MAX_TYPE]; diff --git a/quad/sw/modular_quad_pid/src/callbacks.c b/quad/sw/modular_quad_pid/src/callbacks.c index d04c3d828..4cf2d6937 100644 --- a/quad/sw/modular_quad_pid/src/callbacks.c +++ b/quad/sw/modular_quad_pid/src/callbacks.c @@ -73,7 +73,7 @@ int cb_beginupdate(modular_structs_t *structs) { } -/* Callbacks for configuration (setters)*/ +/* Callbacks for configuration */ int cb_setrollp(modular_structs_t *structs) { -- GitLab