[messages] replace BOOT with AUTOPILOT_VERSION

This commit is contained in:
Felix Ruess
2014-12-21 03:25:22 +01:00
parent d0b9c3acd3
commit e3be6f938a
8 changed files with 41 additions and 18 deletions
+3 -2
View File
@@ -4,8 +4,9 @@
<!-- messages from modem or sim to server -->
<msg_class name="telemetry">
<message name="BOOT" id="1">
<field name="version" type="uint16"/>
<message name="AUTOPILOT_VERSION" id="1">
<field name="version" type="uint32">version encoded as: MAJOR * 10000 + MINOR * 100 + PATCH</field>
<field name="desc" type="char[]">version description as string from paparazzi_version</field>
</message>
<message name="ALIVE" id="2">
@@ -37,6 +37,8 @@
#include "mcu_periph/gpio.h"
#endif
#include "pprz_version.h"
uint8_t pprz_mode;
bool_t kill_throttle;
uint8_t mcu1_status;
@@ -56,6 +58,13 @@ bool_t gps_lost;
bool_t power_switch;
void send_autopilot_version(struct transport_tx *trans, struct link_device *dev)
{
static uint32_t ap_version = PPRZ_VERSION_INT;
static char *ver_desc = PPRZ_VERSION_DESC;
pprz_msg_send_AUTOPILOT_VERSION(trans, dev, AC_ID, &ap_version, strlen(ver_desc), ver_desc);
}
static void send_alive(struct transport_tx *trans, struct link_device *dev)
{
pprz_msg_send_ALIVE(trans, dev, AC_ID, 16, MD5SUM);
@@ -169,6 +178,7 @@ void autopilot_init(void)
#endif
/* register some periodic message */
register_periodic_telemetry(DefaultPeriodic, "AUTOPILOT_VERSION", send_autopilot_version);
register_periodic_telemetry(DefaultPeriodic, "ALIVE", send_alive);
register_periodic_telemetry(DefaultPeriodic, "PPRZ_MODE", send_mode);
register_periodic_telemetry(DefaultPeriodic, "ATTITUDE", send_attitude);
@@ -155,4 +155,9 @@ static inline void autopilot_StoreSettings(float store)
}
}
#if DOWNLINK
#include "subsystems/datalink/transport.h"
extern void send_autopilot_version(struct transport_tx *trans, struct link_device *dev);
#endif
#endif /* AUTOPILOT_H */
+3 -6
View File
@@ -86,7 +86,6 @@ PRINT_CONFIG_MSG_VALUE("USE_BARO_BOARD is TRUE, reading onboard baro: ", BARO_BO
#include "subsystems/abi.h"
#include "led.h"
#include "pprz_version.h"
#ifdef USE_NPS
#include "nps_autopilot.h"
@@ -157,9 +156,6 @@ static void send_filter_status(struct transport_tx *trans, struct link_device *d
static inline void on_gps_solution(void);
#endif
/** Paparazzi version */
static const uint16_t version = PPRZ_VERSION_INT;
#if defined RADIO_CONTROL || defined RADIO_CONTROL_AUTO1
static uint8_t mcu1_ppm_cpt;
#endif
@@ -462,8 +458,9 @@ void reporting_task(void)
/* initialisation phase during boot */
if (boot) {
uint16_t non_const_version = version;
DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &non_const_version);
#if DOWNLINK
send_autopilot_version(&(DefaultChannel).trans_tx, &(DefaultDevice).device);
#endif
boot = FALSE;
}
/* then report periodicly */
@@ -50,6 +50,8 @@
#include "mcu_periph/gpio.h"
#endif
#include "pprz_version.h"
uint8_t autopilot_mode;
uint8_t autopilot_mode_auto2;
@@ -144,6 +146,13 @@ PRINT_CONFIG_MSG("Enabled UNLOCKED_HOME_MODE since MODE_AUTO2 is AP_MODE_HOME")
#error "MODE_MANUAL mustn't be AP_MODE_NAV"
#endif
void send_autopilot_version(struct transport_tx *trans, struct link_device *dev)
{
static uint32_t ap_version = PPRZ_VERSION_INT;
static char *ver_desc = PPRZ_VERSION_DESC;
pprz_msg_send_AUTOPILOT_VERSION(trans, dev, AC_ID, &ap_version, strlen(ver_desc), ver_desc);
}
static void send_alive(struct transport_tx *trans, struct link_device *dev)
{
pprz_msg_send_ALIVE(trans, dev, AC_ID, 16, MD5SUM);
@@ -285,6 +294,7 @@ void autopilot_init(void)
/* set startup mode, propagates through to guidance h/v */
autopilot_set_mode(MODE_STARTUP);
register_periodic_telemetry(DefaultPeriodic, "AUTOPILOT_VERSION", send_autopilot_version);
register_periodic_telemetry(DefaultPeriodic, "ALIVE", send_alive);
register_periodic_telemetry(DefaultPeriodic, "ROTORCRAFT_STATUS", send_status);
register_periodic_telemetry(DefaultPeriodic, "ENERGY", send_energy);
@@ -168,4 +168,9 @@ static inline void autopilot_StoreSettings(float store)
}
}
#if DOWNLINK
#include "subsystems/datalink/transport.h"
extern void send_autopilot_version(struct transport_tx *trans, struct link_device *dev);
#endif
#endif /* AUTOPILOT_H */
+3 -8
View File
@@ -87,8 +87,6 @@ PRINT_CONFIG_MSG_VALUE("USE_BARO_BOARD is TRUE, reading onboard baro: ", BARO_BO
#include "mcu_periph/usb_serial.h"
#endif
#include "pprz_version.h"
/* if PRINT_CONFIG is defined, print some config options */
PRINT_CONFIG_VAR(PERIODIC_FREQUENCY)
@@ -114,9 +112,6 @@ INFO_VALUE("it is recommended to configure in your airframe PERIODIC_FREQUENCY t
#endif
#endif
/** Paparazzi version */
static const uint16_t version = PPRZ_VERSION_INT;
static inline void on_gyro_event(void);
static inline void on_accel_event(void);
static inline void on_gps_event(void);
@@ -148,7 +143,6 @@ int main(void)
STATIC_INLINE void main_init(void)
{
mcu_init();
electrical_init();
@@ -253,8 +247,9 @@ STATIC_INLINE void telemetry_periodic(void)
/* initialisation phase during boot */
if (boot) {
uint16_t non_const_version = version;
DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &non_const_version);
#if DOWNLINK
send_autopilot_version(&(DefaultChannel).trans_tx, &(DefaultDevice).device);
#endif
boot = FALSE;
}
/* then report periodicly */
+2 -2
View File
@@ -48,8 +48,8 @@
#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 32bit integer */
#define PPRZ_VERSION_INT (PPRZ_VER_MAJOR * 10000 + PPRZ_VER_MINOR * 100 + PPRZ_VER_PATCH)
static inline uint8_t nibble_from_char(char c)
{