1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

Merge remote-tracking branch 'origin/next' into thread/OP-984_PID_banks_GUI

This commit is contained in:
Fredrik Arvidsson 2014-01-09 19:29:53 +01:00
commit cd5fb01d7e
5 changed files with 36 additions and 21 deletions

2
.gitignore vendored
View File

@ -10,6 +10,7 @@ GPATH
GRTAGS GRTAGS
GSYMS GSYMS
GTAGS GTAGS
core
# flight # flight
/flight/*.pnproj /flight/*.pnproj
@ -56,6 +57,7 @@ openpilotgcs-build-desktop
/.cproject /.cproject
/.project /.project
/.metadata /.metadata
/.settings
# Ignore Eclipse temp folder, git plugin based? # Ignore Eclipse temp folder, git plugin based?
RemoteSystemsTempFiles RemoteSystemsTempFiles

View File

@ -104,6 +104,7 @@ int32_t EventDispatcherInitialize()
// Create callback // Create callback
eventSchedulerCallback = DelayedCallbackCreate(&eventTask, CALLBACK_PRIORITY, TASK_PRIORITY, STACK_SIZE * 4); eventSchedulerCallback = DelayedCallbackCreate(&eventTask, CALLBACK_PRIORITY, TASK_PRIORITY, STACK_SIZE * 4);
DelayedCallbackDispatch(eventSchedulerCallback);
// Done // Done
return 0; return 0;

View File

@ -126,7 +126,7 @@ Vector3f twostep_bias_only(const Vector3f samples[],
const float noise) const float noise)
{ {
// \tilde{H} // \tilde{H}
Vector3f centeredSamples[n_samples]; Vector3f *centeredSamples = new Vector3f[n_samples];
// z_k // z_k
float sampleDeltaMag[n_samples]; float sampleDeltaMag[n_samples];
// eq 7 and 8 applied to samples // eq 7 and 8 applied to samples
@ -172,6 +172,7 @@ Vector3f twostep_bias_only(const Vector3f samples[],
// Note that the negative has been done twice // Note that the negative has been done twice
estimate += neg_increment; estimate += neg_increment;
} }
delete[] centeredSamples;
return estimate; return estimate;
} }

View File

@ -205,6 +205,8 @@ qint64 RawHIDReadThread::getBytesAvailable()
return m_readBuffer.size(); return m_readBuffer.size();
} }
// *********************************************************************************
RawHIDWriteThread::RawHIDWriteThread(RawHID *hid) RawHIDWriteThread::RawHIDWriteThread(RawHID *hid)
: m_hid(hid), : m_hid(hid),
hiddev(&hid->dev), hiddev(&hid->dev),
@ -212,8 +214,6 @@ RawHIDWriteThread::RawHIDWriteThread(RawHID *hid)
m_running(true) m_running(true)
{} {}
// *********************************************************************************
RawHIDWriteThread::~RawHIDWriteThread() RawHIDWriteThread::~RawHIDWriteThread()
{ {
m_running = false; m_running = false;
@ -227,29 +227,31 @@ void RawHIDWriteThread::run()
{ {
while (m_running) { while (m_running) {
char buffer[WRITE_SIZE] = { 0 }; char buffer[WRITE_SIZE] = { 0 };
int size;
m_writeBufMtx.lock(); {
int size = qMin(WRITE_SIZE - 2, m_writeBuffer.size()); QMutexLocker lock(&m_writeBufMtx);
while (size <= 0) { size = qMin(WRITE_SIZE - 2, m_writeBuffer.size());
// wait on new data to write condition, the timeout while (size <= 0) {
// enable the thread to shutdown properly // wait on new data to write condition, the timeout
m_newDataToWrite.wait(&m_writeBufMtx, 200); // enable the thread to shutdown properly
if (!m_running) { m_newDataToWrite.wait(&m_writeBufMtx, 200);
return; if (!m_running) {
return;
}
size = m_writeBuffer.size();
} }
size = m_writeBuffer.size(); // NOTE: data size is limited to 2 bytes less than the
// usb packet size (64 bytes for interrupt) to make room
// for the reportID and valid data length
size = qMin(WRITE_SIZE - 2, m_writeBuffer.size());
memcpy(&buffer[2], m_writeBuffer.constData(), size);
buffer[1] = size; // valid data length
buffer[0] = 2; // reportID
} }
// NOTE: data size is limited to 2 bytes less than the
// usb packet size (64 bytes for interrupt) to make room
// for the reportID and valid data length
size = qMin(WRITE_SIZE - 2, m_writeBuffer.size());
memcpy(&buffer[2], m_writeBuffer.constData(), size);
buffer[1] = size; // valid data length
buffer[0] = 2; // reportID
m_writeBufMtx.unlock();
// must hold lock through the send to know how much was sent // must hold lock through the send to know how much was sent
int ret = hiddev->send(hidno, buffer, WRITE_SIZE, WRITE_TIMEOUT); int ret = hiddev->send(hidno, buffer, WRITE_SIZE, WRITE_TIMEOUT);

View File

@ -5,6 +5,15 @@
SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415b", MODE="0664", GROUP="plugdev" SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415b", MODE="0664", GROUP="plugdev"
# OpenPilot OPLink Mini radio modem board # OpenPilot OPLink Mini radio modem board
SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415c", MODE="0664", GROUP="plugdev" SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415c", MODE="0664", GROUP="plugdev"
# OpenPilot Revolution board
SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415e", MODE="0664", GROUP="plugdev"
# Other OpenPilot reserved pids
SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415d", MODE="0664", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="4194", MODE="0664", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="4195", MODE="0664", GROUP="plugdev"
# unprogrammed openpilot flight control board # unprogrammed openpilot flight control board
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5750", MODE="0664", GROUP="plugdev" SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5750", MODE="0664", GROUP="plugdev"
# FTDI FT2232C Dual USB-UART/FIFO IC # FTDI FT2232C Dual USB-UART/FIFO IC