Spektrum pixracer fixes. Soft binding does not work yet.

This commit is contained in:
kevindehecker
2017-01-13 19:17:08 +01:00
parent e56c96c64e
commit 8325ed5239
5 changed files with 36 additions and 34 deletions
+3 -2
View File
@@ -29,7 +29,7 @@
</module>
<module name="gps" type="ubx_ucenter" />
<module name="stabilization" type="indi_simple" />
<module name="stabilization" type="rate_indi" />
<!--<module name="stabilization" type="rate_indi" />-->
<module name="ahrs" type="int_cmpl_quat" >
<define name="AHRS_ICQ_MAG_ID" value="MAG_HMC58XX_SENDER_ID" /> <!-- Meaning the external hmc-->
@@ -217,7 +217,8 @@
<define name="MODE_STARTUP" value="AP_MODE_ATTITUDE_DIRECT" />
<define name="MODE_MANUAL" value="AP_MODE_ATTITUDE_DIRECT" />
<define name="MODE_AUTO1" value="AP_MODE_HOVER_Z_HOLD" />
<define name="MODE_AUTO2" value="AP_MODE_RATE_DIRECT" />
<define name="MODE_AUTO2" value="AP_MODE_RC_DIRECT" />
<!-- <define name="MODE_AUTO2" value="AP_MODE_RATE_DIRECT" />-->
<define name="NO_RC_THRUST_LIMIT" value="TRUE" />
</section>
<section name="BAT">
+8 -8
View File
@@ -105,16 +105,16 @@
/* Soft binding Spektrum */
//ok
#define RADIO_CONTROL_POWER_PORT GPIOC
#define RADIO_CONTROL_POWER_PIN GPIO5
#define RADIO_CONTROL_POWER_ON gpio_set
#define RADIO_CONTROL_POWER_OFF gpio_clear
#define RADIO_CONTROL_POWER_PORT GPIOE
#define RADIO_CONTROL_POWER_PIN GPIO4 //SPEKTRUM POWER
#define RADIO_CONTROL_POWER_ON gpio_clear // yes, inverted
#define RADIO_CONTROL_POWER_OFF gpio_set
#define PERIPHERAL3V3_ENABLE_PORT GPIOE
#define PERIPHERAL3V3_ENABLE_PIN GPIO4
#define PERIPHERAL3V3_ENABLE_ON gpio_clear // yes, inverted
#define PERIPHERAL3V3_ENABLE_OFF gpio_set
#define PERIPHERAL3V3_ENABLE_PORT GPIOC //VDD_3V3_PERIPHERAL_EN
#define PERIPHERAL3V3_ENABLE_PIN GPIO5
#define PERIPHERAL3V3_ENABLE_ON gpio_set
#define PERIPHERAL3V3_ENABLE_OFF gpio_clear
/* Turn SBUS invert */
//ok
+4
View File
@@ -115,6 +115,10 @@ void mcu_init(void)
#if defined RADIO_CONTROL_POWER_PORT
gpio_setup_output(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN);
RADIO_CONTROL_POWER_ON(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN);
#endif
#ifdef PERIPHERAL3V3_ENABLE_PORT
gpio_setup_output(PERIPHERAL3V3_ENABLE_PORT, PERIPHERAL3V3_ENABLE_PIN);
PERIPHERAL3V3_ENABLE_ON(PERIPHERAL3V3_ENABLE_PORT, PERIPHERAL3V3_ENABLE_PIN);
#endif
/* for now this means using spektrum */
#if defined RADIO_CONTROL & defined RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT & defined RADIO_CONTROL_BIND_IMPL_FUNC & defined SPEKTRUM_BIND_PIN_PORT
@@ -33,41 +33,38 @@
#include "mcu_periph/gpio.h"
void spektrum_soft_bind_init(void) {
gpio_setup_output(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN);
RADIO_CONTROL_POWER_ON(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN);
#ifdef PERIPHERAL3V3_ENABLE_PORT // px4fmu 4 (pixracer) has this
gpio_setup_output(PERIPHERAL3V3_ENABLE_PORT, PERIPHERAL3V3_ENABLE_PIN);
PERIPHERAL3V3_ENABLE_ON(PERIPHERAL3V3_ENABLE_PORT, PERIPHERAL3V3_ENABLE_PIN);
#endif
void spektrum_soft_bind_init(void) {
}
uint8_t bind_soft_value;
void spektrum_soft_bind_click(uint8_t val __attribute__((unused)))
{
bool bind_soft_value;
void spektrum_soft_bind_click(bool val ) {
#ifndef INTER_MCU_AP
send_spektrum_bind();
send_spektrum_bind();
#else
intermcu_send_spektrum_bind();
intermcu_send_spektrum_bind();
#endif
bind_soft_value = val;
}
void send_spektrum_bind(void) {
//power cycle the spektrum
#if defined(RADIO_CONTROL_LED)
LED_OFF(RADIO_CONTROL_LED);
#endif
//power cycle the spektrum
RADIO_CONTROL_POWER_OFF(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN);
sys_time_usleep(1000000);
RADIO_CONTROL_POWER_ON(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN);
RADIO_CONTROL_POWER_OFF(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN);
sys_time_usleep(100000);
RADIO_CONTROL_POWER_ON(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN);
#if defined(RADIO_CONTROL_LED)
LED_ON(RADIO_CONTROL_LED);
#endif
//put to bind mode
RADIO_CONTROL_BIND_IMPL_FUNC(); //basically = radio_control_spektrum_try_bind()
//put to bind mode
RADIO_CONTROL_BIND_IMPL_FUNC(); //basically = radio_control_spektrum_try_bind()
SpektrumUartInit();
SpektrumUartInit();
}
@@ -29,11 +29,11 @@
#include "std.h"
extern void spektrum_soft_bind_init(void);
extern void spektrum_soft_bind_click(uint8_t val);
extern void spektrum_soft_bind_click(bool val);
void send_spektrum_bind(void);
extern uint8_t bind_soft_value;
extern bool bind_soft_value;
#endif