mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 22:17:01 +08:00
[fixedwing] remove extra joystick c file and move header to fixedwing dir
still ugly though...
This commit is contained in:
@@ -2,6 +2,5 @@
|
||||
|
||||
# joystick for fixedwings
|
||||
|
||||
$(TARGET).srcs += joystick.c
|
||||
$(TARGET).CFLAGS += -DUSE_JOYSTICK
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<header>
|
||||
#include "subsystems/navigation/nav_line.h"
|
||||
#include "subsystems/datalink/datalink.h"
|
||||
#include "joystick.h"
|
||||
#include "firmwares/fixedwing/joystick.h"
|
||||
</header>
|
||||
<waypoints>
|
||||
<waypoint name="HOME" x="0" y="0"/>
|
||||
|
||||
@@ -44,10 +44,6 @@
|
||||
#include "subsystems/nav.h"
|
||||
#endif
|
||||
|
||||
#if USE_JOYSTICK
|
||||
#include "joystick.h"
|
||||
#endif
|
||||
|
||||
#ifdef HITL
|
||||
#include "subsystems/gps.h"
|
||||
#endif
|
||||
@@ -64,6 +60,21 @@
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
#include "ap_downlink.h"
|
||||
|
||||
|
||||
#if USE_JOYSTICK
|
||||
#include "firmwares/fixedwing/stabilization/stabilization_attitude.h"
|
||||
#include "autopilot.h"
|
||||
uint8_t joystick_block;
|
||||
#define JoystickHandeDatalink(_roll_int8, _pitch_int8, _throttle_int8) { \
|
||||
if (pprz_mode == PPRZ_MODE_AUTO2 && nav_block == joystick_block) { \
|
||||
h_ctl_roll_setpoint = _roll_int8 * (AUTO1_MAX_ROLL / 0x7f); \
|
||||
h_ctl_pitch_setpoint = _pitch_int8 * (AUTO1_MAX_PITCH / 0x7f); \
|
||||
v_ctl_throttle_setpoint = (MAX_PPRZ/0x7f) * _throttle_int8; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define MOfCm(_x) (((float)(_x))/100.)
|
||||
|
||||
#define SenderIdOfMsg(x) (x[0])
|
||||
@@ -184,8 +195,8 @@ void dl_parse_msg(void) {
|
||||
#if USE_JOYSTICK
|
||||
if (msg_id == DL_JOYSTICK_RAW && DL_JOYSTICK_RAW_ac_id(dl_buffer) == AC_ID) {
|
||||
JoystickHandeDatalink(DL_JOYSTICK_RAW_roll(dl_buffer),
|
||||
DL_JOYSTICK_RAW_pitch(dl_buffer),
|
||||
DL_JOYSTICK_RAW_throttle(dl_buffer));
|
||||
DL_JOYSTICK_RAW_pitch(dl_buffer),
|
||||
DL_JOYSTICK_RAW_throttle(dl_buffer));
|
||||
} else
|
||||
#endif // USE_JOYSTICK
|
||||
#if defined RADIO_CONTROL && defined RADIO_CONTROL_TYPE_DATALINK
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef JOYSTICK_H
|
||||
#define JOYSTICK_H
|
||||
|
||||
extern uint8_t joystick_block;
|
||||
|
||||
#endif
|
||||
@@ -1,3 +0,0 @@
|
||||
#include "joystick.h"
|
||||
|
||||
uint8_t joystick_block;
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef JOYSTICK_H
|
||||
#define JOYSTICK_H
|
||||
|
||||
#include "std.h"
|
||||
#include "firmwares/fixedwing/stabilization/stabilization_attitude.h"
|
||||
#include "autopilot.h"
|
||||
|
||||
extern uint8_t joystick_block;
|
||||
|
||||
#define JoystickHandeDatalink(_roll_int8, _pitch_int8, _throttle_int8) { \
|
||||
if (pprz_mode == PPRZ_MODE_AUTO2 && nav_block == joystick_block) { \
|
||||
h_ctl_roll_setpoint = _roll_int8 * (AUTO1_MAX_ROLL / 0x7f); \
|
||||
h_ctl_pitch_setpoint = _pitch_int8 * (AUTO1_MAX_PITCH / 0x7f); \
|
||||
v_ctl_throttle_setpoint = (MAX_PPRZ/0x7f) * _throttle_int8; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* JOYSTICK_H */
|
||||
Reference in New Issue
Block a user