diff --git a/conf/messages.xml b/conf/messages.xml index 6076a29a887..6b2384fdf61 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -183,7 +183,12 @@ - + + + + + + diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index fbdf5bbbde4..2dd42019b8a 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -158,7 +158,7 @@ static inline void on_gps_solution(void); #endif /** Paparazzi version */ -static const uint16_t version = PPRZ_VERSION_INT; +static const uint16_t version = PPRZ_VERSION_INT16; #if defined RADIO_CONTROL || defined RADIO_CONTROL_AUTO1 static uint8_t mcu1_ppm_cpt; diff --git a/sw/airborne/firmwares/rotorcraft/main.c b/sw/airborne/firmwares/rotorcraft/main.c index 791af66774c..4e43f10650c 100644 --- a/sw/airborne/firmwares/rotorcraft/main.c +++ b/sw/airborne/firmwares/rotorcraft/main.c @@ -115,7 +115,9 @@ INFO_VALUE("it is recommended to configure in your airframe PERIODIC_FREQUENCY t #endif /** Paparazzi version */ -static const uint16_t version = PPRZ_VERSION_INT; +static const uint16_t version = PPRZ_VERSION_INT16; +static uint32_t ap_version = PPRZ_VERSION_INT32; +static uint8_t git_version[8]; static inline void on_gyro_event(void); static inline void on_accel_event(void); @@ -148,6 +150,7 @@ int main(void) STATIC_INLINE void main_init(void) { + get_pprz_git_version(git_version); mcu_init(); @@ -253,8 +256,13 @@ STATIC_INLINE void telemetry_periodic(void) /* initialisation phase during boot */ if (boot) { +#if DOWNLINK uint16_t non_const_version = version; DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &non_const_version); + char *ver_desc = PPRZ_VERSION_DESC; + DOWNLINK_SEND_AUTOPILOT_VERSION(DefaultChannel, DefaultDevice, + &ap_version, git_version, strlen(ver_desc), ver_desc); +#endif boot = FALSE; } /* then report periodicly */ diff --git a/sw/airborne/modules/datalink/mavlink.c b/sw/airborne/modules/datalink/mavlink.c index f94d981b688..a129d6bbabc 100644 --- a/sw/airborne/modules/datalink/mavlink.c +++ b/sw/airborne/modules/datalink/mavlink.c @@ -302,7 +302,7 @@ static inline void mavlink_send_params(void) static inline void mavlink_send_autopilot_version(void) { /// TODO: fill in versions correctly, how should they be encoded? - static uint32_t ver = PPRZ_VERSION_INT; + static uint32_t ver = PPRZ_VERSION_INT32; mavlink_msg_autopilot_version_send(MAVLINK_COMM_0, 0, // capabilities, ver, // version diff --git a/sw/include/pprz_version.h b/sw/include/pprz_version.h index 9bea372c822..97278304d57 100644 --- a/sw/include/pprz_version.h +++ b/sw/include/pprz_version.h @@ -48,8 +48,11 @@ #define PPRZ_VERSION_DESC STRINGIFY(GIT_DESC) #define PPRZ_VERSION STRINGIFY(PPRZ_VER) -/** paparazzi version encoded as one integer */ -#define PPRZ_VERSION_INT (PPRZ_VER_MAJOR * 100 + PPRZ_VER_MINOR * 10 + PPRZ_VER_PATCH) +/** paparazzi version encoded as one 16bit integer */ +#define PPRZ_VERSION_INT16 (PPRZ_VER_MAJOR * 100 + PPRZ_VER_MINOR * 10 + PPRZ_VER_PATCH) + +/** paparazzi version encoded as one 32bit integer */ +#define PPRZ_VERSION_INT32 (PPRZ_VER_MAJOR * 10000 + PPRZ_VER_MINOR * 100 + PPRZ_VER_PATCH) static inline uint8_t nibble_from_char(char c) {