Rover: added AP_Button support

This commit is contained in:
Andrew Tridgell 2016-07-22 11:24:35 +10:00
parent cb5ca713a9
commit fd0f31dc44
5 changed files with 17 additions and 0 deletions

View File

@ -79,6 +79,7 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = {
SCHED_TASK(frsky_telemetry_send, 5, 100),
#endif
SCHED_TASK(dataflash_periodic, 50, 300),
SCHED_TASK(button_update, 5, 100),
};
/*

View File

@ -552,6 +552,10 @@ const AP_Param::Info Rover::var_info[] = {
// @Path: ../libraries/AP_Notify/AP_Notify.cpp
GOBJECT(notify, "NTF_", AP_Notify),
// @Group: BTN_
// @Path: ../libraries/AP_Button/AP_Button.cpp
GOBJECT(button, "BTN_", AP_Button),
AP_VAREND
};

View File

@ -195,6 +195,7 @@ public:
k_param_steerController,
k_param_barometer,
k_param_notify,
k_param_button,
k_param_DataFlash = 253, // Logging Group

View File

@ -72,6 +72,7 @@
#include <AP_BattMonitor/AP_BattMonitor.h> // Battery monitor library
#include <AP_OpticalFlow/AP_OpticalFlow.h> // Optical Flow library
#include <AP_RSSI/AP_RSSI.h> // RSSI Library
#include <AP_Button/AP_Button.h>
// Configuration
#include "config.h"
@ -134,6 +135,7 @@ private:
Compass compass;
AP_InertialSensor ins;
RangeFinder sonar { serial_manager };
AP_Button button;
// flight modes convenience array
AP_Int8 *modes;
@ -454,6 +456,7 @@ private:
void reset_control_switch();
void read_trim_switch();
void update_events(void);
void button_update(void);
void navigate();
void set_control_channels(void);
void init_rc_in();

View File

@ -119,3 +119,11 @@ void Rover::read_sonars(void)
obstacle.turn_angle = 0;
}
}
/*
update AP_Button
*/
void Rover::button_update(void)
{
button.update();
}