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-1685_cc_oneshot_support

Conflicts:
	ground/openpilotgcs/src/plugins/config/output.ui
This commit is contained in:
m_thread 2015-02-18 00:26:04 +01:00
commit d859ad78df
15 changed files with 84 additions and 44 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 KiB

View File

@ -806,7 +806,7 @@ static void actuator_update_rate_if_changed(const ActuatorSettingsData *actuator
freq[i] = 100; // Value must be small enough so CCr isn't update until the PIOS_Servo_Update is triggered
clock[i] = ACTUATOR_ONESHOT125_CLOCK; // Setup an 8MHz timer clock
break;
case ACTUATORSETTINGS_BANKMODE_ONESHOT:
case ACTUATORSETTINGS_BANKMODE_PWMSYNC:
freq[i] = 100;
clock[i] = ACTUATOR_PWM_CLOCK;
break;

View File

@ -717,7 +717,7 @@ void PIOS_Board_Init(void)
uint8_t hwsettings_rcvrport;
HwSettingsCC_RcvrPortGet(&hwsettings_rcvrport);
switch (hwsettings_rcvrport) {
switch ((HwSettingsCC_RcvrPortOptions)hwsettings_rcvrport) {
case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT:
#if defined(PIOS_INCLUDE_HCSR04)
{
@ -746,7 +746,7 @@ void PIOS_Board_Init(void)
#if defined(PIOS_INCLUDE_PPM)
{
uint32_t pios_ppm_id;
if( hwsettings_rcvrport == HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT){
if (hwsettings_rcvrport == HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT) {
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_pin6_cfg);
} else {
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_cfg);
@ -787,6 +787,8 @@ void PIOS_Board_Init(void)
}
#endif /* PIOS_INCLUDE_PWM */
break;
case HWSETTINGS_CC_RCVRPORT_OUTPUTSONESHOT:
break;
}
#if defined(PIOS_INCLUDE_GCSRCVR)
@ -804,11 +806,12 @@ void PIOS_Board_Init(void)
GPIO_PinRemapConfig(GPIO_Remap_SWJ_NoJTRST, ENABLE);
#ifndef PIOS_ENABLE_DEBUG_PINS
switch (hwsettings_rcvrport) {
switch ((HwSettingsCC_RcvrPortOptions)hwsettings_rcvrport) {
case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT:
case HWSETTINGS_CC_RCVRPORT_PWMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPMPWMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT:
PIOS_Servo_Init(&pios_servo_cfg);
break;
case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTSNOONESHOT:
@ -865,17 +868,20 @@ SystemAlarmsExtendedAlarmStatusOptions CopterControlConfigHook()
uint8_t recmode;
HwSettingsCC_RcvrPortGet(&recmode);
uint8_t flexiMode;
uint8_t modes[ACTUATORSETTINGS_BANKMODE_NUMELEM];
ActuatorSettingsBankModeGet(modes);
HwSettingsCC_FlexiPortGet(&flexiMode);
switch ((HwSettingsCC_RcvrPortOptions)recmode) {
// Those modes allows oneshot usage
case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT:
case HWSETTINGS_CC_RCVRPORT_OUTPUTSONESHOT:
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
case HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT:
if (modes[3] == ACTUATORSETTINGS_BANKMODE_ONESHOT ||
modes[3] == ACTUATORSETTINGS_BANKMODE_ONESHOT125) {
if ((recmode == HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT ||
flexiMode == HWSETTINGS_CC_FLEXIPORT_PPM) &&
(modes[3] == ACTUATORSETTINGS_BANKMODE_PWMSYNC ||
modes[3] == ACTUATORSETTINGS_BANKMODE_ONESHOT125)) {
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;
} else {
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
@ -887,7 +893,7 @@ SystemAlarmsExtendedAlarmStatusOptions CopterControlConfigHook()
case HWSETTINGS_CC_RCVRPORT_PPMPWMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PWMNOONESHOT:
for (uint8_t i = 0; i < ACTUATORSETTINGS_BANKMODE_NUMELEM; i++) {
if (modes[i] == ACTUATORSETTINGS_BANKMODE_ONESHOT ||
if (modes[i] == ACTUATORSETTINGS_BANKMODE_PWMSYNC ||
modes[i] == ACTUATORSETTINGS_BANKMODE_ONESHOT125) {
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;;
}

View File

@ -1551,6 +1551,17 @@
<enableVbo>false</enableVbo>
</data>
</Revolution>
<Blackout_MiniH>
<configInfo>
<locked>false</locked>
<version>0.0.0</version>
</configInfo>
<data>
<acFilename>%%DATAPATH%%models/multi/blackout/BlackoutMiniHQuad.3DS</acFilename>
<bgFilename>%%DATAPATH%%models/backgrounds/default_background.png</bgFilename>
<enableVbo>false</enableVbo>
</data>
</Blackout_MiniH>
<Zagi>
<configInfo>
<locked>false</locked>
@ -2530,7 +2541,7 @@
<side0>
<classId>ModelViewGadget</classId>
<gadget>
<activeConfiguration>Test Quad X</activeConfiguration>
<activeConfiguration>Blackout_MiniH</activeConfiguration>
</gadget>
<type>uavGadget</type>
</side0>

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 KiB

View File

@ -107,7 +107,7 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode5, 4, 0, true);
addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode6, 5, 0, true);
systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager());
SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager());
connect(systemAlarmsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateWarnings(UAVObject *)));
disconnect(this, SLOT(refreshWidgetsValues(UAVObject *)));
@ -116,11 +116,13 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
refreshWidgetsValues();
updateEnableControls();
setWarning("PIppo");
}
ConfigOutputWidget::~ConfigOutputWidget()
{
SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager());
disconnect(systemAlarmsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateWarnings(UAVObject *)));
// Do nothing
}
@ -151,6 +153,7 @@ void ConfigOutputWidget::sendAllChannelTests()
*/
void ConfigOutputWidget::runChannelTests(bool state)
{
SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager());
SystemAlarms::DataFields systemAlarms = systemAlarmsObj->getData();
if (state && systemAlarms.Alarm[SystemAlarms::ALARM_ACTUATOR] != SystemAlarms::ALARM_OK) {
@ -444,6 +447,7 @@ void ConfigOutputWidget::stopTests()
void ConfigOutputWidget::updateWarnings(UAVObject *)
{
SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager());
SystemAlarms::DataFields systemAlarms = systemAlarmsObj->getData();
if (systemAlarms.Alarm[SystemAlarms::ALARM_SYSTEMCONFIGURATION] > SystemAlarms::ALARM_WARNING) {
@ -458,6 +462,8 @@ void ConfigOutputWidget::updateWarnings(UAVObject *)
void ConfigOutputWidget::setWarning(QString message)
{
QPixmap warningPic;
ui->gvWarning->scene()->clear();
if (!message.isNull()) {
warningPic.load(":/configgadget/images/error.svg");

View File

@ -57,7 +57,6 @@ private:
Ui_OutputWidget *ui;
QList<QSlider> sliders;
QPixmap warningPic;
void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev, int value);
void assignOutputChannel(UAVDataObject *obj, QString &str);
@ -72,7 +71,6 @@ private:
UAVObject::Metadata accInitialData;
SystemAlarms *systemAlarmsObj;
private slots:
void updateWarnings(UAVObject *);
void stopTests();

View File

@ -27,6 +27,9 @@
#include "outputchannelform.h"
#define MAXOUTPUT_VALUE 2500
#define MINOUTPUT_VALUE 500
OutputChannelForm::OutputChannelForm(const int index, QWidget *parent) :
ChannelForm(index, parent), ui(), m_inChannelTest(false)
{
@ -45,6 +48,14 @@ OutputChannelForm::OutputChannelForm(const int index, QWidget *parent) :
ui.actuatorLink->setChecked(false);
connect(ui.actuatorLink, SIGNAL(toggled(bool)), this, SLOT(linkToggled(bool)));
// Set limits
ui.actuatorMin->setMaximum(MAXOUTPUT_VALUE);
ui.actuatorMax->setMaximum(MAXOUTPUT_VALUE);
ui.actuatorValue->setMaximum(MAXOUTPUT_VALUE);
ui.actuatorMin->setMinimum(MINOUTPUT_VALUE);
ui.actuatorMax->setMinimum(MINOUTPUT_VALUE);
ui.actuatorValue->setMinimum(MINOUTPUT_VALUE);
disableMouseWheelEvents();
}
@ -221,11 +232,13 @@ void OutputChannelForm::setRange(int minimum, int maximum)
*/
void OutputChannelForm::setChannelRange()
{
int oldMini = ui.actuatorNeutral->minimum();
int oldMini = ui.actuatorNeutral->minimum();
int minValue = ui.actuatorMin->value();
int maxValue = ui.actuatorMax->value();
// int oldMaxi = ui.actuatorNeutral->maximum();
if (ui.actuatorMin->value() < ui.actuatorMax->value()) {
if (minValue <= maxValue) {
ui.actuatorNeutral->setRange(ui.actuatorMin->value(), ui.actuatorMax->value());
ui.actuatorRev->setChecked(false);
} else {
@ -237,6 +250,33 @@ void OutputChannelForm::setChannelRange()
ui.actuatorNeutral->setValue(ui.actuatorNeutral->minimum());
}
// Enable only outputs already set in mixer
if (name() != "-") {
ui.actuatorMin->setEnabled(true);
ui.actuatorMax->setEnabled(true);
ui.actuatorNeutral->setEnabled(true);
ui.actuatorValue->setEnabled(true);
// Enable checkboxes Rev and Link if some range
if (minValue != maxValue) {
ui.actuatorRev->setEnabled(true);
ui.actuatorLink->setEnabled(true);
} else {
ui.actuatorRev->setEnabled(false);
ui.actuatorLink->setEnabled(false);
}
} else {
ui.actuatorMin->setEnabled(false);
ui.actuatorMax->setEnabled(false);
ui.actuatorRev->setEnabled(false);
ui.actuatorLink->setEnabled(false);
ui.actuatorMin->setValue(1000);
ui.actuatorMax->setValue(1000);
ui.actuatorNeutral->setRange(minValue, maxValue);
ui.actuatorNeutral->setEnabled(false);
ui.actuatorValue->setEnabled(false);
}
// if (ui.actuatorNeutral->value() == oldMaxi)
// this can be dangerous if it happens to be controlling a motor at the time!
// ui.actuatorNeutral->setValue(ui.actuatorNeutral->maximum());

View File

@ -33,9 +33,6 @@
#include <QDebug>
#include <QString>
#include <QMutex>
#if defined(Q_OS_LINUX)
#include <usb.h>
#endif
#include "../hidapi/hidapi.h"
#include "ophid_const.h"
#include "ophid_global.h"

View File

@ -38,38 +38,20 @@ macx {
-framework IOKit
}
linux-g++ {
linux {
SOURCES += src/ophid_usbmon_linux.cpp
LIBS += -lusb -ludev
LIBS += -ludev -lrt -lpthread
# hidapi library
## rawhid
# SOURCES += hidapi/linux/hid.c
## libusb
SOURCES += hidapi/libusb/hid.c
LIBS += `pkg-config libusb-1.0 --libs` -lrt -lpthread
INCLUDEPATH += /usr/include/libusb-1.0
# INCLUDEPATH += `pkg-config libusb-1.0 --cflags`
CONFIG += link_pkgconfig
PKGCONFIG += libusb-1.0
!exists(/usr/include/libusb-1.0) {
error(Install libusb-1.0.0-dev using your package manager.)
error(Install libusb-1.0-0-dev using your package manager.)
}
}
linux-g++-64 {
SOURCES += src/ophid_usbmon_linux.cpp
LIBS += -lusb -ludev
# hidapi library
## rawhid
# SOURCES += hidapi/linux/hid.c
## libusb
SOURCES += hidapi/libusb/hid.c
LIBS += `pkg-config libusb-1.0 --libs` -lrt -lpthread
INCLUDEPATH += /usr/include/libusb-1.0
# INCLUDEPATH += `pkg-config libusb-1.0 --cflags`
!exists(/usr/include/libusb-1.0) {
error(Install libusb-1.0.0-dev using your package manager.)
}
}

View File

@ -2,7 +2,7 @@
<object name="ActuatorSettings" singleinstance="true" settings="true" category="Control">
<description>Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType</description>
<field name="BankUpdateFreq" units="Hz" type="uint16" elements="6" defaultvalue="50"/>
<field name="BankMode" type="enum" units="" elements="6" options="PWM,OneShot,OneShot125" defaultvalue="PWM"/>
<field name="BankMode" type="enum" units="" elements="6" options="PWM,PWMSync,OneShot125" defaultvalue="PWM"/>
<field name="ChannelMax" units="us" type="int16" elements="12" defaultvalue="1000"/>
<field name="ChannelNeutral" units="us" type="int16" elements="12" defaultvalue="1000"/>
<field name="ChannelMin" units="us" type="int16" elements="12" defaultvalue="1000"/>