[fixedwing] remove extra joystick c file and move header to fixedwing dir

still ugly though...
This commit is contained in:
Felix Ruess
2013-03-02 19:22:23 +01:00
parent c24e221b6a
commit 3e7a18cc03
6 changed files with 24 additions and 31 deletions
@@ -2,6 +2,5 @@
# joystick for fixedwings # joystick for fixedwings
$(TARGET).srcs += joystick.c
$(TARGET).CFLAGS += -DUSE_JOYSTICK $(TARGET).CFLAGS += -DUSE_JOYSTICK
+1 -1
View File
@@ -4,7 +4,7 @@
<header> <header>
#include "subsystems/navigation/nav_line.h" #include "subsystems/navigation/nav_line.h"
#include "subsystems/datalink/datalink.h" #include "subsystems/datalink/datalink.h"
#include "joystick.h" #include "firmwares/fixedwing/joystick.h"
</header> </header>
<waypoints> <waypoints>
<waypoint name="HOME" x="0" y="0"/> <waypoint name="HOME" x="0" y="0"/>
+17 -6
View File
@@ -44,10 +44,6 @@
#include "subsystems/nav.h" #include "subsystems/nav.h"
#endif #endif
#if USE_JOYSTICK
#include "joystick.h"
#endif
#ifdef HITL #ifdef HITL
#include "subsystems/gps.h" #include "subsystems/gps.h"
#endif #endif
@@ -64,6 +60,21 @@
#include "subsystems/datalink/downlink.h" #include "subsystems/datalink/downlink.h"
#include "ap_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 MOfCm(_x) (((float)(_x))/100.)
#define SenderIdOfMsg(x) (x[0]) #define SenderIdOfMsg(x) (x[0])
@@ -184,8 +195,8 @@ void dl_parse_msg(void) {
#if USE_JOYSTICK #if USE_JOYSTICK
if (msg_id == DL_JOYSTICK_RAW && DL_JOYSTICK_RAW_ac_id(dl_buffer) == AC_ID) { if (msg_id == DL_JOYSTICK_RAW && DL_JOYSTICK_RAW_ac_id(dl_buffer) == AC_ID) {
JoystickHandeDatalink(DL_JOYSTICK_RAW_roll(dl_buffer), JoystickHandeDatalink(DL_JOYSTICK_RAW_roll(dl_buffer),
DL_JOYSTICK_RAW_pitch(dl_buffer), DL_JOYSTICK_RAW_pitch(dl_buffer),
DL_JOYSTICK_RAW_throttle(dl_buffer)); DL_JOYSTICK_RAW_throttle(dl_buffer));
} else } else
#endif // USE_JOYSTICK #endif // USE_JOYSTICK
#if defined RADIO_CONTROL && defined RADIO_CONTROL_TYPE_DATALINK #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
-3
View File
@@ -1,3 +0,0 @@
#include "joystick.h"
uint8_t joystick_block;
-20
View File
@@ -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 */