Browse Source

GCS_MAVLink: move initialisation of serial and gcs to AP_Vehicle

zr-v5.1
Peter Barker 5 years ago committed by Andrew Tridgell
parent
commit
727c12c388
  1. 5
      libraries/GCS_MAVLink/GCS.cpp
  2. 3
      libraries/GCS_MAVLink/GCS.h
  3. 2
      libraries/GCS_MAVLink/GCS_Dummy.h
  4. 1
      libraries/GCS_MAVLink/examples/routing/routing.cpp

5
libraries/GCS_MAVLink/GCS.cpp

@ -33,6 +33,11 @@ const MAV_MISSION_TYPE GCS_MAVLINK::supported_mission_types[] = { @@ -33,6 +33,11 @@ const MAV_MISSION_TYPE GCS_MAVLINK::supported_mission_types[] = {
MAV_MISSION_TYPE_FENCE,
};
void GCS::init()
{
mavlink_system.sysid = sysid_this_mav();
}
/*
send a text message to all GCS
*/

3
libraries/GCS_MAVLink/GCS.h

@ -870,6 +870,7 @@ public: @@ -870,6 +870,7 @@ public:
return 200;
}
void init();
void setup_console();
void setup_uarts();
@ -908,6 +909,8 @@ public: @@ -908,6 +909,8 @@ public:
protected:
virtual uint8_t sysid_this_mav() const = 0;
virtual GCS_MAVLINK *new_gcs_mavlink_backend(GCS_MAVLINK_Parameters &params,
AP_HAL::UARTDriver &uart) = 0;

2
libraries/GCS_MAVLink/GCS_Dummy.h

@ -64,6 +64,8 @@ public: @@ -64,6 +64,8 @@ public:
protected:
uint8_t sysid_this_mav() const override { return 1; }
GCS_MAVLINK_Dummy *new_gcs_mavlink_backend(GCS_MAVLINK_Parameters &params,
AP_HAL::UARTDriver &uart) override {
return new GCS_MAVLINK_Dummy(params, uart);

1
libraries/GCS_MAVLink/examples/routing/routing.cpp

@ -28,6 +28,7 @@ static MAVLink_routing routing; @@ -28,6 +28,7 @@ static MAVLink_routing routing;
void setup(void)
{
hal.console->printf("routing test startup...");
gcs().init();
gcs().setup_console();
}

Loading…
Cancel
Save