mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Added optional output of GCSReceiver from the OPLink to the FC. This will happen automatically if a PPM packet is receive, and PPM output is disabled.
This commit is contained in:
parent
cf7c929030
commit
1af58e510e
@ -203,7 +203,6 @@ static int32_t RadioComBridgeInitialize(void)
|
||||
return -1;
|
||||
|
||||
// Initialize the UAVObjects that we use
|
||||
GCSReceiverInitialize();
|
||||
OPLinkStatusInitialize();
|
||||
ObjectPersistenceInitialize();
|
||||
|
||||
@ -217,6 +216,9 @@ static int32_t RadioComBridgeInitialize(void)
|
||||
// Configure our UAVObjects for updates.
|
||||
UAVObjConnectQueue(UAVObjGetByID(OPLINKSTATUS_OBJID), data->uavtalkEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ);
|
||||
UAVObjConnectQueue(UAVObjGetByID(OBJECTPERSISTENCE_OBJID), data->uavtalkEventQueue, EV_UPDATED | EV_UPDATED_MANUAL);
|
||||
#if defined(PIOS_INCLUDE_RFM22B_GCSRECEIVER)
|
||||
UAVObjConnectQueue(UAVObjGetByID(GCSRECEIVER_OBJID), data->uavtalkEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ);
|
||||
#endif
|
||||
|
||||
// Initialize the statistics.
|
||||
data->comTxErrors = 0;
|
||||
|
@ -53,6 +53,9 @@
|
||||
|
||||
#include <pios_spi_priv.h>
|
||||
#include <packet_handler.h>
|
||||
#if defined(PIOS_INCLUDE_RFM22B_GCSRECEIVER)
|
||||
#include <gcsreceiver.h>
|
||||
#endif
|
||||
#include <pios_rfm22b_priv.h>
|
||||
#include <pios_ppm_out_priv.h>
|
||||
#include <ecc.h>
|
||||
@ -611,6 +614,11 @@ int32_t PIOS_RFM22B_Init(uint32_t *rfm22b_id, uint32_t spi_id, uint32_t slave_nu
|
||||
rfm22b_dev->deviceID = crcs[0] | crcs[1] << 8 | crcs[2] << 16 | crcs[3] << 24;
|
||||
DEBUG_PRINTF(2, "RF device ID: %x\n\r", rfm22b_dev->deviceID);
|
||||
|
||||
#if defined(PIOS_INCLUDE_RFM22B_GCSRECEIVER)
|
||||
// Initialize the GCSReceive object
|
||||
GCSReceiverInitialize();
|
||||
#endif
|
||||
|
||||
// Initialize the external interrupt.
|
||||
PIOS_EXTI_Init(cfg->exti_cfg);
|
||||
|
||||
@ -1776,16 +1784,26 @@ static enum pios_rfm22b_event rfm22_rxData(struct pios_rfm22b_dev *rfm22b_dev)
|
||||
break;
|
||||
case PACKET_TYPE_PPM:
|
||||
{
|
||||
PHPpmPacketHandle ppmp = (PHPpmPacketHandle)&(rfm22b_dev->rx_packet);
|
||||
for (uint8_t i = 0; i < PIOS_RFM22B_RCVR_MAX_CHANNELS; ++i) {
|
||||
rfm22b_dev->ppm_channel[i] = ppmp->channels[i];
|
||||
PHPpmPacketHandle ppmp = (PHPpmPacketHandle)&(rfm22b_dev->rx_packet);
|
||||
bool ppm_output = false;
|
||||
#if defined(PIOS_INCLUDE_PPM_OUT) && defined(PIOS_PPM_OUTPUT)
|
||||
if (PIOS_PPM_OUTPUT)
|
||||
PIOS_PPM_OUT_Set(PIOS_PPM_OUTPUT, i, ppmp->channels[i]);
|
||||
#endif /* PIOS_INCLUDE_PPM_OUT && PIOS_PPM_OUTPUT */
|
||||
}
|
||||
rfm22b_dev->ppm_fresh = true;
|
||||
break;
|
||||
if (PIOS_PPM_OUTPUT) {
|
||||
ppm_output = true;
|
||||
for (uint8_t i = 0; i < PIOS_RFM22B_RCVR_MAX_CHANNELS; ++i) {
|
||||
PIOS_PPM_OUT_Set(PIOS_PPM_OUTPUT, i, ppmp->channels[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(PIOS_INCLUDE_RFM22B_GCSRECEIVER)
|
||||
if (!ppm_output) {
|
||||
GCSReceiverData gcsRcvr;
|
||||
for (uint8_t i = 0; (i < PIOS_RFM22B_RCVR_MAX_CHANNELS) && (i < GCSRECEIVER_CHANNEL_NUMELEM); ++i) {
|
||||
gcsRcvr.Channel[i] = ppmp->channels[i];
|
||||
}
|
||||
GCSReceiverSet(&gcsRcvr);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
@ -793,11 +793,6 @@ struct pios_rfm22b_dev {
|
||||
portTickType tx_complete_ticks;
|
||||
portTickType rx_complete_ticks;
|
||||
uint8_t max_ack_delay;
|
||||
|
||||
// The PPM channel values
|
||||
uint16_t ppm_channel[PIOS_RFM22B_RCVR_MAX_CHANNELS];
|
||||
uint8_t ppm_supv_timer;
|
||||
bool ppm_fresh;
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#define PIOS_INCLUDE_IAP
|
||||
#define PIOS_INCLUDE_RFM22B
|
||||
#define PIOS_INCLUDE_RFM22B_COM
|
||||
#define PIOS_INCLUDE_RFM22B_GCSRECEIVER
|
||||
#define PIOS_INCLUDE_RCVR
|
||||
#define PIOS_INCLUDE_TIM
|
||||
|
||||
@ -70,33 +71,6 @@
|
||||
#define LOG_FILENAME "PIOS.LOG"
|
||||
#define STARTUP_LOG_ENABLED 1
|
||||
|
||||
/* COM Module */
|
||||
#define GPS_BAUDRATE 19200
|
||||
#define TELEM_BAUDRATE 19200
|
||||
#define AUXUART_ENABLED 0
|
||||
#define AUXUART_BAUDRATE 19200
|
||||
|
||||
/* Alarm Thresholds */
|
||||
#define HEAP_LIMIT_WARNING 220
|
||||
#define HEAP_LIMIT_CRITICAL 40
|
||||
#define IRQSTACK_LIMIT_WARNING 100
|
||||
#define IRQSTACK_LIMIT_CRITICAL 60
|
||||
#define CPULOAD_LIMIT_WARNING 85
|
||||
#define CPULOAD_LIMIT_CRITICAL 95
|
||||
|
||||
/* Task stack sizes */
|
||||
#define PIOS_ACTUATOR_STACK_SIZE 1020
|
||||
#define PIOS_MANUAL_STACK_SIZE 724
|
||||
#define PIOS_SYSTEM_STACK_SIZE 460
|
||||
#define PIOS_STABILIZATION_STACK_SIZE 524
|
||||
#define PIOS_TELEM_STACK_SIZE 500
|
||||
#define PIOS_EVENTDISPATCHER_STACK_SIZE 130
|
||||
#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998
|
||||
//#define PIOS_QUATERNION_STABILIZATION
|
||||
|
||||
// This can't be too high to stop eventdispatcher thread overflowing
|
||||
#define PIOS_EVENTDISAPTCHER_QUEUE 10
|
||||
|
||||
/* PIOS Initcall infrastructure */
|
||||
#define PIOS_INCLUDE_INITCALL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user