diff --git a/conf/airframes/miniwing.xml b/conf/airframes/miniwing.xml index 3d3d5d1157..7b9951cb12 100644 --- a/conf/airframes/miniwing.xml +++ b/conf/airframes/miniwing.xml @@ -12,8 +12,8 @@ - - + + @@ -172,10 +172,6 @@ -
- -
- CONFIG = \"tiny_2_1.h\" diff --git a/conf/radios/generic_tm.xml b/conf/radios/generic_tm.xml new file mode 100644 index 0000000000..b35b928b6f --- /dev/null +++ b/conf/radios/generic_tm.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/airborne/datalink.c b/sw/airborne/datalink.c index c785ab8f4f..5825e14c39 100644 --- a/sw/airborne/datalink.c +++ b/sw/airborne/datalink.c @@ -45,6 +45,10 @@ #include "joystick.h" #endif +#ifdef USE_RC_TELEMETRY +#include "ppm.h" +#endif + #ifdef USE_USB_SERIAL #include "usb_serial.h" #endif @@ -165,6 +169,14 @@ void dl_parse_msg(void) { DL_JOYSTICK_RAW_throttle(dl_buffer)); } else #endif // USE_JOYSTICK +#ifdef USE_RC_TELEMETRY + if (msg_id == DL_RC_3CH /*&& DL_RC_3CH_ac_id(dl_buffer) == TX_ID*/) { +LED_TOGGLE(3); + ppm_datalink(DL_RC_3CH_throttle_mode(dl_buffer), + DL_RC_3CH_roll(dl_buffer), + DL_RC_3CH_pitch(dl_buffer)); + } else +#endif // USE_RC_TELEMETRY { /* Last else */ #ifdef USE_MODULES /* Parse modules datalink */ diff --git a/sw/airborne/ppm.h b/sw/airborne/ppm.h index c01ecaec04..b689a7d9e3 100644 --- a/sw/airborne/ppm.h +++ b/sw/airborne/ppm.h @@ -32,7 +32,11 @@ extern uint16_t ppm_pulses[ PPM_NB_PULSES ]; extern volatile bool_t ppm_valid; +#ifdef USE_RC_TELEMETRY +#include "ppm_telemetry.h" +#else #include "ppm_hw.h" +#endif #endif /* RADIO_CONTROL */ diff --git a/sw/airborne/ppm_telemetry.c b/sw/airborne/ppm_telemetry.c new file mode 100644 index 0000000000..a881debfa2 --- /dev/null +++ b/sw/airborne/ppm_telemetry.c @@ -0,0 +1,26 @@ + +#include "ppm.h" +#include "std.h" + +#define PPM_NB_CHANNEL PPM_NB_PULSES + +uint16_t ppm_pulses[PPM_NB_CHANNEL]; +volatile bool_t ppm_valid; + + +void ppm_datalink( uint8_t throttle_mode, + int8_t roll, + int8_t pitch) +{ + int throttle = throttle_mode & 0xFC; + int mode = throttle_mode & 0x03; + + ppm_pulses[RADIO_ROLL] = (roll * 4 + 1500) * 15; + ppm_pulses[RADIO_PITCH] = (pitch * 4 + 1500) * 15; + ppm_pulses[RADIO_THROTTLE] = (throttle * 4 + 1000) * 15; + ppm_pulses[RADIO_MODE] = (1000 + mode * 500) * 15; + + ppm_valid = TRUE; +} + + diff --git a/sw/airborne/ppm_telemetry.h b/sw/airborne/ppm_telemetry.h new file mode 100644 index 0000000000..7cb39cdfa0 --- /dev/null +++ b/sw/airborne/ppm_telemetry.h @@ -0,0 +1,21 @@ +#ifndef PPM_TELEMETRY_H +#define PPM_TELEMETRY_H + + +#include BOARD_CONFIG + + +static inline void ppm_init ( void ) { + ppm_valid = FALSE; +} + +#define PPM_ISR() {} + +#define PPM_IT 0x00 + +void ppm_datalink( uint8_t throttle_mode, + int8_t roll, + int8_t pitch) +; + +#endif /* PPM_TELEMETRY_H */ diff --git a/sw/logalizer/ctrlstick.c b/sw/logalizer/ctrlstick.c index fbe970650c..d445722257 100644 --- a/sw/logalizer/ctrlstick.c +++ b/sw/logalizer/ctrlstick.c @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -//#define DBG 1 +#define DBG 1 #include #include @@ -62,19 +62,23 @@ #if 1 // e-sky 0905A simulator fms -#define AXIS_YAW ABS_X -#define AXIS_PITCH ABS_Y -#define AXIS_ROLL ABS_Z -#define AXIS_THROTTLE ABS_RY +//#define AXIS_YAW ABS_X +//#define AXIS_ROLL ABS_Z +//#define AXIS_THROTTLE ABS_RY +//#define AXIS_PITCH ABS_Y +#define AXIS_YAW ABS_RY +#define AXIS_ROLL ABS_Y +#define AXIS_THROTTLE ABS_X +#define AXIS_PITCH ABS_Z #define THROTTLE_MIN (-90) #define THROTTLE_NEUTRAL (0) #define THROTTLE_MAX (90) #define ROLL_MIN (-122) -#define ROLL_NEUTRAL (-2) +#define ROLL_NEUTRAL (-13) #define ROLL_MAX (113) #define PITCH_MIN (-109) -#define PITCH_NEUTRAL (2) +#define PITCH_NEUTRAL (-2) #define PITCH_MAX (109) #define YAW_MIN (125) #define YAW_NEUTRAL (-13 @@ -315,8 +319,8 @@ static gboolean joystick_periodic(gpointer data __attribute__ ((unused))) { { dbgprintf(stdout, "pos %d %d %d %d\n", position[0], position[1], position[2], position[3]); - if (position[3] > 125) mode = 1; - else if (position[3] < -125) mode = 2; + if (position[3] > 125) mode = 2; + else if (position[3] < -125) mode = 1; else mode = 0; throttle = ((position[0] - THROTTLE_NEUTRAL -THROTTLE_MIN) * 63) / (THROTTLE_MAX-THROTTLE_MIN);