2012-08-28 18:11:49 +02:00
/**
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* @ file outputcalibrationpage . cpp
* @ author The OpenPilot Team , http : //www.openpilot.org Copyright (C) 2012.
* @ addtogroup
* @ {
* @ addtogroup OutputCalibrationPage
* @ {
* @ brief
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful , but
* WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License
* for more details .
*
* You should have received a copy of the GNU General Public License along
* with this program ; if not , write to the Free Software Foundation , Inc . ,
* 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*/
# include "outputcalibrationpage.h"
# include "ui_outputcalibrationpage.h"
2012-09-07 07:35:43 +02:00
# include "systemalarms.h"
# include "uavobjectmanager.h"
2012-08-28 18:11:49 +02:00
2014-08-26 22:34:58 +02:00
const QString OutputCalibrationPage : : MULTI_SVG_FILE = QString ( " :/setupwizard/resources/multirotor-shapes.svg " ) ;
2014-08-25 03:21:20 +10:00
const QString OutputCalibrationPage : : FIXEDWING_SVG_FILE = QString ( " :/setupwizard/resources/fixedwing-shapes-wizard.svg " ) ;
2014-12-07 04:26:09 +01:00
const QString OutputCalibrationPage : : GROUND_SVG_FILE = QString ( " :/setupwizard/resources/ground-shapes-wizard.svg " ) ;
2014-02-14 00:00:52 +01:00
2012-08-28 18:11:49 +02:00
OutputCalibrationPage : : OutputCalibrationPage ( SetupWizard * wizard , QWidget * parent ) :
2012-09-03 01:01:57 +02:00
AbstractWizardPage ( wizard , parent ) , ui ( new Ui : : OutputCalibrationPage ) , m_vehicleBoundsItem ( 0 ) ,
2012-09-26 00:42:17 +02:00
m_currentWizardIndex ( - 1 ) , m_calibrationUtil ( 0 )
2012-08-28 18:11:49 +02:00
{
ui - > setupUi ( this ) ;
2012-09-03 01:01:57 +02:00
2013-11-25 01:06:07 -05:00
qDebug ( ) < < " calling output calibration page " ;
2012-09-03 01:01:57 +02:00
m_vehicleRenderer = new QSvgRenderer ( ) ;
2013-12-15 21:37:19 -05:00
2014-08-26 22:34:58 +02:00
// move the code that was here to setupVehicle() so we can determine which image to use.
m_vehicleScene = new QGraphicsScene ( this ) ;
2013-12-16 14:29:04 -05:00
ui - > vehicleView - > setScene ( m_vehicleScene ) ;
2012-08-28 18:11:49 +02:00
}
OutputCalibrationPage : : ~ OutputCalibrationPage ( )
{
2013-05-19 17:37:30 +03:00
if ( m_calibrationUtil ) {
2012-09-03 01:01:57 +02:00
delete m_calibrationUtil ;
2012-09-05 00:58:53 +02:00
m_calibrationUtil = 0 ;
2012-09-03 01:01:57 +02:00
}
2015-02-15 18:32:01 +01:00
OutputCalibrationUtil : : stopOutputCalibration ( ) ;
2012-08-28 18:11:49 +02:00
delete ui ;
}
2012-09-03 01:01:57 +02:00
2014-02-14 00:00:52 +01:00
void OutputCalibrationPage : : loadSVGFile ( QString file )
{
if ( QFile : : exists ( file ) & & m_vehicleRenderer - > load ( file ) & & m_vehicleRenderer - > isValid ( ) ) {
ui - > vehicleView - > setScene ( m_vehicleScene ) ;
}
}
2014-08-18 01:20:31 +02:00
void OutputCalibrationPage : : setupActuatorMinMaxAndNeutral ( int motorChannelStart , int motorChannelEnd , int totalUsedChannels )
{
// Default values for the actuator settings, extra important for
// servos since a value out of range can actually destroy the
// vehicle if unlucky.
// Motors are not that important. REMOVE propellers always!!
2015-02-15 18:32:01 +01:00
OutputCalibrationUtil : : startOutputCalibration ( ) ;
2014-08-18 01:20:31 +02:00
for ( int servoid = 0 ; servoid < 12 ; servoid + + ) {
if ( servoid > = motorChannelStart & & servoid < = motorChannelEnd ) {
// Set to motor safe values
2015-03-05 21:45:08 +01:00
m_actuatorSettings [ servoid ] . channelMin = LOW_OUTPUT_RATE_MILLISECONDS ;
m_actuatorSettings [ servoid ] . channelNeutral = LOW_OUTPUT_RATE_MILLISECONDS ;
m_actuatorSettings [ servoid ] . channelMax = getHighOutputRate ( ) ;
2015-02-15 18:32:01 +01:00
m_actuatorSettings [ servoid ] . isReversableMotor = false ;
// Car and Tank should use reversable Esc/motors
if ( ( getWizard ( ) - > getVehicleSubType ( ) = = SetupWizard : : GROUNDVEHICLE_CAR )
| | ( getWizard ( ) - > getVehicleSubType ( ) = = SetupWizard : : GROUNDVEHICLE_DIFFERENTIAL ) ) {
2015-03-05 21:45:08 +01:00
m_actuatorSettings [ servoid ] . channelNeutral = NEUTRAL_OUTPUT_RATE_MILLISECONDS ;
2015-02-15 18:32:01 +01:00
m_actuatorSettings [ servoid ] . isReversableMotor = true ;
// Set initial output value
2015-03-05 21:45:08 +01:00
m_calibrationUtil - > startChannelOutput ( servoid , NEUTRAL_OUTPUT_RATE_MILLISECONDS ) ;
2015-02-15 18:32:01 +01:00
m_calibrationUtil - > stopChannelOutput ( ) ;
}
2014-08-18 01:20:31 +02:00
} else if ( servoid < totalUsedChannels ) {
// Set to servo safe values
2015-03-05 21:45:08 +01:00
m_actuatorSettings [ servoid ] . channelMin = NEUTRAL_OUTPUT_RATE_MILLISECONDS ;
m_actuatorSettings [ servoid ] . channelNeutral = NEUTRAL_OUTPUT_RATE_MILLISECONDS ;
m_actuatorSettings [ servoid ] . channelMax = NEUTRAL_OUTPUT_RATE_MILLISECONDS ;
2015-02-15 18:32:01 +01:00
// Set initial servo output value
2015-03-05 21:45:08 +01:00
m_calibrationUtil - > startChannelOutput ( servoid , NEUTRAL_OUTPUT_RATE_MILLISECONDS ) ;
2015-02-15 18:32:01 +01:00
m_calibrationUtil - > stopChannelOutput ( ) ;
2014-08-18 01:20:31 +02:00
} else {
// "Disable" these channels
2015-03-05 21:45:08 +01:00
m_actuatorSettings [ servoid ] . channelMin = LOW_OUTPUT_RATE_MILLISECONDS ;
m_actuatorSettings [ servoid ] . channelNeutral = LOW_OUTPUT_RATE_MILLISECONDS ;
m_actuatorSettings [ servoid ] . channelMax = LOW_OUTPUT_RATE_MILLISECONDS ;
2014-08-18 01:20:31 +02:00
}
}
}
2012-09-03 01:01:57 +02:00
void OutputCalibrationPage : : setupVehicle ( )
{
2012-09-09 23:44:42 +02:00
m_actuatorSettings = getWizard ( ) - > getActuatorSettings ( ) ;
2012-09-03 01:01:57 +02:00
m_wizardIndexes . clear ( ) ;
m_vehicleElementIds . clear ( ) ;
m_vehicleHighlightElementIndexes . clear ( ) ;
2012-09-09 23:44:42 +02:00
m_channelIndex . clear ( ) ;
2012-09-03 01:01:57 +02:00
m_currentWizardIndex = 0 ;
m_vehicleScene - > clear ( ) ;
2013-12-16 14:29:04 -05:00
2015-02-17 13:35:47 +01:00
resetOutputCalibrationUtil ( ) ;
2015-02-15 18:32:01 +01:00
2013-05-19 17:37:30 +03:00
switch ( getWizard ( ) - > getVehicleSubType ( ) ) {
case SetupWizard : : MULTI_ROTOR_TRI_Y :
2014-02-14 00:00:52 +01:00
// Loads the SVG file resourse and sets the scene
loadSVGFile ( MULTI_SVG_FILE ) ;
2013-12-16 14:29:04 -05:00
2014-02-14 00:00:52 +01:00
// The m_wizardIndexes array contains the index of the QStackedWidget
// in the page to use for each step.
2014-08-25 23:45:46 +02:00
m_wizardIndexes < < 0 < < 1 < < 1 < < 1 < < 2 ;
2014-02-14 00:00:52 +01:00
// All element ids to load from the svg file and manage.
2013-05-19 17:37:30 +03:00
m_vehicleElementIds < < " tri " < < " tri-frame " < < " tri-m1 " < < " tri-m2 " < < " tri-m3 " < < " tri-s1 " ;
2014-02-14 00:00:52 +01:00
// The index of the elementId to highlight ( not dim ) for each step
// this is the index in the m_vehicleElementIds - 1.
2014-08-25 23:45:46 +02:00
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 < < 4 ;
2014-02-14 00:00:52 +01:00
// The channel number to configure for each step.
2014-08-25 23:45:46 +02:00
m_channelIndex < < 0 < < 0 < < 1 < < 2 < < 3 ;
2014-02-14 00:00:52 +01:00
2015-02-15 18:32:01 +01:00
setupActuatorMinMaxAndNeutral ( 0 , 2 , 4 ) ;
2014-08-18 01:20:31 +02:00
2013-05-19 17:37:30 +03:00
getWizard ( ) - > setActuatorSettings ( m_actuatorSettings ) ;
break ;
case SetupWizard : : MULTI_ROTOR_QUAD_X :
2014-02-14 00:00:52 +01:00
loadSVGFile ( MULTI_SVG_FILE ) ;
2013-05-19 17:37:30 +03:00
m_wizardIndexes < < 0 < < 1 < < 1 < < 1 < < 1 ;
m_vehicleElementIds < < " quad-x " < < " quad-x-frame " < < " quad-x-m1 " < < " quad-x-m2 " < < " quad-x-m3 " < < " quad-x-m4 " ;
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 < < 4 ;
m_channelIndex < < 0 < < 0 < < 1 < < 2 < < 3 ;
2014-08-18 01:20:31 +02:00
setupActuatorMinMaxAndNeutral ( 0 , 3 , 4 ) ;
2013-05-19 17:37:30 +03:00
break ;
case SetupWizard : : MULTI_ROTOR_QUAD_PLUS :
2014-02-14 00:00:52 +01:00
loadSVGFile ( MULTI_SVG_FILE ) ;
2013-05-19 17:37:30 +03:00
m_wizardIndexes < < 0 < < 1 < < 1 < < 1 < < 1 ;
m_vehicleElementIds < < " quad-p " < < " quad-p-frame " < < " quad-p-m1 " < < " quad-p-m2 " < < " quad-p-m3 " < < " quad-p-m4 " ;
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 < < 4 ;
m_channelIndex < < 0 < < 0 < < 1 < < 2 < < 3 ;
2014-08-18 01:20:31 +02:00
setupActuatorMinMaxAndNeutral ( 0 , 3 , 4 ) ;
2013-05-19 17:37:30 +03:00
break ;
case SetupWizard : : MULTI_ROTOR_HEXA :
2014-02-14 00:00:52 +01:00
loadSVGFile ( MULTI_SVG_FILE ) ;
2013-05-19 17:37:30 +03:00
m_wizardIndexes < < 0 < < 1 < < 1 < < 1 < < 1 < < 1 < < 1 ;
m_vehicleElementIds < < " hexa " < < " hexa-frame " < < " hexa-m1 " < < " hexa-m2 " < < " hexa-m3 " < < " hexa-m4 " < < " hexa-m5 " < < " hexa-m6 " ;
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 < < 4 < < 5 < < 6 ;
m_channelIndex < < 0 < < 0 < < 1 < < 2 < < 3 < < 4 < < 5 ;
2014-08-18 01:20:31 +02:00
setupActuatorMinMaxAndNeutral ( 0 , 5 , 6 ) ;
2013-05-19 17:37:30 +03:00
break ;
case SetupWizard : : MULTI_ROTOR_HEXA_COAX_Y :
2014-02-14 00:00:52 +01:00
loadSVGFile ( MULTI_SVG_FILE ) ;
2013-05-19 17:37:30 +03:00
m_wizardIndexes < < 0 < < 1 < < 1 < < 1 < < 1 < < 1 < < 1 ;
m_vehicleElementIds < < " hexa-y6 " < < " hexa-y6-frame " < < " hexa-y6-m2 " < < " hexa-y6-m1 " < < " hexa-y6-m4 " < < " hexa-y6-m3 " < < " hexa-y6-m6 " < < " hexa-y6-m5 " ;
m_vehicleHighlightElementIndexes < < 0 < < 2 < < 1 < < 4 < < 3 < < 6 < < 5 ;
m_channelIndex < < 0 < < 0 < < 1 < < 2 < < 3 < < 4 < < 5 ;
2014-08-18 01:20:31 +02:00
setupActuatorMinMaxAndNeutral ( 0 , 5 , 6 ) ;
2013-05-19 17:37:30 +03:00
break ;
case SetupWizard : : MULTI_ROTOR_HEXA_H :
2014-02-14 00:00:52 +01:00
loadSVGFile ( MULTI_SVG_FILE ) ;
2013-05-19 17:37:30 +03:00
m_wizardIndexes < < 0 < < 1 < < 1 < < 1 < < 1 < < 1 < < 1 ;
m_vehicleElementIds < < " hexa-h " < < " hexa-h-frame " < < " hexa-h-m1 " < < " hexa-h-m2 " < < " hexa-h-m3 " < < " hexa-h-m4 " < < " hexa-h-m5 " < < " hexa-h-m6 " ;
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 < < 4 < < 5 < < 6 ;
m_channelIndex < < 0 < < 0 < < 1 < < 2 < < 3 < < 4 < < 5 ;
2014-08-18 01:20:31 +02:00
setupActuatorMinMaxAndNeutral ( 0 , 5 , 6 ) ;
2013-05-19 17:37:30 +03:00
break ;
2014-08-16 14:20:31 +10:00
case SetupWizard : : MULTI_ROTOR_HEXA_X :
2014-09-16 20:41:45 +02:00
loadSVGFile ( MULTI_SVG_FILE ) ;
2014-08-16 14:20:31 +10:00
m_wizardIndexes < < 0 < < 1 < < 1 < < 1 < < 1 < < 1 < < 1 ;
m_vehicleElementIds < < " hexa-x " < < " hexa-x-frame " < < " hexa-x-m1 " < < " hexa-x-m2 " < < " hexa-x-m3 " < < " hexa-x-m4 " < < " hexa-x-m5 " < < " hexa-x-m6 " ;
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 < < 4 < < 5 < < 6 ;
m_channelIndex < < 0 < < 0 < < 1 < < 2 < < 3 < < 4 < < 5 ;
2014-08-18 01:20:31 +02:00
setupActuatorMinMaxAndNeutral ( 0 , 5 , 6 ) ;
2014-08-16 14:20:31 +10:00
break ;
// Fixed Wing
2014-08-23 01:01:01 +10:00
case SetupWizard : : FIXED_WING_DUAL_AILERON :
2014-02-14 00:00:52 +01:00
loadSVGFile ( FIXEDWING_SVG_FILE ) ;
2014-08-25 23:45:46 +02:00
m_wizardIndexes < < 0 < < 1 < < 2 < < 2 < < 2 < < 2 ;
2014-09-02 14:23:26 +10:00
m_vehicleElementIds < < " aileron " < < " aileron-frame " < < " aileron-motor " < < " aileron-ail-left " < < " aileron-ail-right " < < " aileron-elevator " < < " aileron-rudder " ;
2014-08-25 23:45:46 +02:00
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 < < 4 < < 5 ;
2014-09-02 14:23:26 +10:00
m_channelIndex < < 0 < < 2 < < 0 < < 5 < < 1 < < 3 ;
2014-08-23 01:01:01 +10:00
2015-02-17 13:35:47 +01:00
setupActuatorMinMaxAndNeutral ( 2 , 2 , 6 ) ; // should be 5 instead 6 but output 5 is not used
2014-08-23 01:01:01 +10:00
getWizard ( ) - > setActuatorSettings ( m_actuatorSettings ) ;
break ;
case SetupWizard : : FIXED_WING_AILERON :
loadSVGFile ( FIXEDWING_SVG_FILE ) ;
2014-08-25 23:45:46 +02:00
m_wizardIndexes < < 0 < < 1 < < 2 < < 2 < < 2 ;
2014-09-02 14:23:26 +10:00
m_vehicleElementIds < < " aileron-single " < < " ail2-frame " < < " ail2-motor " < < " ail2-aileron " < < " ail2-elevator " < < " ail2-rudder " ;
2014-08-25 23:45:46 +02:00
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 < < 4 ;
2014-09-02 14:23:26 +10:00
m_channelIndex < < 0 < < 2 < < 0 < < 1 < < 3 ;
2014-08-18 01:20:31 +02:00
2014-08-25 23:45:46 +02:00
setupActuatorMinMaxAndNeutral ( 2 , 2 , 4 ) ;
2014-05-25 16:05:13 -04:00
2013-11-24 17:29:38 -05:00
getWizard ( ) - > setActuatorSettings ( m_actuatorSettings ) ;
break ;
2014-06-07 22:31:42 -04:00
case SetupWizard : : FIXED_WING_ELEVON :
2014-02-14 00:00:52 +01:00
loadSVGFile ( FIXEDWING_SVG_FILE ) ;
2014-08-25 23:45:46 +02:00
m_wizardIndexes < < 0 < < 1 < < 2 < < 2 ;
2014-06-07 22:31:42 -04:00
m_vehicleElementIds < < " elevon " < < " elevon-frame " < < " elevon-motor " < < " elevon-left " < < " elevon-right " ;
2014-08-25 23:45:46 +02:00
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 ;
m_channelIndex < < 0 < < 2 < < 0 < < 1 ;
2014-08-18 01:20:31 +02:00
2014-08-25 23:45:46 +02:00
setupActuatorMinMaxAndNeutral ( 2 , 2 , 3 ) ;
2014-05-25 16:05:13 -04:00
2014-11-17 00:27:16 +01:00
getWizard ( ) - > setActuatorSettings ( m_actuatorSettings ) ;
break ;
case SetupWizard : : FIXED_WING_VTAIL :
loadSVGFile ( FIXEDWING_SVG_FILE ) ;
m_wizardIndexes < < 0 < < 1 < < 2 < < 2 < < 2 < < 2 ;
m_vehicleElementIds < < " vtail " < < " vtail-frame " < < " vtail-motor " < < " vtail-ail-left " < < " vtail-ail-right " < < " vtail-rudder-left " < < " vtail-rudder-right " ;
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 < < 3 < < 4 < < 5 ;
m_channelIndex < < 0 < < 2 < < 0 < < 5 < < 3 < < 1 ;
2015-02-15 18:32:01 +01:00
setupActuatorMinMaxAndNeutral ( 2 , 2 , 6 ) ; // should be 5 instead 6 but output 5 is not used
2014-11-17 00:27:16 +01:00
2013-11-24 17:29:38 -05:00
getWizard ( ) - > setActuatorSettings ( m_actuatorSettings ) ;
break ;
2014-12-07 04:26:09 +01:00
// Ground vehicles
case SetupWizard : : GROUNDVEHICLE_CAR :
loadSVGFile ( GROUND_SVG_FILE ) ;
m_wizardIndexes < < 0 < < 1 < < 2 ;
m_vehicleElementIds < < " car " < < " car-frame " < < " car-motor " < < " car-steering " ;
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 ;
m_channelIndex < < 0 < < 1 < < 0 ;
2015-02-15 18:32:01 +01:00
setupActuatorMinMaxAndNeutral ( 1 , 1 , 2 ) ;
2014-12-07 04:26:09 +01:00
getWizard ( ) - > setActuatorSettings ( m_actuatorSettings ) ;
break ;
case SetupWizard : : GROUNDVEHICLE_DIFFERENTIAL :
loadSVGFile ( GROUND_SVG_FILE ) ;
m_wizardIndexes < < 0 < < 1 < < 1 ;
m_vehicleElementIds < < " tank " < < " tank-frame " < < " tank-left-motor " < < " tank-right-motor " ;
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 ;
2014-12-08 13:38:11 +01:00
m_channelIndex < < 0 < < 0 < < 1 ;
2014-12-07 04:26:09 +01:00
setupActuatorMinMaxAndNeutral ( 0 , 1 , 2 ) ;
getWizard ( ) - > setActuatorSettings ( m_actuatorSettings ) ;
break ;
case SetupWizard : : GROUNDVEHICLE_MOTORCYCLE :
loadSVGFile ( GROUND_SVG_FILE ) ;
m_wizardIndexes < < 0 < < 1 < < 2 ;
m_vehicleElementIds < < " motorbike " < < " motorbike-frame " < < " motorbike-motor " < < " motorbike-steering " ;
m_vehicleHighlightElementIndexes < < 0 < < 1 < < 2 ;
m_channelIndex < < 0 < < 1 < < 0 ;
2015-02-15 18:32:01 +01:00
setupActuatorMinMaxAndNeutral ( 1 , 1 , 2 ) ;
2014-12-07 04:26:09 +01:00
getWizard ( ) - > setActuatorSettings ( m_actuatorSettings ) ;
break ;
2013-05-19 17:37:30 +03:00
default :
break ;
2012-09-03 01:01:57 +02:00
}
2012-09-05 00:58:53 +02:00
2012-09-03 01:01:57 +02:00
setupVehicleItems ( ) ;
}
void OutputCalibrationPage : : setupVehicleItems ( )
{
m_vehicleItems . clear ( ) ;
m_vehicleBoundsItem = new QGraphicsSvgItem ( ) ;
m_vehicleBoundsItem - > setSharedRenderer ( m_vehicleRenderer ) ;
m_vehicleBoundsItem - > setElementId ( m_vehicleElementIds [ 0 ] ) ;
m_vehicleBoundsItem - > setZValue ( - 1 ) ;
m_vehicleBoundsItem - > setOpacity ( 0 ) ;
m_vehicleScene - > addItem ( m_vehicleBoundsItem ) ;
QRectF parentBounds = m_vehicleRenderer - > boundsOnElement ( m_vehicleElementIds [ 0 ] ) ;
2013-05-19 17:37:30 +03:00
for ( int i = 1 ; i < m_vehicleElementIds . size ( ) ; i + + ) {
2012-09-03 01:01:57 +02:00
QGraphicsSvgItem * item = new QGraphicsSvgItem ( ) ;
item - > setSharedRenderer ( m_vehicleRenderer ) ;
item - > setElementId ( m_vehicleElementIds [ i ] ) ;
item - > setZValue ( i ) ;
item - > setOpacity ( 1.0 ) ;
2012-09-07 07:35:43 +02:00
2012-09-03 01:01:57 +02:00
QRectF itemBounds = m_vehicleRenderer - > boundsOnElement ( m_vehicleElementIds [ i ] ) ;
item - > setPos ( itemBounds . x ( ) - parentBounds . x ( ) , itemBounds . y ( ) - parentBounds . y ( ) ) ;
m_vehicleScene - > addItem ( item ) ;
m_vehicleItems < < item ;
}
}
void OutputCalibrationPage : : startWizard ( )
{
ui - > calibrationStack - > setCurrentIndex ( m_wizardIndexes [ 0 ] ) ;
setupVehicleHighlightedPart ( ) ;
}
void OutputCalibrationPage : : setupVehicleHighlightedPart ( )
{
qreal dimOpaque = m_currentWizardIndex = = 0 ? 1.0 : 0.3 ;
qreal highlightOpaque = 1.0 ;
2013-05-19 17:37:30 +03:00
int highlightedIndex = m_vehicleHighlightElementIndexes [ m_currentWizardIndex ] ;
for ( int i = 0 ; i < m_vehicleItems . size ( ) ; i + + ) {
QGraphicsSvgItem * item = m_vehicleItems [ i ] ;
2012-09-03 01:01:57 +02:00
item - > setOpacity ( ( highlightedIndex = = i ) ? highlightOpaque : dimOpaque ) ;
}
}
void OutputCalibrationPage : : setWizardPage ( )
{
2012-09-09 23:44:42 +02:00
qDebug ( ) < < " Wizard index: " < < m_currentWizardIndex ;
QApplication : : processEvents ( ) ;
int currentPageIndex = m_wizardIndexes [ m_currentWizardIndex ] ;
qDebug ( ) < < " Current page: " < < currentPageIndex ;
2012-09-05 00:58:53 +02:00
ui - > calibrationStack - > setCurrentIndex ( currentPageIndex ) ;
2012-09-09 23:44:42 +02:00
2012-09-05 00:58:53 +02:00
int currentChannel = getCurrentChannel ( ) ;
2014-08-18 01:20:31 +02:00
qDebug ( ) < < " Current channel: " < < currentChannel + 1 ;
2013-05-19 17:37:30 +03:00
if ( currentChannel > = 0 ) {
if ( currentPageIndex = = 1 ) {
2012-09-09 23:44:42 +02:00
ui - > motorNeutralSlider - > setValue ( m_actuatorSettings [ currentChannel ] . channelNeutral ) ;
2015-02-15 21:35:39 +01:00
ui - > motorPWMValue - > setText ( QString ( tr ( " Output value : <b>%1</b> µs " ) ) . arg ( m_actuatorSettings [ currentChannel ] . channelNeutral ) ) ;
2015-02-15 18:32:01 +01:00
// Reversable motor found
if ( m_actuatorSettings [ currentChannel ] . isReversableMotor ) {
ui - > motorNeutralSlider - > setMinimum ( m_actuatorSettings [ currentChannel ] . channelMin ) ;
ui - > motorNeutralSlider - > setMaximum ( m_actuatorSettings [ currentChannel ] . channelMax ) ;
2015-02-16 01:22:04 +01:00
ui - > motorInfo - > setText ( tr ( " <html><head/><body><p><span style= \" font-size:10pt; \" >To find </span><span style= \" font-size:10pt; font-weight:600; \" >the neutral rate for this reversable motor</span><span style= \" font-size:10pt; \" >, press the Start button below and slide the slider to the right or left until you find the value where the motor doesn't start. <br/><br/>When done press button again to stop.</span></p></body></html> " ) ) ;
2015-02-15 18:32:01 +01:00
}
2013-05-19 17:37:30 +03:00
} else if ( currentPageIndex = = 2 ) {
2015-02-16 00:11:29 +01:00
ui - > servoPWMValue - > setText ( tr ( " Output value : <b>%1</b> µs " ) . arg ( m_actuatorSettings [ currentChannel ] . channelNeutral ) ) ;
2014-08-26 01:22:35 +02:00
if ( m_actuatorSettings [ currentChannel ] . channelMax < m_actuatorSettings [ currentChannel ] . channelMin & &
2014-08-26 22:34:58 +02:00
! ui - > reverseCheckbox - > isChecked ( ) ) {
2014-08-26 01:22:35 +02:00
ui - > reverseCheckbox - > setChecked ( true ) ;
} else {
ui - > reverseCheckbox - > setChecked ( false ) ;
}
2014-08-25 23:45:46 +02:00
enableServoSliders ( false ) ;
if ( ui - > reverseCheckbox - > isChecked ( ) ) {
ui - > servoMaxAngleSlider - > setValue ( m_actuatorSettings [ currentChannel ] . channelMax ) ;
ui - > servoCenterAngleSlider - > setValue ( m_actuatorSettings [ currentChannel ] . channelNeutral ) ;
ui - > servoMinAngleSlider - > setValue ( m_actuatorSettings [ currentChannel ] . channelMin ) ;
} else {
ui - > servoMinAngleSlider - > setValue ( m_actuatorSettings [ currentChannel ] . channelMin ) ;
ui - > servoCenterAngleSlider - > setValue ( m_actuatorSettings [ currentChannel ] . channelNeutral ) ;
ui - > servoMaxAngleSlider - > setValue ( m_actuatorSettings [ currentChannel ] . channelMax ) ;
}
2012-09-05 00:58:53 +02:00
}
}
2014-02-14 00:00:52 +01:00
setupVehicleHighlightedPart ( ) ;
2012-09-03 01:01:57 +02:00
}
void OutputCalibrationPage : : initializePage ( )
{
2013-05-19 17:37:30 +03:00
if ( m_vehicleScene ) {
2012-09-03 01:01:57 +02:00
setupVehicle ( ) ;
startWizard ( ) ;
}
}
2012-09-09 23:44:42 +02:00
bool OutputCalibrationPage : : validatePage ( )
{
2013-05-19 17:37:30 +03:00
if ( isFinished ( ) ) {
2012-09-26 00:42:17 +02:00
getWizard ( ) - > setActuatorSettings ( m_actuatorSettings ) ;
return true ;
} else {
m_currentWizardIndex + + ;
setWizardPage ( ) ;
return false ;
}
2012-09-09 23:44:42 +02:00
}
2012-09-03 01:01:57 +02:00
void OutputCalibrationPage : : showEvent ( QShowEvent * event )
2012-10-10 00:36:29 +02:00
{
Q_UNUSED ( event ) ;
2013-05-19 17:37:30 +03:00
if ( m_vehicleBoundsItem ) {
2012-10-10 00:36:29 +02:00
ui - > vehicleView - > setSceneRect ( m_vehicleBoundsItem - > boundingRect ( ) ) ;
ui - > vehicleView - > fitInView ( m_vehicleBoundsItem , Qt : : KeepAspectRatio ) ;
}
}
void OutputCalibrationPage : : resizeEvent ( QResizeEvent * event )
2012-09-03 01:01:57 +02:00
{
Q_UNUSED ( event ) ;
2013-05-19 17:37:30 +03:00
if ( m_vehicleBoundsItem ) {
2012-09-03 01:01:57 +02:00
ui - > vehicleView - > setSceneRect ( m_vehicleBoundsItem - > boundingRect ( ) ) ;
ui - > vehicleView - > fitInView ( m_vehicleBoundsItem , Qt : : KeepAspectRatio ) ;
}
}
2012-09-26 00:42:17 +02:00
void OutputCalibrationPage : : customBackClicked ( )
2012-09-03 01:01:57 +02:00
{
2013-05-19 17:37:30 +03:00
if ( m_currentWizardIndex > 0 ) {
2012-09-09 23:44:42 +02:00
m_currentWizardIndex - - ;
setWizardPage ( ) ;
2013-05-19 17:37:30 +03:00
} else {
2012-09-26 00:42:17 +02:00
getWizard ( ) - > back ( ) ;
}
2012-09-05 00:58:53 +02:00
}
quint16 OutputCalibrationPage : : getCurrentChannel ( )
{
2013-05-19 17:37:30 +03:00
return m_channelIndex [ m_currentWizardIndex ] ;
2012-09-05 00:58:53 +02:00
}
void OutputCalibrationPage : : enableButtons ( bool enable )
{
getWizard ( ) - > button ( QWizard : : NextButton ) - > setEnabled ( enable ) ;
2012-09-26 00:42:17 +02:00
getWizard ( ) - > button ( QWizard : : CustomButton1 ) - > setEnabled ( enable ) ;
2012-09-05 00:58:53 +02:00
getWizard ( ) - > button ( QWizard : : CancelButton ) - > setEnabled ( enable ) ;
getWizard ( ) - > button ( QWizard : : BackButton ) - > setEnabled ( enable ) ;
2012-09-09 23:44:42 +02:00
QApplication : : processEvents ( ) ;
2012-09-03 01:01:57 +02:00
}
void OutputCalibrationPage : : on_motorNeutralButton_toggled ( bool checked )
{
2012-09-05 00:58:53 +02:00
ui - > motorNeutralButton - > setText ( checked ? tr ( " Stop " ) : tr ( " Start " ) ) ;
2014-08-25 23:45:46 +02:00
ui - > motorNeutralSlider - > setEnabled ( checked ) ;
2014-08-26 22:34:58 +02:00
quint16 channel = getCurrentChannel ( ) ;
2014-10-27 15:24:23 +01:00
quint16 safeValue = m_actuatorSettings [ channel ] . channelMin ;
2015-02-15 18:32:01 +01:00
if ( m_actuatorSettings [ channel ] . isReversableMotor ) {
safeValue = m_actuatorSettings [ channel ] . channelNeutral ;
}
2014-10-25 11:35:05 +02:00
onStartButtonToggle ( ui - > motorNeutralButton , channel , m_actuatorSettings [ channel ] . channelNeutral , safeValue , ui - > motorNeutralSlider ) ;
2012-09-05 00:58:53 +02:00
}
2013-05-19 17:37:30 +03:00
void OutputCalibrationPage : : onStartButtonToggle ( QAbstractButton * button , quint16 channel , quint16 value , quint16 safeValue , QSlider * slider )
{
if ( button - > isChecked ( ) ) {
if ( checkAlarms ( ) ) {
2012-09-07 07:35:43 +02:00
enableButtons ( false ) ;
2014-08-25 23:45:46 +02:00
enableServoSliders ( true ) ;
2012-09-07 07:35:43 +02:00
m_calibrationUtil - > startChannelOutput ( channel , safeValue ) ;
slider - > setValue ( value ) ;
2012-09-09 23:44:42 +02:00
m_calibrationUtil - > setChannelOutputValue ( value ) ;
2013-05-19 17:37:30 +03:00
} else {
2012-09-07 07:35:43 +02:00
button - > setChecked ( false ) ;
}
2013-05-19 17:37:30 +03:00
} else {
2015-02-15 18:32:01 +01:00
// Servos and ReversableMotors
m_calibrationUtil - > startChannelOutput ( channel , m_actuatorSettings [ channel ] . channelNeutral ) ;
// Normal motor
2015-02-17 13:35:47 +01:00
if ( ( button = = ui - > motorNeutralButton ) & & ! m_actuatorSettings [ channel ] . isReversableMotor ) {
2015-02-15 18:32:01 +01:00
m_calibrationUtil - > startChannelOutput ( channel , m_actuatorSettings [ channel ] . channelMin ) ;
}
2012-09-03 01:01:57 +02:00
m_calibrationUtil - > stopChannelOutput ( ) ;
2015-02-15 18:32:01 +01:00
2014-08-25 23:45:46 +02:00
enableServoSliders ( false ) ;
2012-09-05 00:58:53 +02:00
enableButtons ( true ) ;
2012-09-03 01:01:57 +02:00
}
2012-09-16 15:14:47 +02:00
debugLogChannelValues ( ) ;
2012-09-03 01:01:57 +02:00
}
2014-08-25 23:45:46 +02:00
void OutputCalibrationPage : : enableServoSliders ( bool enabled )
{
ui - > servoCenterAngleSlider - > setEnabled ( enabled ) ;
ui - > servoMinAngleSlider - > setEnabled ( enabled ) ;
ui - > servoMaxAngleSlider - > setEnabled ( enabled ) ;
2014-08-26 01:22:35 +02:00
ui - > reverseCheckbox - > setEnabled ( ! enabled ) ;
2014-08-25 23:45:46 +02:00
}
2012-09-07 07:35:43 +02:00
bool OutputCalibrationPage : : checkAlarms ( )
{
ExtensionSystem : : PluginManager * pm = ExtensionSystem : : PluginManager : : instance ( ) ;
UAVObjectManager * uavObjectManager = pm - > getObject < UAVObjectManager > ( ) ;
2013-05-19 17:37:30 +03:00
2012-09-07 07:35:43 +02:00
Q_ASSERT ( uavObjectManager ) ;
2013-05-19 17:37:30 +03:00
SystemAlarms * systemAlarms = SystemAlarms : : GetInstance ( uavObjectManager ) ;
2012-09-09 23:44:42 +02:00
Q_ASSERT ( systemAlarms ) ;
SystemAlarms : : DataFields data = systemAlarms - > getData ( ) ;
2012-09-07 07:35:43 +02:00
2013-05-19 17:37:30 +03:00
if ( data . Alarm [ SystemAlarms : : ALARM_ACTUATOR ] ! = SystemAlarms : : ALARM_OK ) {
2012-10-16 00:37:15 +02:00
QMessageBox mbox ( this ) ;
2012-09-07 07:35:43 +02:00
mbox . setText ( QString ( tr ( " The actuator module is in an error state. \n \n "
2012-10-16 00:37:15 +02:00
" Please make sure the correct firmware version is used then "
" restart the wizard and try again. If the problem persists please "
" consult the openpilot.org support forum. " ) ) ) ;
2012-09-07 07:35:43 +02:00
mbox . setStandardButtons ( QMessageBox : : Ok ) ;
mbox . setIcon ( QMessageBox : : Critical ) ;
2012-10-16 00:37:15 +02:00
getWizard ( ) - > setWindowFlags ( getWizard ( ) - > windowFlags ( ) & ~ Qt : : WindowStaysOnTopHint ) ;
2012-09-07 07:35:43 +02:00
mbox . exec ( ) ;
2012-10-16 00:37:15 +02:00
getWizard ( ) - > setWindowFlags ( getWizard ( ) - > windowFlags ( ) | Qt : : WindowStaysOnTopHint ) ;
getWizard ( ) - > setWindowIcon ( qApp - > windowIcon ( ) ) ;
getWizard ( ) - > show ( ) ;
2012-09-07 07:35:43 +02:00
return false ;
}
return true ;
}
2012-09-16 15:14:47 +02:00
void OutputCalibrationPage : : debugLogChannelValues ( )
{
quint16 channel = getCurrentChannel ( ) ;
2013-05-19 17:37:30 +03:00
2012-09-16 15:14:47 +02:00
qDebug ( ) < < " ChannelMin : " < < m_actuatorSettings [ channel ] . channelMin ;
qDebug ( ) < < " ChannelNeutral: " < < m_actuatorSettings [ channel ] . channelNeutral ;
qDebug ( ) < < " ChannelMax : " < < m_actuatorSettings [ channel ] . channelMax ;
}
2015-03-05 21:45:08 +01:00
int OutputCalibrationPage : : getHighOutputRate ( )
{
if ( getWizard ( ) - > getEscType ( ) = = SetupWizard : : ESC_ONESHOT ) {
return HIGH_OUTPUT_RATE_MILLISECONDS_ONESHOT125 ;
} else {
return HIGH_OUTPUT_RATE_MILLISECONDS_PWM ;
}
}
2012-09-03 01:01:57 +02:00
void OutputCalibrationPage : : on_motorNeutralSlider_valueChanged ( int value )
{
2013-04-16 19:41:13 +02:00
Q_UNUSED ( value ) ;
2015-02-16 00:11:29 +01:00
ui - > motorPWMValue - > setText ( tr ( " Output value : <b>%1</b> µs " ) . arg ( value ) ) ;
2015-02-15 18:32:01 +01:00
2013-05-19 17:37:30 +03:00
if ( ui - > motorNeutralButton - > isChecked ( ) ) {
2012-09-07 07:35:43 +02:00
quint16 value = ui - > motorNeutralSlider - > value ( ) ;
m_calibrationUtil - > setChannelOutputValue ( value ) ;
2012-09-09 23:44:42 +02:00
m_actuatorSettings [ getCurrentChannel ( ) ] . channelNeutral = value ;
2012-09-16 15:14:47 +02:00
debugLogChannelValues ( ) ;
2012-09-03 01:01:57 +02:00
}
}
2014-08-25 23:45:46 +02:00
void OutputCalibrationPage : : on_servoButton_toggled ( bool checked )
2012-09-03 01:01:57 +02:00
{
2014-08-25 23:45:46 +02:00
ui - > servoButton - > setText ( checked ? tr ( " Stop " ) : tr ( " Start " ) ) ;
2013-05-19 17:37:30 +03:00
quint16 channel = getCurrentChannel ( ) ;
2014-08-26 22:34:58 +02:00
quint16 safeValue = m_actuatorSettings [ channel ] . channelNeutral ;
2014-08-25 23:45:46 +02:00
onStartButtonToggle ( ui - > servoButton , channel , safeValue , safeValue , ui - > servoCenterAngleSlider ) ;
2012-09-05 00:58:53 +02:00
}
2012-09-03 01:01:57 +02:00
2014-08-25 23:45:46 +02:00
void OutputCalibrationPage : : on_servoCenterAngleSlider_valueChanged ( int position )
2012-09-05 00:58:53 +02:00
{
2013-04-16 19:41:13 +02:00
Q_UNUSED ( position ) ;
2014-08-25 23:45:46 +02:00
quint16 value = ui - > servoCenterAngleSlider - > value ( ) ;
m_calibrationUtil - > setChannelOutputValue ( value ) ;
quint16 channel = getCurrentChannel ( ) ;
m_actuatorSettings [ channel ] . channelNeutral = value ;
2015-02-16 00:11:29 +01:00
ui - > servoPWMValue - > setText ( tr ( " Output value : <b>%1</b> µs " ) . arg ( value ) ) ;
2012-09-16 15:14:47 +02:00
2014-08-25 23:45:46 +02:00
// Adjust min and max
if ( ui - > reverseCheckbox - > isChecked ( ) ) {
if ( value > = m_actuatorSettings [ channel ] . channelMin ) {
ui - > servoMinAngleSlider - > setValue ( value ) ;
2012-09-16 15:14:47 +02:00
}
2014-08-25 23:45:46 +02:00
if ( value < = m_actuatorSettings [ channel ] . channelMax ) {
ui - > servoMaxAngleSlider - > setValue ( value ) ;
}
} else {
if ( value < = m_actuatorSettings [ channel ] . channelMin ) {
ui - > servoMinAngleSlider - > setValue ( value ) ;
}
if ( value > = m_actuatorSettings [ channel ] . channelMax ) {
ui - > servoMaxAngleSlider - > setValue ( value ) ;
2012-09-16 15:14:47 +02:00
}
2012-09-05 00:58:53 +02:00
}
2014-08-25 23:45:46 +02:00
debugLogChannelValues ( ) ;
2012-09-03 01:01:57 +02:00
}
void OutputCalibrationPage : : on_servoMinAngleSlider_valueChanged ( int position )
{
2013-04-16 19:41:13 +02:00
Q_UNUSED ( position ) ;
2014-08-25 23:45:46 +02:00
quint16 value = ui - > servoMinAngleSlider - > value ( ) ;
m_calibrationUtil - > setChannelOutputValue ( value ) ;
m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin = value ;
// Adjust neutral and max
if ( ui - > reverseCheckbox - > isChecked ( ) ) {
2014-08-26 22:34:58 +02:00
if ( value < = m_actuatorSettings [ getCurrentChannel ( ) ] . channelNeutral ) {
2014-08-25 23:45:46 +02:00
ui - > servoCenterAngleSlider - > setValue ( value ) ;
}
2014-08-26 22:34:58 +02:00
if ( value < = m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax ) {
2014-08-25 23:45:46 +02:00
ui - > servoMaxAngleSlider - > setValue ( value ) ;
}
} else {
2014-08-26 22:34:58 +02:00
if ( value > = m_actuatorSettings [ getCurrentChannel ( ) ] . channelNeutral ) {
2014-08-25 23:45:46 +02:00
ui - > servoCenterAngleSlider - > setValue ( value ) ;
}
2014-08-26 22:34:58 +02:00
if ( value > = m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax ) {
2014-08-25 23:45:46 +02:00
ui - > servoMaxAngleSlider - > setValue ( value ) ;
}
2012-09-16 15:14:47 +02:00
}
2014-08-25 23:45:46 +02:00
debugLogChannelValues ( ) ;
2012-09-07 07:35:43 +02:00
}
2012-09-03 01:01:57 +02:00
2014-08-25 23:45:46 +02:00
void OutputCalibrationPage : : on_servoMaxAngleSlider_valueChanged ( int position )
2012-09-07 07:35:43 +02:00
{
2014-08-25 23:45:46 +02:00
Q_UNUSED ( position ) ;
quint16 value = ui - > servoMaxAngleSlider - > value ( ) ;
m_calibrationUtil - > setChannelOutputValue ( value ) ;
m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax = value ;
// Adjust neutral and min
if ( ui - > reverseCheckbox - > isChecked ( ) ) {
2014-08-26 22:34:58 +02:00
if ( value > = m_actuatorSettings [ getCurrentChannel ( ) ] . channelNeutral ) {
2014-08-25 23:45:46 +02:00
ui - > servoCenterAngleSlider - > setValue ( value ) ;
}
2014-08-26 22:34:58 +02:00
if ( value > = m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin ) {
2014-08-25 23:45:46 +02:00
ui - > servoMinAngleSlider - > setValue ( value ) ;
}
} else {
2014-08-26 22:34:58 +02:00
if ( value < = m_actuatorSettings [ getCurrentChannel ( ) ] . channelNeutral ) {
2014-08-25 23:45:46 +02:00
ui - > servoCenterAngleSlider - > setValue ( value ) ;
}
2014-08-26 22:34:58 +02:00
if ( value < = m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin ) {
2014-08-25 23:45:46 +02:00
ui - > servoMinAngleSlider - > setValue ( value ) ;
}
}
debugLogChannelValues ( ) ;
2012-09-07 07:35:43 +02:00
}
2014-08-25 23:45:46 +02:00
void OutputCalibrationPage : : on_reverseCheckbox_toggled ( bool checked )
2012-09-07 07:35:43 +02:00
{
2014-08-26 01:22:35 +02:00
if ( checked & & m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax > m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin ) {
2014-08-25 23:45:46 +02:00
quint16 oldMax = m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax ;
m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax = m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin ;
m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin = oldMax ;
2014-08-26 01:22:35 +02:00
} else if ( ! checked & & m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax < m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin ) {
2014-08-25 23:45:46 +02:00
quint16 oldMax = m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax ;
m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax = m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin ;
m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin = oldMax ;
2012-09-16 15:14:47 +02:00
}
2014-08-26 01:22:35 +02:00
ui - > servoCenterAngleSlider - > setInvertedAppearance ( checked ) ;
ui - > servoCenterAngleSlider - > setInvertedControls ( checked ) ;
ui - > servoMinAngleSlider - > setInvertedAppearance ( checked ) ;
ui - > servoMinAngleSlider - > setInvertedControls ( checked ) ;
ui - > servoMaxAngleSlider - > setInvertedAppearance ( checked ) ;
ui - > servoMaxAngleSlider - > setInvertedControls ( checked ) ;
if ( ui - > reverseCheckbox - > isChecked ( ) ) {
ui - > servoMaxAngleSlider - > setValue ( m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax ) ;
ui - > servoCenterAngleSlider - > setValue ( m_actuatorSettings [ getCurrentChannel ( ) ] . channelNeutral ) ;
ui - > servoMinAngleSlider - > setValue ( m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin ) ;
} else {
ui - > servoMinAngleSlider - > setValue ( m_actuatorSettings [ getCurrentChannel ( ) ] . channelMin ) ;
ui - > servoCenterAngleSlider - > setValue ( m_actuatorSettings [ getCurrentChannel ( ) ] . channelNeutral ) ;
ui - > servoMaxAngleSlider - > setValue ( m_actuatorSettings [ getCurrentChannel ( ) ] . channelMax ) ;
}
2012-09-03 01:01:57 +02:00
}
2015-02-17 13:35:47 +01:00
void OutputCalibrationPage : : resetOutputCalibrationUtil ( )
{
if ( m_calibrationUtil ) {
delete m_calibrationUtil ;
m_calibrationUtil = 0 ;
}
m_calibrationUtil = new OutputCalibrationUtil ( ) ;
}