mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Added initialization of the ECC, which was removed with the removal of the packet handler. Removed a couple of test functions from RadioComBridge module. Turned on watchdog timers in RadioComBridge (and RFM22B driver).
This commit is contained in:
parent
9765244753
commit
9225debdc1
@ -90,8 +90,6 @@ typedef struct {
|
||||
static void telemetryTxTask(void *parameters);
|
||||
static void radioRxTask(void *parameters);
|
||||
static void radioTxTask(void *parameters);
|
||||
static void testRxTask(void *parameters);
|
||||
static void testTxTask(void *parameters);
|
||||
static int32_t UAVTalkSendHandler(uint8_t *buf, int32_t length);
|
||||
static int32_t RadioSendHandler(uint8_t *buf, int32_t length);
|
||||
static void ProcessInputStream(UAVTalkConnection connectionHandle, uint8_t rxbyte);
|
||||
@ -123,11 +121,13 @@ static int32_t RadioComBridgeStart(void)
|
||||
xTaskCreate(telemetryTxTask, (signed char *)"telemTxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->telemetryTxTaskHandle));
|
||||
xTaskCreate(radioRxTask, (signed char *)"radioRxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->radioRxTaskHandle));
|
||||
xTaskCreate(radioTxTask, (signed char *)"radioTxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->radioTxTaskHandle));
|
||||
if (0)
|
||||
{
|
||||
xTaskCreate(testRxTask, (signed char *)"testRxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->radioRxTaskHandle));
|
||||
xTaskCreate(testTxTask, (signed char *)"testTxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->radioTxTaskHandle));
|
||||
}
|
||||
|
||||
// Register the watchdog timers.
|
||||
#ifdef PIOS_INCLUDE_WDG
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_TELEMETRY);
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_RADIORX);
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_RADIOTX);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -163,7 +163,6 @@ 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);
|
||||
//UAVObjConnectQueue(UAVObjGetByID(GCSRECEIVER_OBJID), data->uavtalkEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ);
|
||||
|
||||
// Initialize the statistics.
|
||||
data->comTxErrors = 0;
|
||||
@ -183,8 +182,11 @@ static void telemetryTxTask(void *parameters)
|
||||
|
||||
// Loop forever
|
||||
while (1) {
|
||||
#ifdef PIOS_INCLUDE_WDG
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_TELEMETRY);
|
||||
#endif
|
||||
// Wait for queue message
|
||||
if (xQueueReceive(data->uavtalkEventQueue, &ev, portMAX_DELAY) == pdTRUE) {
|
||||
if (xQueueReceive(data->uavtalkEventQueue, &ev, MAX_PORT_DELAY) == pdTRUE) {
|
||||
if ((ev.event == EV_UPDATED) || (ev.event == EV_UPDATE_REQ))
|
||||
{
|
||||
// Send update (with retries)
|
||||
@ -232,6 +234,9 @@ static void radioRxTask(void *parameters)
|
||||
{
|
||||
// Task loop
|
||||
while (1) {
|
||||
#ifdef PIOS_INCLUDE_WDG
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_RADIORX);
|
||||
#endif
|
||||
uint8_t serial_data[1];
|
||||
uint16_t bytes_to_process = PIOS_COM_ReceiveBuffer(PIOS_COM_RADIO, serial_data, sizeof(serial_data), MAX_PORT_DELAY);
|
||||
if (bytes_to_process > 0)
|
||||
@ -249,6 +254,9 @@ static void radioTxTask(void *parameters)
|
||||
// Task loop
|
||||
while (1) {
|
||||
uint32_t inputPort = PIOS_COM_TELEMETRY;
|
||||
#ifdef PIOS_INCLUDE_WDG
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_RADIOTX);
|
||||
#endif
|
||||
#if defined(PIOS_INCLUDE_USB)
|
||||
// Determine output port (USB takes priority over telemetry port)
|
||||
if (PIOS_USB_CheckAvailable(0) && PIOS_COM_TELEM_USB)
|
||||
@ -265,39 +273,6 @@ static void radioTxTask(void *parameters)
|
||||
}
|
||||
}
|
||||
|
||||
static void testTxTask(void *parameters)
|
||||
{
|
||||
uint8_t buf[100];
|
||||
for (uint8_t i = 0; i < 100; ++i)
|
||||
buf[i] = i;
|
||||
|
||||
// Task loop
|
||||
uint16_t packets_sent = 0;
|
||||
while (1) {
|
||||
PIOS_COM_SendBuffer(PIOS_COM_RADIO, buf, 100);
|
||||
packets_sent++;
|
||||
OPLinkStatusTXRateSet(&packets_sent);
|
||||
vTaskDelay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Radio rx task. Receive data from a com port and pass it on to the radio.
|
||||
*/
|
||||
static void testRxTask(void *parameters)
|
||||
{
|
||||
// Task loop
|
||||
uint16_t packets_recv = 0;
|
||||
while (1) {
|
||||
uint8_t buf[100];
|
||||
int16_t bytes_received = PIOS_COM_ReceiveBuffer(PIOS_COM_RADIO, buf, 100, MAX_PORT_DELAY);
|
||||
if (bytes_received > 0) {
|
||||
packets_recv++;
|
||||
OPLinkStatusRXRateSet(&packets_recv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transmit data buffer to the com port.
|
||||
* \param[in] buf Data buffer to send
|
||||
@ -314,7 +289,7 @@ static int32_t UAVTalkSendHandler(uint8_t *buf, int32_t length)
|
||||
outputPort = PIOS_COM_TELEM_USB;
|
||||
#endif /* PIOS_INCLUDE_USB */
|
||||
if(outputPort)
|
||||
return PIOS_COM_SendBuffer(outputPort, buf, length);
|
||||
return PIOS_COM_SendBufferNonBlocking(outputPort, buf, length);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
@ -71,12 +71,10 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
|
||||
//------------------------
|
||||
#define PIOS_WATCHDOG_TIMEOUT 500
|
||||
#define PIOS_WDG_REGISTER BKP_DR4
|
||||
#define PIOS_WDG_COMGCS 0x0001
|
||||
#define PIOS_WDG_COMUAVTALK 0x0002
|
||||
#define PIOS_WDG_RADIORECEIVE 0x0004
|
||||
#define PIOS_WDG_SENDDATA 0x0008
|
||||
#define PIOS_WDG_TRANSCOMM 0x0008
|
||||
#define PIOS_WDG_PPMINPUT 0x0010
|
||||
#define PIOS_WDG_TELEMETRY 0x0001
|
||||
#define PIOS_WDG_RADIORX 0x0002
|
||||
#define PIOS_WDG_RADIOTX 0x0004
|
||||
#define PIOS_WDG_RFM22B 0x0008
|
||||
|
||||
//------------------------
|
||||
// TELEMETRY
|
||||
|
@ -614,6 +614,9 @@ int32_t PIOS_RFM22B_Init(uint32_t *rfm22b_id, uint32_t spi_id, uint32_t slave_nu
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_RFM22B);
|
||||
#endif /* PIOS_WDG_RFM22B */
|
||||
|
||||
// Initialize the ECC library.
|
||||
initialize_ecc();
|
||||
|
||||
// Set the state to initializing.
|
||||
rfm22b_dev->state = RFM22B_STATE_UNINITIALIZED;
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
#define PIOS_INCLUDE_GPIO
|
||||
#define PIOS_INCLUDE_EXTI
|
||||
#define PIOS_INCLUDE_RTC
|
||||
//#define PIOS_INCLUDE_WDG
|
||||
#define PIOS_INCLUDE_WDG
|
||||
#define PIOS_INCLUDE_BL_HELPER
|
||||
#define PIOS_INCLUDE_FLASH_EEPROM
|
||||
#define PIOS_INCLUDE_RFM22B
|
||||
|
Loading…
x
Reference in New Issue
Block a user