Browse Source

Plane: added AP_Button support for plane

this also adds the g2 parameter table
master
Andrew Tridgell 9 years ago
parent
commit
3f0a8d1761
  1. 1
      ArduPlane/ArduPlane.cpp
  2. 16
      ArduPlane/Parameters.cpp
  3. 15
      ArduPlane/Parameters.h
  4. 6
      ArduPlane/Plane.h
  5. 8
      ArduPlane/sensors.cpp

1
ArduPlane/ArduPlane.cpp

@ -85,6 +85,7 @@ const AP_Scheduler::Task Plane::scheduler_tasks[] = { @@ -85,6 +85,7 @@ const AP_Scheduler::Task Plane::scheduler_tasks[] = {
SCHED_TASK(update_is_flying_5Hz, 5, 100),
SCHED_TASK(dataflash_periodic, 50, 400),
SCHED_TASK(adsb_update, 10, 100),
SCHED_TASK(button_update, 5, 100),
};
void Plane::setup()

16
ArduPlane/Parameters.cpp

@ -1357,9 +1357,25 @@ const AP_Param::Info Plane::var_info[] = { @@ -1357,9 +1357,25 @@ const AP_Param::Info Plane::var_info[] = {
// @Path: ../libraries/AP_Notify/AP_Notify.cpp
GOBJECT(notify, "NTF_", AP_Notify),
// @Group:
// @Path: Parameters.cpp
GOBJECT(g2, "", ParametersG2),
AP_VAREND
};
/*
2nd group of parameters
*/
const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @Group: BTN_
// @Path: ../libraries/AP_Button/AP_Button.cpp
AP_SUBGROUPINFO(button, "BTN_", 1, ParametersG2, AP_Button),
AP_GROUPEND
};
/*
This is a conversion table from old parameter values to new
parameter names. The startup code looks for saved values of the old

15
ArduPlane/Parameters.h

@ -50,6 +50,7 @@ public: @@ -50,6 +50,7 @@ public:
k_param_software_type,
k_param_num_resets,
k_param_NavEKF2,
k_param_g2,
// Misc
//
@ -568,4 +569,18 @@ public: @@ -568,4 +569,18 @@ public:
{}
};
/*
2nd block of parameters, to avoid going past 256 top level keys
*/
class ParametersG2 {
public:
ParametersG2(void) { AP_Param::setup_object_defaults(this, var_info); }
// var_info for holding Parameter information
static const struct AP_Param::GroupInfo var_info[];
// button reporting library
AP_Button button;
};
extern const AP_Param::Info var_info[];

6
ArduPlane/Plane.h

@ -88,6 +88,7 @@ @@ -88,6 +88,7 @@
#include <AP_RSSI/AP_RSSI.h> // RSSI Library
#include <AP_Parachute/AP_Parachute.h>
#include <AP_ADSB/AP_ADSB.h>
#include <AP_Button/AP_Button.h>
#include "GCS_Mavlink.h"
#include "quadplane.h"
@ -146,8 +147,9 @@ private: @@ -146,8 +147,9 @@ private:
AP_Vehicle::FixedWing aparm;
AP_HAL::BetterStream* cliSerial;
// Global parameters are all contained within the 'g' class.
// Global parameters are all contained within the 'g' and 'g2' classes.
Parameters g;
ParametersG2 g2;
// main loop scheduler
AP_Scheduler scheduler;
@ -638,7 +640,6 @@ private: @@ -638,7 +640,6 @@ private:
Location prev_wp;
} adsb_state;
// Outback Challenge Failsafe Support
#if OBC_FAILSAFE == ENABLED
APM_OBC obc {mission, barometer, gps, rcmap};
@ -955,6 +956,7 @@ private: @@ -955,6 +956,7 @@ private:
void read_battery(void);
void read_receiver_rssi(void);
void rpm_update(void);
void button_update(void);
void report_radio();
void report_ins();
void report_compass();

8
ArduPlane/sensors.cpp

@ -156,3 +156,11 @@ void Plane::rpm_update(void) @@ -156,3 +156,11 @@ void Plane::rpm_update(void)
}
}
}
/*
update AP_Button
*/
void Plane::button_update(void)
{
g2.button.update();
}

Loading…
Cancel
Save