Esempio n. 1
0
void readEEPROM(void)
{
    // Sanity check
    if (!isEEPROMContentValid())
        failureMode(10);

    // Read flash
    memcpy(&masterConfig, (char *) CONFIG_START_FLASH_ADDRESS, sizeof(master_t));

    if (masterConfig.current_profile_index > MAX_PROFILE_COUNT - 1) // sanity check
        masterConfig.current_profile_index = 0;

    setProfile(masterConfig.current_profile_index);

    if (currentProfile->defaultRateProfileIndex > MAX_CONTROL_RATE_PROFILE_COUNT - 1) // sanity check
        currentProfile->defaultRateProfileIndex = 0;

    setControlRateProfile(currentProfile->defaultRateProfileIndex);

    validateAndFixConfig();
    activateConfig();
}
Esempio n. 2
0
CYm2149Ex::CYm2149Ex(ymProfile profile, ymu32 playRate)
{
    ymint i,env;

    frameCycle = 0;
    //--------------------------------------------------------
    // build env shapes.
    //--------------------------------------------------------
    ymu8 *pEnv = &envData[0][0][0];
    for (env=0;env<16;env++)
    {
        const ymint *pse = EnvWave[env];
        for (ymint phase=0;phase<4;phase++)
        {
            pEnv = ym2149EnvInit(pEnv,pse[phase*2+0],pse[phase*2+1]);
        }
    }

    setProfile(profile);

    internalClock = profile.masterClock;
    replayFrequency = playRate;
    cycleSample = 0;

    // Set volume voice pointers.
    pVolA = &volA;
    pVolB = &volB;
    pVolC = &volC;

    for(ymint i = 0; i < 3; i++)
    {
        filters[i].push_back(new SimpleLowPassFilter());
        filters[i].push_back(new DCRemover());
    }

    // Reset YM2149
    reset();
}
Esempio n. 3
0
cgfxPass::cgfxPass(
    CGpass                  pass,
    const cgfxProfile*      profile
)
 :	fPass( pass),
	fProgram( NULL),
	fParameters( NULL),
    fDefaultProfile("default", pass),
	fNext( NULL)
{
	if( pass)
	{
		fName = cgGetPassName( pass);
		CGstateassignment stateAssignment = cgGetFirstStateAssignment( pass);
		cgfxVaryingParameter** nextParameter = &fParameters;
		while( stateAssignment )
		{
			CGstate state = cgGetStateAssignmentState( stateAssignment);
			if( cgGetStateType( state) == CG_PROGRAM_TYPE && 
					( stricmp( cgGetStateName( state), "vertexProgram") == 0 ||
					  stricmp( cgGetStateName( state), "vertexShader") == 0))
			{
				fProgram = cgGetProgramStateAssignmentValue( stateAssignment);
				if( fProgram)
				{
					CGparameter parameter = cgGetFirstParameter( fProgram, CG_PROGRAM);
					while( parameter)
					{
                        cgfxVaryingParameter::addRecursive( parameter, nextParameter);
						parameter = cgGetNextParameter( parameter);
					}
				}
			}
            setProfile(profile);
			stateAssignment = cgGetNextStateAssignment( stateAssignment);
		}
	}
}
Esempio n. 4
0
static void changePMProfile(GtkWidget *widget,
        gpointer data){
    
    pm_profile_t newProfile = *(pm_profile_t*)data;
    
    if (curCard == NULL){
        curCard = "card0";
    }
    
    if (newProfile < 0 || newProfile >= MAX_PROFILE){
        g_error("Invalid new profile %d\n", newProfile);
        return;
    }
    
    if (canModifyPM()) {
        g_print("Setting profile %s\n", pm_profile_names[newProfile]);

        setMethod(curCard, PROFILE);
        setProfile(curCard, newProfile);
    } else {
        g_print("Insufficient permissions to set profile to %s\n", pm_profile_names[newProfile]);
    }
}
Esempio n. 5
0
    // Handling the binder transaction to BWCService 
    status_t BnBWCService::onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) 
    {    
        status_t ret = 0;


        switch(code) 
        {
            // Set current BWC profile (profile id, state id)
        case BWC_SET_PROFILE:
            {
                int profile = 0;
                int state = 0;
                data.readInt32(&profile);
                data.readInt32(&state);
                ret = setProfile(profile, state);
                reply->writeInt32(ret);
            }
            break;

        default:
            return BBinder::onTransact(code, data, reply, flags);
        }
        return ret;
    }
void doProfileXhtml()
{
	setProfile(_T("xhtml"), g_fiProfileXhtml);
}
Esempio n. 7
0
boolean pidCmnd::doCommand( CmndParser* pars ) {
  if( strcmp( keyword, pars->cmndName() ) == 0 ) {
    if( strcmp( pars->paramStr(1), "ON" ) == 0 ) {
      #ifdef PID_CONTROL
        myPID.SetMode(1);
        #ifdef ACKS_ON
        Serial.println("# PID turned ON");
        #endif
      #endif
      return true;
    }
    else if( strcmp( pars->paramStr(1), "OFF" ) == 0 ) {
      #ifdef PID_CONTROL
        myPID.SetMode(0);
        #ifdef ACKS_ON
        Serial.println("# PID turned OFF");
        #endif
      #endif
      return true;
    }
    else if( strcmp( pars->paramStr(1), "TIME" ) == 0 ) {
      counter = 0; // reset TC4 timer
      #ifdef ACKS_ON
      Serial.println("# PID time reset");
      #endif
      return true;
    }
    else if( strcmp( pars->paramStr(1), "GO" ) == 0 ) {
      #ifdef PID_CONTROL
        counter = 0; // reset TC4 timer
        myPID.SetMode(1); // turn PID on
        #ifdef ACKS_ON
        Serial.println("# PID Roast Start");
        #endif
      #endif
      return true;
    }
    else if( strcmp( pars->paramStr(1), "STOP" ) == 0 ) {
      #ifdef PID_CONTROL
        myPID.SetMode(0); // turn PID off
        levelOT1 = 0;
        output_level_icc( levelOT1 );  // Turn OT1 (heater) off
        levelOT2 = OT2_AUTO_COOL;
        output_level_pac( levelOT2 ); // Set fan to auto cool level
        #ifdef ACKS_ON
        Serial.println("# PID Roast Stop");
        #endif
      #endif
      return true;
    }
    else if( pars->paramStr(1)[0] == 'P' ) {
      #ifdef PID_CONTROL
      profile_number = atoi( pars->paramStr(1) + 1 );
      setProfile();
      #ifdef ACKS_ON
      Serial.print("# Profile number ");
      Serial.print( profile_number );
      Serial.println(" selected");
      #endif
      #endif
      return true;
    }
    else if( strcmp( pars->paramStr(1), "T" ) == 0 ) {
      #ifdef PID_CONTROL
      double kp, ki, kd;
      kp = atof( pars->paramStr(2) );
      ki = atof( pars->paramStr(3) );
      kd = atof( pars->paramStr(4) );
      myPID.SetTunings( kp, ki, kd );
      #ifdef ACKS_ON
      Serial.print("# PID Tunings set.  "); Serial.print("Kp = "); Serial.print(kp); Serial.print(",  Ki = "); Serial.print(ki); Serial.print(",  Kd = "); Serial.println(kd);
      #endif
      #endif
      return true;
    }
  }
  else {
    return false;
  }
}
Esempio n. 8
0
void CIP::unpack() {

    quint8 byte;
    int b = 0;
    quint8 size;
    QByteArray tmpArray;
    QString cipString;

    // Header: request (1)
    byte = packet.at(b++);
    setRequest(byte);

    // Header: profile (1)
    byte = packet.at(b++);
    setProfile(byte);

    // Header: verion (1)
    byte = packet.at(b++);
    setVersion(byte);

    // Header: channel (1)
    byte = packet.at(b++);
    setChannel(byte);

    // Header: UUID (16)
    tmpArray = packet.mid(b, 16);
    b += 16;
    ciHead.setUuid(QUuid::fromRfc4122(tmpArray));

    // Header: IP address (4)
    tmpArray.clear();
    tmpArray = packet.mid(b, 4);
    b += 4;
    in_addr ip;
    memcpy(&ip, tmpArray, 4);

    setIpAddress(QHostAddress(inet_ntoa(ip)));

    // Header: IP port (2)
    tmpArray.clear();
    tmpArray = packet.mid(b, 2);
    b += 2;
    ciHead.setIpPort((tmpArray.at(0)<<8) + tmpArray.at(1));


    // Header: time (8)
    tmpArray.clear();
    tmpArray = packet.mid(b, 8);
    b += 8;
    time_t unixTime;
    memcpy(&unixTime, tmpArray, 8);

    ciHead.getTime().setTime_t((uint) unixTime);

    // Header: type (1)
    byte = packet.at(b++);
    ciHead.setHeadDataType(byte);

    // Header: size (1)
    byte = packet.at(b++);
    ciHead.setHeadDataSize(byte);
    size = byte;

    // Header: additional data (size)
    tmpArray.clear();
    tmpArray = packet.mid(b, size);
    b += size;
    ciHead.setHeadData(tmpArray);

    // CI: type (1)
    byte = packet.at(b++);
    setCiType(byte);

    // CI root-CIC (2)
    byte = packet.at(b++);
    quint8 content = byte;
    byte = packet.at(b++);
    ci.setRootCicContent(content);
    ci.setRootCicMask(byte);

    // CI: size (1)
    byte = packet.at(b++);
    setCiSize(byte);
    size = byte;

    // CI: additional data (size)
    tmpArray.clear();
    tmpArray = packet.mid(b, size*2);
    b += size*2;
    ci.setCiBricks(tmpArray);

    // Application Data: type (1)
    byte = packet.at(b++);
    ciData.setAppDataType(byte);

    // Application Data: size (1)
    byte = packet.at(b++);
    ciData.setAppDataSize(byte);
    size = byte;

    // Application Data: additional data (size)
    tmpArray.clear();
    tmpArray = packet.mid(b, size);
    b += size;
    ciData.setAppData(tmpArray);
} //
 unsigned_quantifier_validater() {setProfile();}
 strict_weak_order_validater() {setProfile();}
Esempio n. 11
0
int main( int argc, char **argv ) {
	mpconfig	*control;
	char *path;
	FILE *pidlog=NULL;
	struct timeval tv;

	control=readConfig( );
	if( control == NULL ) {
		printf( "music directory needs to be set.\n" );
		printf( "It will be set up now\n" );
		path=(char *)falloc( MAXPATHLEN+1, 1 );
		while( 1 ) {
			printf( "Default music directory:" );
			fflush( stdout );
			memset( path, 0, MAXPATHLEN );
			fgets(path, MAXPATHLEN, stdin );
			path[strlen( path )-1]=0; /* cut off CR */
			abspath( path, getenv( "HOME" ), MAXPATHLEN );

			if( isDir( path ) ) {
				break;
			}
			else {
				printf( "%s is not a directory!\n", path );
			}
		}

		writeConfig( path );
		free( path );
		control=readConfig();
		if( control == NULL ) {
			printf( "Could not create config file!\n" );
			return 1;
		}
	}
	muteVerbosity();

	/* improve 'randomization' */
	gettimeofday( &tv,NULL );
	srand( (getpid()*tv.tv_usec)%RAND_MAX );

	switch( getArgs( argc, argv ) ) {
	case 0: /* no arguments given */
		break;

	case 1: /* stream - does this even make sense? */
		break;

	case 2: /* single file */
		break;

	case 3: /* directory */
		/* if no default directory is set, use the one given */
		if( control->musicdir == NULL ) {
			incDebug();
			addMessage( 0, "Setting default configuration values and initializing..." );
			setProfile( control );
			if( control->root == NULL ) {
				addMessage( 0, "No music found at %s!", control->musicdir );
				return -1;
			}
			addMessage( 0, "Initialization successful!" );
			writeConfig( argv[optind] );
			freeConfig( );
			return 0;
		}
		break;
	case 4: /* playlist */
		break;
	default:
		addMessage( 0, "Unknown argument!\n", argv[optind] );
		return -1;
	}

	snprintf( control->pidpath, MAXPATHLEN, "%s/.mixplay/mixplayd.pid", getenv("HOME") );
	if( access( control->pidpath, F_OK ) == 0 ) {
		addMessage( 0, "Mixplayd is already running!" );
		freeConfig();
		return -1;
	}

	signal(SIGINT, sigint );
	signal(SIGTERM, sigint );

	/* daemonization must happen before childs are created otherwise the pipes are cut */
	if( getDebug() == 0 ) {
		daemon( 0, 1 );
		openlog ("mixplayd", LOG_PID, LOG_DAEMON);
		control->isDaemon=1;
		pidlog=fopen( control->pidpath, "w");
		if( pidlog == NULL ) {
			addMessage( 0, "Cannot open %s!", control->pidpath );
			return -1;
		}
		fprintf( pidlog, "%i", getpid() );
		fclose(pidlog);
	}

	addUpdateHook( &s_updateHook );

	control->inUI=1;
	initAll( );
	#ifdef EPAPER
	sleep(1);
	if( control->status != mpc_quit ) {
		epSetup();
		addUpdateHook( &ep_updateHook );
	}
	#endif
	pthread_join( control->stid, NULL );
	pthread_join( control->rtid, NULL );
	control->inUI=0;
#ifdef EPAPER
	epExit();
#endif
	if( control->changed ) {
		writeConfig( NULL );
	}
	unlink(control->pidpath);
	addMessage( 0, "Daemon terminated" );
	freeConfig( );

	return 0;
}
void doProfilePlain()
{
	setProfile(_T("plain"), g_fiProfilePlain);
}
void doProfileHtml()
{
	setProfile(_T("html"), g_fiProfileHtml);
}
Esempio n. 14
0
    void shouldDetermineCompatibility_data()
    {
        QTest::addColumn<QSharedPointer<Qt3DRender::QGraphicsApiFilter>>("required");
        QTest::addColumn<QSharedPointer<Qt3DRender::QGraphicsApiFilter>>("actual");
        QTest::addColumn<bool>("expected");

        auto required = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        required->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        required->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
        required->setMajorVersion(4);
        required->setMinorVersion(5);
        auto actual = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        actual->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        actual->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
        actual->setMajorVersion(4);
        actual->setMinorVersion(5);
        bool expected = true;
        QTest::newRow("exact_match") << required << actual << expected;

        required = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        required->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        required->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
        required->setMajorVersion(3);
        required->setMinorVersion(2);
        actual = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        actual->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        actual->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
        actual->setMajorVersion(4);
        actual->setMinorVersion(5);
        expected = true;
        QTest::newRow("actual_is_higher_version") << required << actual << expected;

        required = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        required->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        required->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
        required->setMajorVersion(4);
        required->setMinorVersion(5);
        actual = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        actual->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        actual->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
        actual->setMajorVersion(3);
        actual->setMinorVersion(2);
        expected = false;
        QTest::newRow("actual_is_lower_version") << required << actual << expected;

        required = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        required->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        required->setProfile(Qt3DRender::QGraphicsApiFilter::CompatibilityProfile);
        required->setMajorVersion(4);
        required->setMinorVersion(5);
        actual = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        actual->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        actual->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
        actual->setMajorVersion(4);
        actual->setMinorVersion(5);
        expected = false;
        QTest::newRow("wrong_profile") << required << actual << expected;

        required = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        required->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        required->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
        required->setMajorVersion(3);
        required->setMinorVersion(2);
        actual = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        actual->setApi(Qt3DRender::QGraphicsApiFilter::OpenGLES);
        actual->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
        actual->setMajorVersion(3);
        actual->setMinorVersion(2);
        expected = false;
        QTest::newRow("wrong_api") << required << actual << expected;

        required = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        required->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        required->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
        required->setMajorVersion(2);
        required->setMinorVersion(0);
        actual = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        actual->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        actual->setProfile(Qt3DRender::QGraphicsApiFilter::CompatibilityProfile);
        actual->setMajorVersion(3);
        actual->setMinorVersion(2);
        expected = true;
        QTest::newRow("gl_3_2_compatibility_can_use_gl_2_0") << required << actual << expected;

        required = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        required->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        required->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
        required->setMajorVersion(2);
        required->setMinorVersion(0);
        actual = QSharedPointer<Qt3DRender::QGraphicsApiFilter>::create();
        actual->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
        actual->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
        actual->setMajorVersion(3);
        actual->setMinorVersion(2);
        expected = false;
        QTest::newRow("gl_3_2_core_cant_use_gl_2_0") << required << actual << expected;
    }
Esempio n. 15
0
void LearningProgressModel::profileDestroyed()
{
    setProfile(0);
}
Esempio n. 16
0
// Default settings
STATIC_UNIT_TESTED void resetConf(void)
{
    pgResetAll(MAX_PROFILE_COUNT);

    setProfile(0);
    pgActivateProfile(0);

    setControlRateProfile(0);

    parseRcChannels("AETR1234", rxConfig());

    featureClearAll();

    featureSet(DEFAULT_RX_FEATURE | FEATURE_FAILSAFE | FEATURE_BLACKBOX);
#ifdef DEFAULT_FEATURES
    featureSet(DEFAULT_FEATURES);
#endif

#ifdef BOARD_HAS_VOLTAGE_DIVIDER
    // only enable the feature by default if the board has supporting hardware
    featureSet(FEATURE_VBAT);
#endif

#ifdef BOARD_HAS_AMPERAGE_METER
    // only enable the feature by default if the board has supporting hardware
    featureSet(FEATURE_AMPERAGE_METER);
    batteryConfig()->amperageMeterSource = AMPERAGE_METER_ADC;
#endif

    // alternative defaults settings for ALIENFLIGHTF1 and ALIENFLIGHTF3 targets
#ifdef ALIENFLIGHT
#ifdef ALIENFLIGHTF3
    serialConfig()->portConfigs[2].functionMask = FUNCTION_RX_SERIAL;
    getVoltageMeterConfig(ADC_BATTERY)->vbatscale = 20;
    sensorSelectionConfig()->mag_hardware = MAG_NONE;            // disabled by default
# else
    serialConfig()->portConfigs[1].functionMask = FUNCTION_RX_SERIAL;
# endif
    rxConfig()->serialrx_provider = SERIALRX_SPEKTRUM2048;
    rxConfig()->spektrum_sat_bind = 5;
    motorConfig()->minthrottle = 1000;
    motorConfig()->maxthrottle = 2000;
    motorConfig()->motor_pwm_rate = 32000;
    failsafeConfig()->failsafe_delay = 2;
    failsafeConfig()->failsafe_off_delay = 0;
    mixerConfig()->yaw_jump_prevention_limit = YAW_JUMP_PREVENTION_LIMIT_HIGH;
    currentControlRateProfile->rcRate8 = 100;
    currentControlRateProfile->rates[PITCH] = 20;
    currentControlRateProfile->rates[ROLL] = 20;
    currentControlRateProfile->rates[YAW] = 20;
    parseRcChannels("TAER1234", rxConfig());

    *customMotorMixer(0) = (motorMixer_t){ 1.0f, -0.414178f,  1.0f, -1.0f };    // REAR_R
    *customMotorMixer(1) = (motorMixer_t){ 1.0f, -0.414178f, -1.0f,  1.0f };    // FRONT_R
    *customMotorMixer(2) = (motorMixer_t){ 1.0f,  0.414178f,  1.0f,  1.0f };    // REAR_L
    *customMotorMixer(3) = (motorMixer_t){ 1.0f,  0.414178f, -1.0f, -1.0f };    // FRONT_L
    *customMotorMixer(4) = (motorMixer_t){ 1.0f, -1.0f, -0.414178f, -1.0f };    // MIDFRONT_R
    *customMotorMixer(5) = (motorMixer_t){ 1.0f,  1.0f, -0.414178f,  1.0f };    // MIDFRONT_L
    *customMotorMixer(6) = (motorMixer_t){ 1.0f, -1.0f,  0.414178f,  1.0f };    // MIDREAR_R
    *customMotorMixer(7) = (motorMixer_t){ 1.0f,  1.0f,  0.414178f, -1.0f };    // MIDREAR_L
#endif

    // copy first profile into remaining profile
    PG_FOREACH_PROFILE(reg) {
        for (int i = 1; i < MAX_PROFILE_COUNT; i++) {
            memcpy(reg->address + i * pgSize(reg), reg->address, pgSize(reg));
        }
    }
    for (int i = 1; i < MAX_PROFILE_COUNT; i++) {
        configureRateProfileSelection(i, i % MAX_CONTROL_RATE_PROFILE_COUNT);
    }
}
Esempio n. 17
0
void changeProfile(uint8_t profileIndex)
{
    setProfile(profileIndex);
    writeEEPROM();
    readEEPROM();
}
Esempio n. 18
0
// Default settings
STATIC_UNIT_TESTED void resetConf(void)
{
    pgResetAll(MAX_PROFILE_COUNT);

    setProfile(0);
    pgActivateProfile(0);

    setControlRateProfile(0);

    featureClearAll();

    featureSet(DEFAULT_RX_FEATURE);

#ifdef BOARD_HAS_VOLTAGE_DIVIDER
    // only enable the VBAT feature by default if the board has a voltage divider otherwise
    // the user may see incorrect readings and unexpected issues with pin mappings may occur.
    featureSet(FEATURE_VBAT);
#endif

    featureSet(FEATURE_FAILSAFE);

    parseRcChannels("AETR1234", rxConfig());

    featureSet(FEATURE_BLACKBOX);

#if defined(COLIBRI_RACE)
    // alternative defaults settings for COLIBRI RACE targets
    imuConfig()->looptime = 1000;
    featureSet(FEATURE_ONESHOT125);
    featureSet(FEATURE_LED_STRIP);
#endif

#ifdef SPRACINGF3EVO
    featureSet(FEATURE_TRANSPONDER);
    featureSet(FEATURE_RSSI_ADC);
    featureSet(FEATURE_CURRENT_METER);
    featureSet(FEATURE_TELEMETRY);
#endif

    // alternative defaults settings for ALIENWIIF1 and ALIENWIIF3 targets
#ifdef ALIENWII32
    featureSet(FEATURE_RX_SERIAL);
    featureSet(FEATURE_MOTOR_STOP);
# ifdef ALIENWIIF3
    serialConfig()->portConfigs[2].functionMask = FUNCTION_RX_SERIAL;
    batteryConfig()->vbatscale = 20;
# else
    serialConfig()->portConfigs[1].functionMask = FUNCTION_RX_SERIAL;
# endif
    rxConfig()->serialrx_provider = SERIALRX_SPEKTRUM2048;
    rxConfig()->spektrum_sat_bind = 5;
    motorAndServoConfig()->minthrottle = 1000;
    motorAndServoConfig()->maxthrottle = 2000;
    motorAndServoConfig()->motor_pwm_rate = 32000;
    imuConfig()->looptime = 2000;
    pidProfile()->pidController = 3;
    pidProfile()->P8[PIDROLL] = 36;
    pidProfile()->P8[PIDPITCH] = 36;
    failsafeConfig()->failsafe_delay = 2;
    failsafeConfig()->failsafe_off_delay = 0;
    currentControlRateProfile->rcRate8 = 130;
    currentControlRateProfile->rates[ROLL] = 20;
    currentControlRateProfile->rates[PITCH] = 20;
    currentControlRateProfile->rates[YAW] = 100;
    parseRcChannels("TAER1234", rxConfig());
    *customMotorMixer(0) = (motorMixer_t){ 1.0f, -0.414178f,  1.0f, -1.0f };    // REAR_R
    *customMotorMixer(1) = (motorMixer_t){ 1.0f, -0.414178f, -1.0f,  1.0f };    // FRONT_R
    *customMotorMixer(2) = (motorMixer_t){ 1.0f,  0.414178f,  1.0f,  1.0f };    // REAR_L
    *customMotorMixer(3) = (motorMixer_t){ 1.0f,  0.414178f, -1.0f, -1.0f };    // FRONT_L
    *customMotorMixer(4) = (motorMixer_t){ 1.0f, -1.0f, -0.414178f, -1.0f };    // MIDFRONT_R
    *customMotorMixer(5) = (motorMixer_t){ 1.0f,  1.0f, -0.414178f,  1.0f };    // MIDFRONT_L
    *customMotorMixer(6) = (motorMixer_t){ 1.0f, -1.0f,  0.414178f,  1.0f };    // MIDREAR_R
    *customMotorMixer(7) = (motorMixer_t){ 1.0f,  1.0f,  0.414178f, -1.0f };    // MIDREAR_L
#endif

    // copy first profile into remaining profile
    PG_FOREACH_PROFILE(reg) {
        for (int i = 1; i < MAX_PROFILE_COUNT; i++) {
            memcpy(reg->address + i * pgSize(reg), reg->address, pgSize(reg));
        }
    }
    for (int i = 1; i < MAX_PROFILE_COUNT; i++) {
        configureRateProfileSelection(i, i % MAX_CONTROL_RATE_PROFILE_COUNT);
    }
}
void doProfileXml()
{
	setProfile(_T("xml"), g_fiProfileXml);
}
Esempio n. 20
0
void Stage::setProfile(int score, int times, bool u, bool h, std::deque<std::string> required) {
	setProfile(score, times, u, h);
	requiredSongs = required;
}
extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode)
{

	switch(notifyCode->nmhdr.code)
	{
		case NPPN_READY:
			{
				ShortcutKey key;
				::SendMessage(nppData._nppHandle, NPPM_GETSHORTCUTBYCMDID, funcItem[0]._cmdID, reinterpret_cast<LPARAM>(&key));
				g_expandIsTab = keyIsTab(key);	
				loadSettings();
				// Lazy initialisation, so don't call initialise() yet
				//initialise();
			}
			break;

		case NPPN_SHORTCUTREMAPPED:
			if (funcItem[0]._cmdID == notifyCode->nmhdr.idFrom)
			{
				g_expandIsTab = keyIsTab(*reinterpret_cast<ShortcutKey*>(notifyCode->nmhdr.hwndFrom));
			}
			break;

		case NPPN_BUFFERACTIVATED:
		case NPPN_LANGCHANGED:
			if (g_autoSelectProfile)
			{
				int lang = ::SendMessage(nppData._nppHandle, NPPM_GETBUFFERLANGTYPE, notifyCode->nmhdr.idFrom, 0);
				switch(lang)
				{
					case L_XML:
						setProfile(_T("xml"), g_fiProfileXml);
						break;

					case L_TXT:
						setProfile(_T("plain"), g_fiProfilePlain);
						break;

					case L_HTML:
					default:
						setProfile(_T("xhtml"), g_fiProfileXhtml);
						break;
				}
			}
			break;
		case NPPN_FILESAVED:
			if (g_watchSave)
			{
				TCHAR filename[MAX_PATH];
				::SendMessage(nppData._nppHandle, NPPM_GETFULLPATHFROMBUFFERID, notifyCode->nmhdr.idFrom, reinterpret_cast<LPARAM>(filename));
				if (0 == _tcsicmp(filename, g_settingsFile))
				{
					if (g_initialised)
					{
						runString(_T("npp_zen_coding.update_settings()"));
						::MessageBox(nppData._nppHandle, _T("Zen Coding settings automatically refreshed"), _T("Zen Coding for Notepad++"), MB_ICONINFORMATION);
					}
					else
					{
						::MessageBox(nppData._nppHandle, _T("New Zen Coding settings have been applied"), _T("Zen Coding for Notepad++"), MB_ICONINFORMATION);
					}
				}
			}
			break;
	}

	
}
Esempio n. 22
0
// Default settings
static void resetConf(void)
{
    int i;
#ifdef USE_SERVOS
    int8_t servoRates[MAX_SUPPORTED_SERVOS] = { 30, 30, 100, 100, 100, 100, 100, 100 };
    ;
#endif

    // Clear all configuration
    memset(&masterConfig, 0, sizeof(master_t));
    setProfile(0);
    setControlRateProfile(0);

    masterConfig.version = EEPROM_CONF_VERSION;
    masterConfig.mixerMode = MIXER_QUADX;
    featureClearAll();
#if defined(CJMCU) || defined(SPARKY)
    featureSet(FEATURE_RX_PPM);
#endif

#ifdef BOARD_HAS_VOLTAGE_DIVIDER
    // only enable the VBAT feature by default if the board has a voltage divider otherwise
    // the user may see incorrect readings and unexpected issues with pin mappings may occur.
    featureSet(FEATURE_VBAT);
#endif

    featureSet(FEATURE_FAILSAFE);

    // global settings
    masterConfig.current_profile_index = 0;     // default profile
    masterConfig.gyro_cmpf_factor = 600;        // default MWC
    masterConfig.gyro_cmpfm_factor = 250;       // default MWC
    masterConfig.gyro_lpf = 42;                 // supported by all gyro drivers now. In case of ST gyro, will default to 32Hz instead

    resetAccelerometerTrims(&masterConfig.accZero);

    resetSensorAlignment(&masterConfig.sensorAlignmentConfig);

    masterConfig.boardAlignment.rollDegrees = 0;
    masterConfig.boardAlignment.pitchDegrees = 0;
    masterConfig.boardAlignment.yawDegrees = 0;
    masterConfig.acc_hardware = ACC_DEFAULT;     // default/autodetect
    masterConfig.max_angle_inclination = 500;    // 50 degrees
    masterConfig.yaw_control_direction = 1;
    masterConfig.gyroConfig.gyroMovementCalibrationThreshold = 32;

    masterConfig.mag_hardware = MAG_DEFAULT;     // default/autodetect

    resetBatteryConfig(&masterConfig.batteryConfig);

    resetTelemetryConfig(&masterConfig.telemetryConfig);

    masterConfig.rxConfig.serialrx_provider = 0;
    masterConfig.rxConfig.spektrum_sat_bind = 0;
    masterConfig.rxConfig.midrc = 1500;
    masterConfig.rxConfig.mincheck = 1100;
    masterConfig.rxConfig.maxcheck = 1900;
    masterConfig.rxConfig.rx_min_usec = 985;          // any of first 4 channels below this value will trigger rx loss detection
    masterConfig.rxConfig.rx_max_usec = 2115;         // any of first 4 channels above this value will trigger rx loss detection

    masterConfig.rxConfig.rssi_channel = 0;
    masterConfig.rxConfig.rssi_scale = RSSI_SCALE_DEFAULT;

    masterConfig.inputFilteringMode = INPUT_FILTERING_DISABLED;

    masterConfig.retarded_arm = 0;
    masterConfig.disarm_kill_switch = 1;
    masterConfig.auto_disarm_delay = 5;
    masterConfig.small_angle = 25;

    resetMixerConfig(&masterConfig.mixerConfig);

    masterConfig.airplaneConfig.flaps_speed = 0;
    masterConfig.airplaneConfig.fixedwing_althold_dir = 1;

    // Motor/ESC/Servo
    resetEscAndServoConfig(&masterConfig.escAndServoConfig);
    resetFlight3DConfig(&masterConfig.flight3DConfig);

#ifdef BRUSHED_MOTORS
    masterConfig.motor_pwm_rate = BRUSHED_MOTORS_PWM_RATE;
#else
    masterConfig.motor_pwm_rate = BRUSHLESS_MOTORS_PWM_RATE;
#endif
    masterConfig.servo_pwm_rate = 50;

#ifdef GPS
    // gps/nav stuff
    masterConfig.gpsConfig.provider = GPS_NMEA;
    masterConfig.gpsConfig.sbasMode = SBAS_AUTO;
    masterConfig.gpsConfig.autoConfig = GPS_AUTOCONFIG_ON;
    masterConfig.gpsConfig.autoBaud = GPS_AUTOBAUD_OFF;
#endif

    resetSerialConfig(&masterConfig.serialConfig);

    masterConfig.looptime = 3500;
    masterConfig.emf_avoidance = 0;

    resetPidProfile(&currentProfile->pidProfile);

    resetControlRateConfig(&masterConfig.controlRateProfiles[0]);

    // for (i = 0; i < CHECKBOXITEMS; i++)
    //     cfg.activate[i] = 0;

    resetRollAndPitchTrims(&currentProfile->accelerometerTrims);

    currentProfile->mag_declination = 0;
    currentProfile->acc_lpf_factor = 4;
    currentProfile->accz_lpf_cutoff = 5.0f;
    currentProfile->accDeadband.xy = 40;
    currentProfile->accDeadband.z = 40;

    resetBarometerConfig(&currentProfile->barometerConfig);

    currentProfile->acc_unarmedcal = 1;

    // Radio
    parseRcChannels("AETR1234", &masterConfig.rxConfig);

    resetRcControlsConfig(&currentProfile->rcControlsConfig);

    currentProfile->throttle_correction_value = 0;      // could 10 with althold or 40 for fpv
    currentProfile->throttle_correction_angle = 800;    // could be 80.0 deg with atlhold or 45.0 for fpv

    // Failsafe Variables
    masterConfig.failsafeConfig.failsafe_delay = 10;              // 1sec
    masterConfig.failsafeConfig.failsafe_off_delay = 200;         // 20sec
    masterConfig.failsafeConfig.failsafe_throttle = 1000;         // default throttle off.

#ifdef USE_SERVOS
    // servos
    for (i = 0; i < MAX_SUPPORTED_SERVOS; i++) {
        currentProfile->servoConf[i].min = DEFAULT_SERVO_MIN;
        currentProfile->servoConf[i].max = DEFAULT_SERVO_MAX;
        currentProfile->servoConf[i].middle = DEFAULT_SERVO_MIDDLE;
        currentProfile->servoConf[i].rate = servoRates[i];
        currentProfile->servoConf[i].forwardFromChannel = CHANNEL_FORWARDING_DISABLED;
    }

    // gimbal
    currentProfile->gimbalConfig.gimbal_flags = GIMBAL_NORMAL;
#endif

#ifdef GPS
    resetGpsProfile(&currentProfile->gpsProfile);
#endif

    // custom mixer. clear by defaults.
    for (i = 0; i < MAX_SUPPORTED_MOTORS; i++)
        masterConfig.customMixer[i].throttle = 0.0f;

#ifdef LED_STRIP
    applyDefaultColors(masterConfig.colors, CONFIGURABLE_COLOR_COUNT);
    applyDefaultLedStripConfig(masterConfig.ledConfigs);
#endif

#ifdef BLACKBOX
#ifdef SPRACINGF3
    featureSet(FEATURE_BLACKBOX);
    masterConfig.blackbox_device = 1;
#else
    masterConfig.blackbox_device = 0;
#endif
    masterConfig.blackbox_rate_num = 1;
    masterConfig.blackbox_rate_denom = 1;
#endif

    // alternative defaults settings for ALIENWIIF1 and ALIENWIIF3 targets
#ifdef ALIENWII32
    featureSet(FEATURE_RX_SERIAL);
    featureSet(FEATURE_MOTOR_STOP);
    featureSet(FEATURE_FAILSAFE);
#ifdef ALIENWIIF3
    masterConfig.serialConfig.portConfigs[2].functionMask = FUNCTION_RX_SERIAL;
    masterConfig.batteryConfig.vbatscale = 20;
#else
    masterConfig.serialConfig.portConfigs[1].functionMask = FUNCTION_RX_SERIAL;
#endif
    masterConfig.rxConfig.serialrx_provider = 1;
    masterConfig.rxConfig.spektrum_sat_bind = 5;
    masterConfig.escAndServoConfig.minthrottle = 1000;
    masterConfig.escAndServoConfig.maxthrottle = 2000;
    masterConfig.motor_pwm_rate = 32000;
    masterConfig.looptime = 2000;
    currentProfile->pidProfile.pidController = 3;
    currentProfile->pidProfile.P8[ROLL] = 36;
    currentProfile->pidProfile.P8[PITCH] = 36;
    masterConfig.failsafeConfig.failsafe_delay = 2;
    masterConfig.failsafeConfig.failsafe_off_delay = 0;
    masterConfig.failsafeConfig.failsafe_throttle = 1000;
    currentControlRateProfile->rcRate8 = 130;
    currentControlRateProfile->rates[FD_PITCH] = 20;
    currentControlRateProfile->rates[FD_ROLL] = 20;
    currentControlRateProfile->rates[FD_YAW] = 100;
    parseRcChannels("TAER1234", &masterConfig.rxConfig);

    //  { 1.0f, -0.5f,  1.0f, -1.0f },          // REAR_R
    masterConfig.customMixer[0].throttle = 1.0f;
    masterConfig.customMixer[0].roll = -0.5f;
    masterConfig.customMixer[0].pitch = 1.0f;
    masterConfig.customMixer[0].yaw = -1.0f;

    //  { 1.0f, -0.5f, -1.0f,  1.0f },          // FRONT_R
    masterConfig.customMixer[1].throttle = 1.0f;
    masterConfig.customMixer[1].roll = -0.5f;
    masterConfig.customMixer[1].pitch = -1.0f;
    masterConfig.customMixer[1].yaw = 1.0f;

    //  { 1.0f,  0.5f,  1.0f,  1.0f },          // REAR_L
    masterConfig.customMixer[2].throttle = 1.0f;
    masterConfig.customMixer[2].roll = 0.5f;
    masterConfig.customMixer[2].pitch = 1.0f;
    masterConfig.customMixer[2].yaw = 1.0f;

    //  { 1.0f,  0.5f, -1.0f, -1.0f },          // FRONT_L
    masterConfig.customMixer[3].throttle = 1.0f;
    masterConfig.customMixer[3].roll = 0.5f;
    masterConfig.customMixer[3].pitch = -1.0f;
    masterConfig.customMixer[3].yaw = -1.0f;

    //  { 1.0f, -1.0f, -0.5f, -1.0f },          // MIDFRONT_R
    masterConfig.customMixer[4].throttle = 1.0f;
    masterConfig.customMixer[4].roll = -1.0f;
    masterConfig.customMixer[4].pitch = -0.5f;
    masterConfig.customMixer[4].yaw = -1.0f;

    //  { 1.0f,  1.0f, -0.5f,  1.0f },          // MIDFRONT_L
    masterConfig.customMixer[5].throttle = 1.0f;
    masterConfig.customMixer[5].roll = 1.0f;
    masterConfig.customMixer[5].pitch = -0.5f;
    masterConfig.customMixer[5].yaw = 1.0f;

    //  { 1.0f, -1.0f,  0.5f,  1.0f },          // MIDREAR_R
    masterConfig.customMixer[6].throttle = 1.0f;
    masterConfig.customMixer[6].roll = -1.0f;
    masterConfig.customMixer[6].pitch = 0.5f;
    masterConfig.customMixer[6].yaw = 1.0f;

    //  { 1.0f,  1.0f,  0.5f, -1.0f },          // MIDREAR_L
    masterConfig.customMixer[7].throttle = 1.0f;
    masterConfig.customMixer[7].roll = 1.0f;
    masterConfig.customMixer[7].pitch = 0.5f;
    masterConfig.customMixer[7].yaw = -1.0f;
#endif

    // copy first profile into remaining profile
    for (i = 1; i < MAX_PROFILE_COUNT; i++) {
        memcpy(&masterConfig.profile[i], currentProfile, sizeof(profile_t));
    }

    // copy first control rate config into remaining profile
    for (i = 1; i < MAX_CONTROL_RATE_PROFILE_COUNT; i++) {
        memcpy(&masterConfig.controlRateProfiles[i], currentControlRateProfile, sizeof(controlRateConfig_t));
    }

    for (i = 1; i < MAX_PROFILE_COUNT; i++) {
        masterConfig.profile[i].defaultRateProfileIndex = i % MAX_CONTROL_RATE_PROFILE_COUNT;
    }
}
Esempio n. 23
0
 itl_set_driver() { setProfile(); }
Esempio n. 24
0
void mlayer(void)
{
   static char command[COMMANDLEN+2];
   static double undoFit[NA], undoFitUnc[NA];

   /* Process command */
      while (queryString("mlayer% ", command, COMMANDLEN + 2) == NULL);
      caps(command);

      /* Spawn a command */
      if (strcmp(command, "!") == 0 || strcmp(command, "!!") == 0) {
         bang(command);

      /* Print current directory */
      } else if (strcmp(command, "PWD") == 0) {
         puts(currentDir);

      /* Change current directory */
      } else if (strcmp(command, "CD") == 0) {
         cd(command);

      /* Help */
      } else if (strcmp(command, "?") == 0
		 || strcmp(command, "HE") == 0
		 || strcmp(command, "HELP") == 0) {
         help(command + (*command == '?' ? 1 : 2));

      /* Value of vacuum QCSQ */
      } else if (strcmp(command, "QCV") == 0 || strcmp(command, "VQC") == 0) {
         setVQCSQ(tqcsq);

      /* Value of vacuum linear absorption coefficient */
      } else if (strcmp(command, "MUV") == 0 || strcmp(command, "VMU") == 0) {
         setVMU(tmu);

      /* Wavelength */
      } else if (strcmp(command, "WL") == 0) {
	 double v = lambda;
         if (setWavelength(&lambda)==0 && lambda != v) {
	   /* May need to recalculate Q for the new wavelength */
	   if (theta_offset != 0. && loaded) loadData(infile); 
	 }

      /* Theta offset */
      } else if (strcmp(command, "TO") == 0) {
	 double v = theta_offset;
	 if (setThetaoffset(&theta_offset)==0 && theta_offset != v) {
	   /* May need to recalculate Q for the new theta offset */
	   if (loaded) loadData(infile); 
	 }

      /* Number of layers */
      } else if (
         strcmp(command, "NTL") == 0 ||
         strcmp(command, "NML") == 0 ||
         strcmp(command, "NBL") == 0
      ) switch (command[1]) {
         case 'T':
            setNLayer(&ntlayer);
            break;
         case 'M':
            setNLayer(&nmlayer);
            break;
         case 'B':
            setNLayer(&nblayer);
            break;

      /* Add or remove layers */
      } else if (
         strcmp(command, "ATL") == 0 ||
         strcmp(command, "AML") == 0 ||
         strcmp(command, "ABL") == 0 ||
         strcmp(command, "RTL") == 0 ||
         strcmp(command, "RML") == 0 ||
         strcmp(command, "RBL") == 0
      ) {
         modifyLayers(command);

      /* Copy layer */
      } else if (strcmp(command, "CL") == 0) {
         copyLayer(command);

      /* Maximum number of layers used to simulate rough interface */
      } else if (
         strcmp(command, "NR") == 0 &&
         !setNRough(&nrough)
      ) {
         /* Generate interface profile */
         if (nrough < 3) nrough = 11;
         if (*proftyp == 'H')
            gentanh(nrough, zint, rufint);
         else
            generf(nrough, zint, rufint);

      /* Specify error function or hyperbolic tangent profile */
      } else if (strcmp(command, "PR") == 0) {
         setProfile(proftyp, PROFTYPLEN + 2);

      /* Number of layers in multilayer */
      } else if (strcmp(command, "NMR") == 0) {
         setNrepeat(&nrepeat);

      /* Range of Q to be scanned */
      } else if (strcmp(command, "QL") == 0) {
         setQrange(&qmin, &qmax);

      /* Number of points scanned */
      } else if (strcmp(command, "NP") == 0) {
         setNpnts();

      /* File for input data */
      } else if (strcmp(command, "IF") == 0) {
         setFilename(infile, INFILELEN + 2);

      /* File for output data */
      } else if (strcmp(command, "OF") == 0) {
         setFilename(outfile, OUTFILELEN + 2);

      /* File for parameters */
      } else if (strcmp(command, "PF") == 0) {
         setFilename(parfile, PARFILELEN + 2);

      /* Delta lambda */
      } else if (strcmp(command, "DL") == 0) {
         setLamdel(&lamdel);

      /* Delta theta */
      } else if (strcmp(command, "DT") == 0) {
         setThedel(&thedel);

      /* Beam intensity */
      } else if (strcmp(command, "BI") == 0) {
         setBeamIntens(&bmintns, &Dbmintns);

      /* Background intensity */
      } else if (strcmp(command, "BK") == 0) {
         setBackground(&bki, &Dbki);

      /* Verify parameters by printing out */
      } else if (
         strncmp(command, "TVE", 3) == 0 ||
         strncmp(command, "MVE", 3) == 0 ||
         strncmp(command, "BVE", 3) == 0 ||
         strncmp(command, "VE", 2) == 0
      ) {
         printLayers(command);

      /* Get data from file */
      } else if (strcmp(command, "GD") == 0) {
         loadData(infile);

      /* Edit constraints */
      } else if (strcmp(command, "EC") == 0) {
         constrainFunc newmodule;

         newmodule = newConstraints(constrainScript, constrainModule);
         if (newmodule != NULL) Constrain = newmodule;

      /* Reload constrain module */
      } else if (strcmp(command, "LC") == 0) {
         Constrain = loadConstrain(constrainModule);

      /* Unload constrain module */
      } else if (strcmp(command, "ULC") == 0) {
         Constrain = loadConstrain(NULL);

      /* Load parameters from parameter file */
      } else if (strncmp(command, "LP", 2) == 0) {
         loadParms(command, &npnts, parfile, constrainScript, constrainModule);

      /* Save parameters to parameter file */
      } else if (strcmp(command, "SP") == 0) {
         parms(tqcsq, mqcsq, bqcsq, tqcmsq, mqcmsq, bqcmsq, td, md, bd,
               trough, mrough, brough, tmu, mmu, bmu,
               MAXLAY, &lambda, &lamdel, &thedel, &theta_offset,
               &ntlayer, &nmlayer, &nblayer, &nrepeat, &qmin, &qmax, &npnts,
               infile, outfile,
               &bmintns, &bki, listA, &mfit, NA, &nrough, proftyp,
               DA, constrainScript, parfile, TRUE);

      /* List data and fit */
      } else if (strcmp(command, "LID") == 0) {
         listData();

      /* Generate logarithm of bare (unconvoluted) reflectivity */
      } else if (strcmp(command, "GR") == 0 || strcmp(command, "SA") == 0) {
         genReflect(command);

      /* Generate and display layer profile used for roughness */
      } else if (strcmp(command, "GLP") == 0) {
         genProfile();

      /* Save layer profile to OUTFILE */
      } else if (
         strcmp(command, "SLP") == 0 ||
         strcmp(command, "SSP") == 0
      ) {
         saveProfile(command);

      /* Save values in XTEMP and YTEMP to OUTFILE */
      } else if (strcmp(command, "SV") == 0) {
         saveTemps(outfile);

      /* Calculate derivative of reflectivity or spin asymmetry with respect
         to a fit parameter or save a fit to disk file */
      } else if (
         strcmp(command, "RD") == 0 ||
         strcmp(command, "RSD") == 0 ||
         strcmp(command, "SRF") == 0 ||
         strcmp(command, "SRSF") == 0
      ) {
         printDerivs(command);

      /* Turn off all varied parameters */
      } else if (strcmp(command, "VANONE") == 0) {
         clearLista(listA);

      /* Specify which parameters are to be varied in the reflectivity fit */
      } else if (strncmp(command, "VA", 2) == 0) {
         varyParm(command);

      /* Calculate chi-squared */
      } else if (strcmp(command, "CSR") == 0 || strcmp(command, "CSRS") == 0) {
         printChiSq(command);

      /* Fit five-layer reflectivity */
      } else if (strncmp(command, "FR", 2) == 0) {
         register int n;

         for (n = 0; n < NA; n++) {
            undoFit[n] = A[n];
            undoFitUnc[n] = DA[n];
         }
         fitReflec(command);

      /* Undo last fit */
      } else if (strcmp(command, "UF") == 0) {
         register int n;

         for (n = 0; n < NA; n++) {
            A[n] = undoFit[n];
            DA[n] = undoFitUnc[n];
         }

      /* Exit */
      } else if (strcmp(command, "EX") == 0) {
         parms(tqcsq, mqcsq, bqcsq, tqcmsq, mqcmsq, bqcmsq, td, md, bd,
               trough, mrough, brough, tmu, mmu, bmu,
               MAXLAY, &lambda, &lamdel, &thedel, &theta_offset,
               &ntlayer, &nmlayer, &nblayer, &nrepeat, &qmin, &qmax, &npnts,
               infile, outfile,
               &bmintns, &bki, listA, &mfit, NA, &nrough, proftyp,
               DA, constrainScript, parfile, TRUE);
         exit(0);

      /* Exit without saving changes */
      } else if (strcmp(command, "QU") == 0 || strcmp(command, "QUIT") == 0) {
         exit(0);

      /***** Start new ************** */

      /* Plot reflectivity on screen */
      } else if (strncmp(command, "PRF", 3) == 0) {
         plotfit(command);

      /* Plot profile on screen */
      } else if (strcmp(command, "PLP") == 0) {
      /* Generate profile */
         plotprofile(command);

      /* Send data to other processes. */
      } else if (strcmp(command, "SEND") == 0) {
	ipc_send(command);

      /* Receive data to other processes. */
      } else if (strcmp(command, "RECV") == 0) {
	ipc_recv(command);

      /* Plot movie of reflectivity change from fit */
      } else if (strncmp(command, "MVF", 3) == 0) {
         fitMovie(command, undoFit);

      /* Plot general movie from data file on screen */
      } else if (strncmp(command, "MVX", 3) == 0) {
         arbitraryMovie(command);

      /* Plot movie of parameter on screen */
      } else if (strncmp(command, "MV", 2) == 0) {
         oneParmMovie(command);

      /* Update constraints */
      } else if (strcmp(command, "UC") == 0) {
         genshift(a, TRUE);
         /* constrain(a); */
         (*Constrain)(FALSE, a, ntlayer, nmlayer, nrepeat, nblayer);
         genshift(a, FALSE);

      /* Enter critical Q squared */
      /* or */
      /* Top length absorption coefficient */
      /* or */
      /* Thicknesses of top layers */
      /* or */
      /* Roughnesses of top layers */

      } else {
         static char *paramcom[] = {"QC", "MU", "D", "RO"};
         static double  *top[] = { tqcsq,  tmu,  td,  trough};
         static double  *mid[] = { mqcsq,  mmu,  md,  mrough};
         static double  *bot[] = { bqcsq,  bmu,  bd,  brough};
         static double *Dtop[] = {Dtqcsq, Dtmu, Dtd, Dtrough};
         static double *Dmid[] = {Dmqcsq, Dmmu, Dmd, Dmrough};
         static double *Dbot[] = {Dbqcsq, Dbmu, Dbd, Dbrough};
         static int (*store[])(int, double *, double *) = {
            setQCSQ, setMU, setD, setRO
         };
         int param, code = -1;

         for (param = 0; param < sizeof(paramcom) / sizeof(paramcom[0]); param++) {
            code = fetchLayParam(command, paramcom[param], top[param],
               mid[param], bot[param], Dtop[param], Dmid[param], Dbot[param],
               store[param]);
            if (code > -1) break;
         }
         if (code == -1)
            ERROR("/** Unrecognized command: %s **/\n", command);
      }
}
Esempio n. 25
0
// Default settings
static void resetConf(void)
{
    int i;

    // Clear all configuration
    memset(&masterConfig, 0, sizeof(master_t));
    setProfile(0);
    setControlRateProfile(0);

    masterConfig.version = EEPROM_CONF_VERSION;
    masterConfig.mixerMode = MIXER_QUADX;
    featureClearAll();
    persistentFlagClearAll();
    featureSet(DEFAULT_RX_FEATURE | FEATURE_FAILSAFE);
#ifdef DEFAULT_FEATURES
    featureSet(DEFAULT_FEATURES);
#endif

#ifdef BOARD_HAS_VOLTAGE_DIVIDER
    // only enable the VBAT feature by default if the board has a voltage divider otherwise
    // the user may see incorrect readings and unexpected issues with pin mappings may occur.
    featureSet(FEATURE_VBAT);
#endif

    // global settings
    masterConfig.current_profile_index = 0;     // default profile
    masterConfig.dcm_kp_acc = 2500;             // 0.25 * 10000
    masterConfig.dcm_ki_acc = 50;               // 0.005 * 10000
    masterConfig.dcm_kp_mag = 10000;            // 1.00 * 10000
    masterConfig.dcm_ki_mag = 0;                // 0.00 * 10000
    masterConfig.gyro_lpf = 3;                  // INV_FILTER_42HZ, In case of ST gyro, will default to 32Hz instead

    resetAccelerometerTrims(&masterConfig.accZero, &masterConfig.accGain);

    resetSensorAlignment(&masterConfig.sensorAlignmentConfig);

    masterConfig.boardAlignment.rollDeciDegrees = 0;
    masterConfig.boardAlignment.pitchDeciDegrees = 0;
    masterConfig.boardAlignment.yawDeciDegrees = 0;
    masterConfig.acc_hardware = ACC_DEFAULT;     // default/autodetect
    masterConfig.gyroConfig.gyroMovementCalibrationThreshold = 32;

    masterConfig.mag_hardware = MAG_DEFAULT;     // default/autodetect
    masterConfig.baro_hardware = BARO_DEFAULT;   // default/autodetect

    resetBatteryConfig(&masterConfig.batteryConfig);

    resetTelemetryConfig(&masterConfig.telemetryConfig);

    masterConfig.rxConfig.serialrx_provider = 0;
    masterConfig.rxConfig.spektrum_sat_bind = 0;
    masterConfig.rxConfig.midrc = 1500;
    masterConfig.rxConfig.mincheck = 1100;
    masterConfig.rxConfig.maxcheck = 1900;
    masterConfig.rxConfig.rx_min_usec = 885;          // any of first 4 channels below this value will trigger rx loss detection
    masterConfig.rxConfig.rx_max_usec = 2115;         // any of first 4 channels above this value will trigger rx loss detection

    for (i = 0; i < MAX_SUPPORTED_RC_CHANNEL_COUNT; i++) {
        rxFailsafeChannelConfiguration_t *channelFailsafeConfiguration = &masterConfig.rxConfig.failsafe_channel_configurations[i];
        channelFailsafeConfiguration->mode = (i < NON_AUX_CHANNEL_COUNT) ? RX_FAILSAFE_MODE_AUTO : RX_FAILSAFE_MODE_HOLD;
        channelFailsafeConfiguration->step = (i == THROTTLE) ? CHANNEL_VALUE_TO_RXFAIL_STEP(masterConfig.rxConfig.rx_min_usec) : CHANNEL_VALUE_TO_RXFAIL_STEP(masterConfig.rxConfig.midrc);
    }

    masterConfig.rxConfig.rssi_channel = 0;
    masterConfig.rxConfig.rssi_scale = RSSI_SCALE_DEFAULT;
    masterConfig.rxConfig.rssi_ppm_invert = 0;
    masterConfig.rxConfig.rcSmoothing = 1;

    resetAllRxChannelRangeConfigurations(masterConfig.rxConfig.channelRanges);

    masterConfig.inputFilteringMode = INPUT_FILTERING_DISABLED;

    masterConfig.disarm_kill_switch = 1;
    masterConfig.auto_disarm_delay = 5;
    masterConfig.small_angle = 25;

    resetMixerConfig(&masterConfig.mixerConfig);

    // Motor/ESC/Servo
    resetEscAndServoConfig(&masterConfig.escAndServoConfig);
    resetFlight3DConfig(&masterConfig.flight3DConfig);

#ifdef BRUSHED_MOTORS
    masterConfig.motor_pwm_rate = BRUSHED_MOTORS_PWM_RATE;
#else
    masterConfig.motor_pwm_rate = BRUSHLESS_MOTORS_PWM_RATE;
#endif
    masterConfig.servo_pwm_rate = 50;

#ifdef GPS
    // gps/nav stuff
    masterConfig.gpsConfig.provider = GPS_UBLOX;
    masterConfig.gpsConfig.sbasMode = SBAS_AUTO;
    masterConfig.gpsConfig.autoConfig = GPS_AUTOCONFIG_ON;
    masterConfig.gpsConfig.autoBaud = GPS_AUTOBAUD_ON;
    masterConfig.gpsConfig.dynModel = GPS_DYNMODEL_AIR_1G;
#endif

#ifdef NAV
    resetNavConfig(&masterConfig.navConfig);
#endif

    resetSerialConfig(&masterConfig.serialConfig);

    masterConfig.looptime = 2000;
    masterConfig.emf_avoidance = 0;
    masterConfig.i2c_overclock = 0;
    masterConfig.gyroSync = 0;
    masterConfig.gyroSyncDenominator = 2;

    resetPidProfile(&currentProfile->pidProfile);

    resetControlRateConfig(&masterConfig.controlRateProfiles[0]);

    // for (i = 0; i < CHECKBOXITEMS; i++)
    //     cfg.activate[i] = 0;

    currentProfile->mag_declination = 0;

    resetBarometerConfig(&masterConfig.barometerConfig);

    // Radio
    parseRcChannels("AETR1234", &masterConfig.rxConfig);

    resetRcControlsConfig(&currentProfile->rcControlsConfig);

    currentProfile->throttle_tilt_compensation_strength = 0;      // 0-100, 0 - disabled

    // Failsafe Variables
    masterConfig.failsafeConfig.failsafe_delay = 10;              // 1sec
    masterConfig.failsafeConfig.failsafe_off_delay = 200;         // 20sec
    masterConfig.failsafeConfig.failsafe_throttle = 1000;         // default throttle off.
    masterConfig.failsafeConfig.failsafe_kill_switch = 0;         // default failsafe switch action is identical to rc link loss
    masterConfig.failsafeConfig.failsafe_throttle_low_delay = 100; // default throttle low delay for "just disarm" on failsafe condition
    masterConfig.failsafeConfig.failsafe_procedure = 0;           // default full failsafe procedure is 0: auto-landing

#ifdef USE_SERVOS
    // servos
    for (i = 0; i < MAX_SUPPORTED_SERVOS; i++) {
        currentProfile->servoConf[i].min = DEFAULT_SERVO_MIN;
        currentProfile->servoConf[i].max = DEFAULT_SERVO_MAX;
        currentProfile->servoConf[i].middle = DEFAULT_SERVO_MIDDLE;
        currentProfile->servoConf[i].rate = 100;
        currentProfile->servoConf[i].angleAtMin = DEFAULT_SERVO_MIN_ANGLE;
        currentProfile->servoConf[i].angleAtMax = DEFAULT_SERVO_MAX_ANGLE;
        currentProfile->servoConf[i].forwardFromChannel = CHANNEL_FORWARDING_DISABLED;
    }

    // gimbal
    currentProfile->gimbalConfig.mode = GIMBAL_MODE_NORMAL;
#endif

    // custom mixer. clear by defaults.
    for (i = 0; i < MAX_SUPPORTED_MOTORS; i++)
        masterConfig.customMotorMixer[i].throttle = 0.0f;

#ifdef LED_STRIP
    applyDefaultColors(masterConfig.colors, CONFIGURABLE_COLOR_COUNT);
    applyDefaultLedStripConfig(masterConfig.ledConfigs);
#endif

#ifdef BLACKBOX
#ifdef ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
    featureSet(FEATURE_BLACKBOX);
    masterConfig.blackbox_device = BLACKBOX_DEVICE_FLASH;
#else
    masterConfig.blackbox_device = BLACKBOX_DEVICE_SERIAL;
#endif
    masterConfig.blackbox_rate_num = 1;
    masterConfig.blackbox_rate_denom = 1;
#endif

    // alternative defaults settings for COLIBRI RACE targets
#if defined(COLIBRI_RACE)
    masterConfig.looptime = 1000;

    masterConfig.rxConfig.rcmap[0] = 1;
    masterConfig.rxConfig.rcmap[1] = 2;
    masterConfig.rxConfig.rcmap[2] = 3;
    masterConfig.rxConfig.rcmap[3] = 0;
    masterConfig.rxConfig.rcmap[4] = 4;
    masterConfig.rxConfig.rcmap[5] = 5;
    masterConfig.rxConfig.rcmap[6] = 6;
    masterConfig.rxConfig.rcmap[7] = 7;

    featureSet(FEATURE_ONESHOT125);
    featureSet(FEATURE_VBAT);
    featureSet(FEATURE_LED_STRIP);
    featureSet(FEATURE_FAILSAFE);
#endif

    // alternative defaults settings for ALIENWIIF1 and ALIENWIIF3 targets
#ifdef ALIENWII32
#ifdef ALIENWIIF3
    masterConfig.serialConfig.portConfigs[2].functionMask = FUNCTION_RX_SERIAL;
    masterConfig.batteryConfig.vbatscale = 20;
#else
    masterConfig.serialConfig.portConfigs[1].functionMask = FUNCTION_RX_SERIAL;
#endif
    masterConfig.rxConfig.serialrx_provider = 1;
    masterConfig.rxConfig.spektrum_sat_bind = 5;
    masterConfig.escAndServoConfig.minthrottle = 1000;
    masterConfig.escAndServoConfig.maxthrottle = 2000;
    masterConfig.motor_pwm_rate = 32000;
    masterConfig.looptime = 2000;
    currentProfile->pidProfile.P8[ROLL] = 36;
    currentProfile->pidProfile.P8[PITCH] = 36;
    masterConfig.failsafeConfig.failsafe_delay = 2;
    masterConfig.failsafeConfig.failsafe_off_delay = 0;
    currentControlRateProfile->rcRate8 = 130;
    currentControlRateProfile->rates[FD_PITCH] = 20;
    currentControlRateProfile->rates[FD_ROLL] = 20;
    currentControlRateProfile->rates[FD_YAW] = 100;
    parseRcChannels("TAER1234", &masterConfig.rxConfig);

    //  { 1.0f, -0.414178f,  1.0f, -1.0f },          // REAR_R
    masterConfig.customMotorMixer[0].throttle = 1.0f;
    masterConfig.customMotorMixer[0].roll = -0.414178f;
    masterConfig.customMotorMixer[0].pitch = 1.0f;
    masterConfig.customMotorMixer[0].yaw = -1.0f;

    //  { 1.0f, -0.414178f, -1.0f,  1.0f },          // FRONT_R
    masterConfig.customMotorMixer[1].throttle = 1.0f;
    masterConfig.customMotorMixer[1].roll = -0.414178f;
    masterConfig.customMotorMixer[1].pitch = -1.0f;
    masterConfig.customMotorMixer[1].yaw = 1.0f;

    //  { 1.0f,  0.414178f,  1.0f,  1.0f },          // REAR_L
    masterConfig.customMotorMixer[2].throttle = 1.0f;
    masterConfig.customMotorMixer[2].roll = 0.414178f;
    masterConfig.customMotorMixer[2].pitch = 1.0f;
    masterConfig.customMotorMixer[2].yaw = 1.0f;

    //  { 1.0f,  0.414178f, -1.0f, -1.0f },          // FRONT_L
    masterConfig.customMotorMixer[3].throttle = 1.0f;
    masterConfig.customMotorMixer[3].roll = 0.414178f;
    masterConfig.customMotorMixer[3].pitch = -1.0f;
    masterConfig.customMotorMixer[3].yaw = -1.0f;

    //  { 1.0f, -1.0f, -0.414178f, -1.0f },          // MIDFRONT_R
    masterConfig.customMotorMixer[4].throttle = 1.0f;
    masterConfig.customMotorMixer[4].roll = -1.0f;
    masterConfig.customMotorMixer[4].pitch = -0.414178f;
    masterConfig.customMotorMixer[4].yaw = -1.0f;

    //  { 1.0f,  1.0f, -0.414178f,  1.0f },          // MIDFRONT_L
    masterConfig.customMotorMixer[5].throttle = 1.0f;
    masterConfig.customMotorMixer[5].roll = 1.0f;
    masterConfig.customMotorMixer[5].pitch = -0.414178f;
    masterConfig.customMotorMixer[5].yaw = 1.0f;

    //  { 1.0f, -1.0f,  0.414178f,  1.0f },          // MIDREAR_R
    masterConfig.customMotorMixer[6].throttle = 1.0f;
    masterConfig.customMotorMixer[6].roll = -1.0f;
    masterConfig.customMotorMixer[6].pitch = 0.414178f;
    masterConfig.customMotorMixer[6].yaw = 1.0f;

    //  { 1.0f,  1.0f,  0.414178f, -1.0f },          // MIDREAR_L
    masterConfig.customMotorMixer[7].throttle = 1.0f;
    masterConfig.customMotorMixer[7].roll = 1.0f;
    masterConfig.customMotorMixer[7].pitch = 0.414178f;
    masterConfig.customMotorMixer[7].yaw = -1.0f;
#endif

    // copy first profile into remaining profile
    for (i = 1; i < MAX_PROFILE_COUNT; i++) {
        memcpy(&masterConfig.profile[i], currentProfile, sizeof(profile_t));
    }

    // copy first control rate config into remaining profile
    for (i = 1; i < MAX_CONTROL_RATE_PROFILE_COUNT; i++) {
        memcpy(&masterConfig.controlRateProfiles[i], currentControlRateProfile, sizeof(controlRateConfig_t));
    }

    for (i = 1; i < MAX_PROFILE_COUNT; i++) {
        masterConfig.profile[i].defaultRateProfileIndex = i % MAX_CONTROL_RATE_PROFILE_COUNT;
    }
}
Esempio n. 26
0
// Default settings
static void resetConf(void)
{
    int i;
    int8_t servoRates[8] = { 30, 30, 100, 100, 100, 100, 100, 100 };

    // Clear all configuration
    memset(&masterConfig, 0, sizeof(master_t));
    setProfile(0);
    setControlRateProfile(0);

    masterConfig.version = EEPROM_CONF_VERSION;
    masterConfig.mixerConfiguration = MULTITYPE_QUADX;
    featureClearAll();
#if defined(CJMCU) || defined(SPARKY)
    featureSet(FEATURE_RX_PPM);
#endif
    featureSet(FEATURE_VBAT);

    // global settings
    masterConfig.current_profile_index = 0;     // default profile
    masterConfig.gyro_cmpf_factor = 600;        // default MWC
    masterConfig.gyro_cmpfm_factor = 250;       // default MWC
    masterConfig.gyro_lpf = 42;                 // supported by all gyro drivers now. In case of ST gyro, will default to 32Hz instead

    resetAccelerometerTrims(&masterConfig.accZero);

    resetSensorAlignment(&masterConfig.sensorAlignmentConfig);

    masterConfig.boardAlignment.rollDegrees = 0;
    masterConfig.boardAlignment.pitchDegrees = 0;
    masterConfig.boardAlignment.yawDegrees = 0;
    masterConfig.acc_hardware = ACC_DEFAULT;     // default/autodetect
    masterConfig.max_angle_inclination = 500;    // 50 degrees
    masterConfig.yaw_control_direction = 1;
    masterConfig.gyroConfig.gyroMovementCalibrationThreshold = 32;

    resetBatteryConfig(&masterConfig.batteryConfig);

    resetTelemetryConfig(&masterConfig.telemetryConfig);

    masterConfig.rxConfig.serialrx_provider = 0;
    masterConfig.rxConfig.spektrum_sat_bind = 0;
    masterConfig.rxConfig.midrc = 1500;
    masterConfig.rxConfig.mincheck = 1100;
    masterConfig.rxConfig.maxcheck = 1900;
    masterConfig.rxConfig.rssi_channel = 0;
    masterConfig.rxConfig.rssi_scale = RSSI_SCALE_DEFAULT;

    masterConfig.inputFilteringMode = INPUT_FILTERING_DISABLED;

    masterConfig.retarded_arm = 0;
    masterConfig.disarm_kill_switch = 1;
    masterConfig.small_angle = 25;

    masterConfig.airplaneConfig.flaps_speed = 0;
    masterConfig.airplaneConfig.fixedwing_althold_dir = 1;

    // Motor/ESC/Servo
    resetEscAndServoConfig(&masterConfig.escAndServoConfig);
    resetFlight3DConfig(&masterConfig.flight3DConfig);

#ifdef BRUSHED_MOTORS
    masterConfig.motor_pwm_rate = BRUSHED_MOTORS_PWM_RATE;
#else
    masterConfig.motor_pwm_rate = BRUSHLESS_MOTORS_PWM_RATE;
#endif
    masterConfig.servo_pwm_rate = 50;

#ifdef GPS
    // gps/nav stuff
    masterConfig.gpsConfig.provider = GPS_NMEA;
    masterConfig.gpsConfig.sbasMode = SBAS_AUTO;
    masterConfig.gpsConfig.autoConfig = GPS_AUTOCONFIG_ON;
    masterConfig.gpsConfig.autoBaud = GPS_AUTOBAUD_OFF;
#endif

    resetSerialConfig(&masterConfig.serialConfig);

    masterConfig.looptime = 3500;
    masterConfig.emf_avoidance = 0;

    currentProfile->pidController = 0;
    resetPidProfile(&currentProfile->pidProfile);

    resetControlRateConfig(&masterConfig.controlRateProfiles[0]);

    // for (i = 0; i < CHECKBOXITEMS; i++)
    //     cfg.activate[i] = 0;

    resetRollAndPitchTrims(&currentProfile->accelerometerTrims);

    currentProfile->mag_declination = 0;
    currentProfile->acc_lpf_factor = 4;
    currentProfile->accz_lpf_cutoff = 5.0f;
    currentProfile->accDeadband.xy = 40;
    currentProfile->accDeadband.z = 40;

    resetBarometerConfig(&currentProfile->barometerConfig);

    currentProfile->acc_unarmedcal = 1;

    // Radio
    parseRcChannels("AETR1234", &masterConfig.rxConfig);

    resetRcControlsConfig(&currentProfile->rcControlsConfig);

    currentProfile->throttle_correction_value = 0;      // could 10 with althold or 40 for fpv
    currentProfile->throttle_correction_angle = 800;    // could be 80.0 deg with atlhold or 45.0 for fpv

    // Failsafe Variables
    currentProfile->failsafeConfig.failsafe_delay = 10;              // 1sec
    currentProfile->failsafeConfig.failsafe_off_delay = 200;         // 20sec
    currentProfile->failsafeConfig.failsafe_throttle = 1200;         // decent default which should always be below hover throttle for people.
    currentProfile->failsafeConfig.failsafe_min_usec = 985;          // any of first 4 channels below this value will trigger failsafe
    currentProfile->failsafeConfig.failsafe_max_usec = 2115;         // any of first 4 channels above this value will trigger failsafe

    // servos
    for (i = 0; i < 8; i++) {
        currentProfile->servoConf[i].min = DEFAULT_SERVO_MIN;
        currentProfile->servoConf[i].max = DEFAULT_SERVO_MAX;
        currentProfile->servoConf[i].middle = DEFAULT_SERVO_MIDDLE;
        currentProfile->servoConf[i].rate = servoRates[i];
        currentProfile->servoConf[i].forwardFromChannel = CHANNEL_FORWARDING_DISABLED;
    }

    currentProfile->mixerConfig.yaw_direction = 1;
    currentProfile->mixerConfig.tri_unarmed_servo = 1;

    // gimbal
    currentProfile->gimbalConfig.gimbal_flags = GIMBAL_NORMAL;

#ifdef GPS
    resetGpsProfile(&currentProfile->gpsProfile);
#endif

    // custom mixer. clear by defaults.
    for (i = 0; i < MAX_SUPPORTED_MOTORS; i++)
        masterConfig.customMixer[i].throttle = 0.0f;

#ifdef LED_STRIP
    applyDefaultColors(masterConfig.colors, CONFIGURABLE_COLOR_COUNT);
    applyDefaultLedStripConfig(masterConfig.ledConfigs);
#endif

    // copy first profile into remaining profile
    for (i = 1; i < MAX_PROFILE_COUNT; i++) {
        memcpy(&masterConfig.profile[i], currentProfile, sizeof(profile_t));
    }

    // copy first control rate config into remaining profile
    for (i = 1; i < MAX_CONTROL_RATE_PROFILE_COUNT; i++) {
        memcpy(&masterConfig.controlRateProfiles[i], currentControlRateProfile, sizeof(controlRateConfig_t));
    }

    for (i = 1; i < MAX_PROFILE_COUNT; i++) {
        masterConfig.profile[i].defaultRateProfileIndex = i % MAX_CONTROL_RATE_PROFILE_COUNT;
    }
}
Esempio n. 27
0
void magblocks4(void)
{
   static char command[COMMANDLEN + 2];
   static double undoFit[NA], undoFitUnc[NA];
   int npnts, j;
   double qmax, qmin;

   /* Process command */
      while (queryString("magblocks4% ", command, COMMANDLEN + 2) == NULL);
      caps(command);

      /* Spawn a command */
      if (strcmp(command, "!") == 0 || strcmp(command, "!!") == 0) {
        bang(command);

      /* Print current directory */
      } else if (strcmp(command, "PWD") == 0) {
         puts(currentDir);

      /* Change current directory */
      } else if (strcmp(command, "CD") == 0) {
         cd(command);
         
      /* Help */
      } else if (
         strcmp(command, "?") == 0 ||
         strcmp(command, "HE") == 0
      ) {
         help(command + (*command == '?' ? 1 : 2));

      /* Value of vacuum QCSQ */
      } else if (
         strcmp(command, "QCV") == 0 ||
         strcmp(command, "VQC") == 0
      ) {
         setVQCSQ(qcsq);

      /* Vacuum QCMSQ */
      } else if (
         strcmp(command, "QMV") == 0 ||
         strcmp(command, "VQM") == 0
      ) {
         setVMQCSQ(qcmsq);

      /* Value of vacuum linear absorption coefficient */
      } else if (
         strcmp(command, "MUV") == 0 ||
         strcmp(command, "VMU") == 0
      ) {
         setVMU(mu);

      /* Enter critical Q squared */
      } else if (strncmp(command, "QC", 2) == 0) {
         setQCSQ(command + 2, qcsq, Dqcsq);

      /* Top magnetic critical Q squared */
      } else if (strncmp(command, "QM", 2) == 0) {
         setMQCSQ(command + 2, qcmsq, Dqcmsq);

      /* Top length absorption coefficient */
      } else if (strncmp(command, "MU", 2) == 0) {
         setMU(command + 2, mu, Dmu);

      /* Thicknesses of magnetic layers */
      } else if (strncmp(command, "DM", 2) == 0) {
         setDM(command + 2, dm, Ddm);

      /* Delta lambda */
      } else if (strcmp(command, "DL") == 0) {
         setLamdel(&lamdel);

      /* Delta theta */
      } else if (strcmp(command, "DT") == 0) {
         setThedel(&thedel);

      /* Enter chemical thickness */
      } else if (command[0] == 'D') {
         setD(command + 1, d, Dd);

      /* Chemical roughnesses */
      } else if (strncmp(command, "RO", 2) == 0) {
         setRO(command + 2, rough, Drough);

      /* Magnetic roughnesses of layers */
      } else if (strncmp(command, "RM", 2) == 0) {
         setMRO(command + 2, mrough, Dmrough);

      /* Theta angle of average moment in layer */
      } else if (strncmp(command, "TH", 2) == 0) {
         setTHE(command + 2, the, Dthe);

      /* Wavelength */
      } else if (strcmp(command, "WL") == 0) {
         setWavelength(&lambda);

      /* Guide angle */
      } else if (strcmp(command, "EPS") == 0) {
         setGuideangle(&aguide);

      /* Number of layers */
      } else if (strcmp(command, "NL") == 0) {
         if (!setNlayer(&nlayer))
         /* Bug found Wed Jun  7 10:38:45 EDT 2000 by KOD */
         /* since it starts at 0, correction for vacuum forces zero */
         for (j = 1; j <= nlayer; j++)
            /* Set all absorptions to non-zero values */
            if (mu[j] < *mu) mu[j] = *mu + 1.e-20;

      /* Add or remove layers */
      } else if (strcmp(command, "AL") == 0 || strcmp(command, "RL") == 0) {
         modifyLayers(command);

      /* Copy layer */
      } else if (strcmp(command, "CL") == 0) {
         copyLayer(command);

      /* Make superlattice */
      } else if (strcmp(command, "SL") == 0) {
         superLayer(command);

      /* Maximum number of layers used to simulate rough interface */
      } else if (strcmp(command, "NR") == 0) {
         if (!setNrough(&nrough)) {
            /* Generate interface profile */
            if (nrough < 3) nrough = 11;
            if (proftyp[0] == 'H')
               gentanh(nrough, zint, rufint);
            else
               generf(nrough, zint, rufint);
         }

      /* Specify error function or hyperbolic tangent profile */
      } else if (strcmp(command, "PR") == 0) {
         setProfile(proftyp, PROFTYPLEN + 2);

      /* Range of Q to be scanned */
      } else if (strcmp(command, "QL") == 0) {
         if (!setQrange(&qmin, &qmax)) {
            qmina = qmin;
            qmaxa = qmax;
            qminb = qmin;
            qmaxb = qmax;
            qminc = qmin;
            qmaxc = qmax;
            qmind = qmin;
            qmaxd = qmax;
         }

      /* Number of points scanned */
      } else if (strcmp(command, "NP") == 0) {
         if (!setNpnts(&npnts)) {
            npntsa = npnts;
            npntsb = npnts;
            npntsc = npnts;
            npntsd = npnts;
         }

      /* File for input data */
      } else if (strcmp(command, "IF") == 0) {
         setFilename(infile, INFILELEN + 2);

      /* File for output data */
      } else if (strcmp(command, "OF") == 0) {
         setFilename(outfile, OUTFILELEN + 2);

      /* File for parameters */
      } else if (strcmp(command, "PF") == 0) {
         setFilename(parfile, PARFILELEN + 2);

      /* Polarization state */
      } else if (strcmp(command, "PS") == 0) {
         setPolstat(polstat, POLSTATLEN + 2);

      /* Beam intensity */
      } else if (strcmp(command, "BI") == 0) {
         setBeamIntens(&bmintns, &Dbmintns);

      /* Background intensity */
      } else if (strcmp(command, "BK") == 0) {
         setBackground(&bki, &Dbki);

      /* Verify parameters by printing out */
      } else if (strncmp(command, "VE", 2) == 0) {
         printLayers(command);

      /* Get data from file */
      } else if (strcmp(command, "GD") == 0) {
         loadData(infile, xspin);

      /* Edit constraints */
      } else if (strcmp(command, "EC") == 0) {
         constrainFunc newmodule;

         newmodule = newConstraints(constrainScript, constrainModule);
         if (newmodule != NULL) Constrain = newmodule;

      /* Reload constrain module */
      } else if (strcmp(command, "LC") == 0) {
         Constrain = loadConstrain(constrainModule);

      /* Unload constrain module */
      } else if (strcmp(command, "ULC") == 0) {
         Constrain = loadConstrain(NULL);

      /* Load parameters from parameter file */
      } else if (strncmp(command, "LP", 2) == 0) {
         loadParms(command, parfile, constrainScript, constrainModule);

      /* Save parameters to parameter file */
      } else if (strcmp(command, "SP") == 0) {
         parms(qcsq, qcmsq, d, dm, rough, mrough, mu, the,
               MAXLAY, &lambda, &lamdel, &thedel, &aguide,
              &nlayer, &qmina, &qmaxa, &npntsa,
              &qminb, &qmaxb, &npntsb, &qminc, &qmaxc, &npntsc,
              &qmind, &qmaxd, &npntsd,
               infile, outfile,
              &bmintns, &bki, listA, &mfit, NA, &nrough, proftyp,
               polstat, DA, constrainScript, parfile, TRUE);

      /* List data and fit */
      } else if (strcmp(command, "LID") == 0) {
         listData();

      /* Generate logarithm of bare (unconvoluted) reflectivity */
      /* or generate reflected amplitude */
      } else if (strcmp(command,"GR") == 0 || strcmp(command, "GA") == 0) {
         genReflect(command);

      /* Generate and display layer profile */
      } else if (
         strcmp(command, "GLP") == 0 ||
         strncmp(command, "SLP", 3) == 0
      ) {
         genProfile(command);

      /* Save values in Q4X and YFIT to OUTFILE */
      } else if (strcmp(command, "SV") == 0) {
         saveTemps(outfile, xspin, y4x, n4x, FALSE);

      /* Save values in Q4X and YFITA to OUTFILE */
      } else if (strcmp(command, "SVA") == 0) {
         saveTemps(outfile, xspin, yfita, n4x, TRUE);

      /* Calculate derivative of reflectivity or spin asymmetry with respect */
      /* to a fit parameter or save a fit to disk file */
      } else if (
         strcmp(command, "RD") == 0 ||
         strcmp(command, "SRF") == 0
      ) {
         printDerivs(command, npnts);

      /* Turn off all varied parameters */
      } else if (strcmp(command, "VANONE") == 0) {
         clearLista(listA);

      /* Specify which parameters are to be varied in the reflectivity fit */
      } else if (strncmp(command, "VA", 2) == 0) {
         varyParm(command);

      /* Calculate chi-squared */
      } else if (
         strcmp(command, "CSR") == 0 ||
         strcmp(command, "CS") == 0
      ) {
         calcChiSq(command);

      /* Fit reflectivity */
      } else if (strncmp(command, "FR", 2) == 0) {
         for (j = 0; j < NA; j++) {
            undoFit[j] = A[j];
            undoFitUnc[j] = DA[j];
         }
         fitReflec(command);

      /* Undo last fit */
      } else if (strcmp(command, "UF") == 0) {
         for (j = 0; j < NA; j++) {
            A[j] = undoFit[j];
            DA[j] = undoFitUnc[j];
         }

      /* Exit */
      } else if (
         strcmp(command, "EX") == 0 ||
         strcmp(command, "EXS") == 0
      ) {
         parms(qcsq, qcmsq, d, dm, rough, mrough, mu, the,
               MAXLAY, &lambda, &lamdel, &thedel, &aguide,
              &nlayer, &qmina, &qmaxa, &npntsa,
              &qminb, &qmaxb, &npntsb, &qminc, &qmaxc, &npntsc,
              &qmind, &qmaxd, &npntsd,
               infile, outfile,
              &bmintns, &bki, listA, &mfit, NA, &nrough, proftyp,
               polstat, DA, constrainScript, parfile, TRUE);
         /* Print elapsed CPU time */
         if (strcmp(command, "EXS") == 0) system("ps");
         exit(0);

      /* Exit without saving changes */
      } else if (strcmp(command, "QU") == 0 || strcmp(command, "QUIT") == 0) {
         exit(0);

      /* Plot reflectivity on screen */
      } else if (strncmp(command, "PRF", 3) == 0) {
         plotfit(command, xspin);

      /* Plot profile on screen */
      } else if (strncmp(command, "PLP", 3) == 0) {
         plotprofile(command, xspin);

      /* Plot movie of reflectivity change from fit */
      } else if (strncmp(command, "MVF", 3) == 0) {
         fitMovie(command, xspin, undoFit);

      /* Plot general movie from data file on screen */
      } else if (strncmp(command, "MVX", 3) == 0) {
         arbitraryMovie(command, xspin);

      /* Plot movie of parameter on screen */
      } else if (strncmp(command, "MV", 2) == 0) {
         oneParmMovie(command, xspin);

      /* Update constraints */
      } else if (strcmp(command, "UC") == 0) {
         genshift(a, TRUE);
         /* constrain(a); */
         (*Constrain)(FALSE, a, nlayer);
         genshift(a, FALSE);

      /* Determine number of points required for resolution extension */
      } else if (strcmp(command, "RE") == 0) {
         calcExtend(xspin);

#if 0 /* Dead code --- shadowed by "CD" command earlier */
      /* Convolute input raw data set with instrumental resolution */
      } else if (strcmp(command, "CD") == 0) {
         calcConvolve(polstat);
#endif

      /* Send data to other processes. */
      } else if (strcmp(command, "SEND") == 0) {
	ipc_send(command);

      /* Receive data to other processes. */
      } else if (strcmp(command, "RECV") == 0) {
	ipc_recv(command);

      /* Faulty input */
      } else
         ERROR("/** Unrecognized command **/");
}
Esempio n. 28
0
// Default settings
STATIC_UNIT_TESTED void resetConf(void)
{
    int i;

    // Clear all configuration
    memset(&masterConfig, 0, sizeof(master_t));
    setProfile(0);
    setControlRateProfile(0);

    masterConfig.version = EEPROM_CONF_VERSION;
    masterConfig.mixerMode = MIXER_QUADX;
    featureClearAll();
#if defined(CJMCU) || defined(SPARKY) || defined(COLIBRI_RACE) || defined(MOTOLAB) || defined(SPRACINGF3MINI) || defined(LUX_RACE)
    featureSet(FEATURE_RX_PPM);
#endif

//#if defined(SPRACINGF3MINI)
//    featureSet(FEATURE_DISPLAY);
//#endif

#ifdef BOARD_HAS_VOLTAGE_DIVIDER
    // only enable the VBAT feature by default if the board has a voltage divider otherwise
    // the user may see incorrect readings and unexpected issues with pin mappings may occur.
    featureSet(FEATURE_VBAT);
#endif

    featureSet(FEATURE_FAILSAFE);

    // global settings
    masterConfig.dcm_kp = 2500;                // 1.0 * 10000
    masterConfig.gyro_lpf = 1;                 // supported by all gyro drivers now. In case of ST gyro, will default to 32Hz instead
    masterConfig.soft_gyro_lpf_hz = 60;        // Software based lpf filter for gyro

    masterConfig.max_angle_inclination = 500;    // 50 degrees
    masterConfig.yaw_control_direction = 1;
    masterConfig.gyroConfig.gyroMovementCalibrationThreshold = 32;

    resetBatteryConfig(&masterConfig.batteryConfig);

#ifdef TELEMETRY
    masterConfig.telemetryConfig.hottAlarmSoundInterval = 5;
#endif

    masterConfig.rxConfig.sbus_inversion = 1;
    masterConfig.rxConfig.midrc = 1500;
    masterConfig.rxConfig.mincheck = 1100;
    masterConfig.rxConfig.maxcheck = 1900;
    masterConfig.rxConfig.rx_min_usec = 885;          // any of first 4 channels below this value will trigger rx loss detection
    masterConfig.rxConfig.rx_max_usec = 2115;         // any of first 4 channels above this value will trigger rx loss detection

    for (i = 0; i < MAX_SUPPORTED_RC_CHANNEL_COUNT; i++) {
        rxFailsafeChannelConfiguration_t *channelFailsafeConfiguration = &masterConfig.rxConfig.failsafe_channel_configurations[i];
        channelFailsafeConfiguration->mode = (i < NON_AUX_CHANNEL_COUNT) ? RX_FAILSAFE_MODE_AUTO : RX_FAILSAFE_MODE_HOLD;
        channelFailsafeConfiguration->step = (i == THROTTLE) ? CHANNEL_VALUE_TO_RXFAIL_STEP(masterConfig.rxConfig.rx_min_usec) : CHANNEL_VALUE_TO_RXFAIL_STEP(masterConfig.rxConfig.midrc);
    }

    masterConfig.rxConfig.rssi_scale = RSSI_SCALE_DEFAULT;

    resetAllRxChannelRangeConfigurations(masterConfig.rxConfig.channelRanges);

    masterConfig.disarm_kill_switch = 1;
    masterConfig.auto_disarm_delay = 5;
    masterConfig.small_angle = 25;

    resetMixerConfig(&masterConfig.mixerConfig);

    masterConfig.airplaneConfig.fixedwing_althold_dir = 1;

    // Motor/ESC/Servo
    resetEscAndServoConfig(&masterConfig.escAndServoConfig);
    resetFlight3DConfig(&masterConfig.flight3DConfig);

#ifdef BRUSHED_MOTORS
    masterConfig.motor_pwm_rate = BRUSHED_MOTORS_PWM_RATE;
#else
    masterConfig.motor_pwm_rate = BRUSHLESS_MOTORS_PWM_RATE;
#endif
    masterConfig.servo_pwm_rate = 50;

#ifdef GPS
    // gps/nav stuff
    masterConfig.gpsConfig.autoConfig = GPS_AUTOCONFIG_ON;
#endif

    resetSerialConfig(&masterConfig.serialConfig);

    masterConfig.looptime = 2000;
    masterConfig.i2c_highspeed = 1;
    masterConfig.gyroSync = 1;
    masterConfig.gyroSyncDenominator = 1;

    resetPidProfile(&currentProfile->pidProfile);

    resetControlRateConfig(&masterConfig.controlRateProfiles[0]);

    // for (i = 0; i < CHECKBOXITEMS; i++)
    //     cfg.activate[i] = 0;

    resetRollAndPitchTrims(&currentProfile->accelerometerTrims);

    currentProfile->mag_declination = 0;
    currentProfile->acc_cut_hz = 15;
    currentProfile->accz_lpf_cutoff = 5.0f;
    currentProfile->accDeadband.xy = 40;
    currentProfile->accDeadband.z = 40;
    currentProfile->acc_unarmedcal = 1;

#ifdef BARO
    resetBarometerConfig(&currentProfile->barometerConfig);
#endif

    // Radio
    parseRcChannels("AETR1234", &masterConfig.rxConfig);

    resetRcControlsConfig(&currentProfile->rcControlsConfig);

    currentProfile->throttle_correction_value = 0;      // could 10 with althold or 40 for fpv
    currentProfile->throttle_correction_angle = 800;    // could be 80.0 deg with atlhold or 45.0 for fpv

    // Failsafe Variables
    masterConfig.failsafeConfig.failsafe_delay = 10;              // 1sec
    masterConfig.failsafeConfig.failsafe_off_delay = 200;         // 20sec
    masterConfig.failsafeConfig.failsafe_throttle = 1000;         // default throttle off.
    masterConfig.failsafeConfig.failsafe_throttle_low_delay = 100; // default throttle low delay for "just disarm" on failsafe condition

#ifdef USE_SERVOS
    // servos
    for (i = 0; i < MAX_SUPPORTED_SERVOS; i++) {
        currentProfile->servoConf[i].min = DEFAULT_SERVO_MIN;
        currentProfile->servoConf[i].max = DEFAULT_SERVO_MAX;
        currentProfile->servoConf[i].middle = DEFAULT_SERVO_MIDDLE;
        currentProfile->servoConf[i].rate = 100;
        currentProfile->servoConf[i].angleAtMin = DEFAULT_SERVO_MIN_ANGLE;
        currentProfile->servoConf[i].angleAtMax = DEFAULT_SERVO_MAX_ANGLE;
        currentProfile->servoConf[i].forwardFromChannel = CHANNEL_FORWARDING_DISABLED;
    }

    // gimbal
    currentProfile->gimbalConfig.mode = GIMBAL_MODE_NORMAL;
#endif

#ifdef GPS
    resetGpsProfile(&currentProfile->gpsProfile);
#endif

#ifdef LED_STRIP
    applyDefaultColors(masterConfig.colors, CONFIGURABLE_COLOR_COUNT);
    applyDefaultLedStripConfig(masterConfig.ledConfigs);
#endif

#ifdef TRANSPONDER
    static const uint8_t defaultTransponderData[6] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC }; // Note, this is NOT a valid transponder code, it's just for testing production hardware

    memcpy(masterConfig.transponderData, &defaultTransponderData, sizeof(defaultTransponderData));
#endif

#ifdef BLACKBOX

#if defined(ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT)
    featureSet(FEATURE_BLACKBOX);
    masterConfig.blackbox_device = BLACKBOX_DEVICE_FLASH;
#elif defined(ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT)
    featureSet(FEATURE_BLACKBOX);
    masterConfig.blackbox_device = BLACKBOX_DEVICE_SDCARD;
#else
    masterConfig.blackbox_device = BLACKBOX_DEVICE_SERIAL;
#endif

    masterConfig.blackbox_rate_num = 1;
    masterConfig.blackbox_rate_denom = 1;
#endif

    // alternative defaults settings for COLIBRI RACE targets
#if defined(COLIBRI_RACE)
    masterConfig.looptime = 1000;

    currentProfile->pidProfile.pidController = 1;

    masterConfig.rxConfig.rcmap[0] = 1;
    masterConfig.rxConfig.rcmap[1] = 2;
    masterConfig.rxConfig.rcmap[2] = 3;
    masterConfig.rxConfig.rcmap[3] = 0;
    masterConfig.rxConfig.rcmap[4] = 4;
    masterConfig.rxConfig.rcmap[5] = 5;
    masterConfig.rxConfig.rcmap[6] = 6;
    masterConfig.rxConfig.rcmap[7] = 7;

    featureSet(FEATURE_ONESHOT125);
    featureSet(FEATURE_VBAT);
    featureSet(FEATURE_LED_STRIP);
    featureSet(FEATURE_FAILSAFE);
#endif

    // alternative defaults settings for ALIENWIIF1 and ALIENWIIF3 targets
#ifdef ALIENWII32
    featureSet(FEATURE_RX_SERIAL);
    featureSet(FEATURE_MOTOR_STOP);
#ifdef ALIENWIIF3
    masterConfig.serialConfig.portConfigs[2].functionMask = FUNCTION_RX_SERIAL;
    masterConfig.batteryConfig.vbatscale = 20;
#else
    masterConfig.serialConfig.portConfigs[1].functionMask = FUNCTION_RX_SERIAL;
#endif
    masterConfig.rxConfig.serialrx_provider = 1;
    masterConfig.rxConfig.spektrum_sat_bind = 5;
    masterConfig.escAndServoConfig.minthrottle = 1000;
    masterConfig.escAndServoConfig.maxthrottle = 2000;
    masterConfig.motor_pwm_rate = 32000;
    masterConfig.looptime = 2000;
    currentProfile->pidProfile.pidController = 3;
    currentProfile->pidProfile.P8[ROLL] = 36;
    currentProfile->pidProfile.P8[PITCH] = 36;
    masterConfig.failsafeConfig.failsafe_delay = 2;
    masterConfig.failsafeConfig.failsafe_off_delay = 0;
    currentControlRateProfile->rcRate8 = 130;
    currentControlRateProfile->rates[FD_PITCH] = 20;
    currentControlRateProfile->rates[FD_ROLL] = 20;
    currentControlRateProfile->rates[FD_YAW] = 100;
    parseRcChannels("TAER1234", &masterConfig.rxConfig);

    //  { 1.0f, -0.414178f,  1.0f, -1.0f },          // REAR_R
    masterConfig.customMotorMixer[0].throttle = 1.0f;
    masterConfig.customMotorMixer[0].roll = -0.414178f;
    masterConfig.customMotorMixer[0].pitch = 1.0f;
    masterConfig.customMotorMixer[0].yaw = -1.0f;

    //  { 1.0f, -0.414178f, -1.0f,  1.0f },          // FRONT_R
    masterConfig.customMotorMixer[1].throttle = 1.0f;
    masterConfig.customMotorMixer[1].roll = -0.414178f;
    masterConfig.customMotorMixer[1].pitch = -1.0f;
    masterConfig.customMotorMixer[1].yaw = 1.0f;

    //  { 1.0f,  0.414178f,  1.0f,  1.0f },          // REAR_L
    masterConfig.customMotorMixer[2].throttle = 1.0f;
    masterConfig.customMotorMixer[2].roll = 0.414178f;
    masterConfig.customMotorMixer[2].pitch = 1.0f;
    masterConfig.customMotorMixer[2].yaw = 1.0f;

    //  { 1.0f,  0.414178f, -1.0f, -1.0f },          // FRONT_L
    masterConfig.customMotorMixer[3].throttle = 1.0f;
    masterConfig.customMotorMixer[3].roll = 0.414178f;
    masterConfig.customMotorMixer[3].pitch = -1.0f;
    masterConfig.customMotorMixer[3].yaw = -1.0f;

    //  { 1.0f, -1.0f, -0.414178f, -1.0f },          // MIDFRONT_R
    masterConfig.customMotorMixer[4].throttle = 1.0f;
    masterConfig.customMotorMixer[4].roll = -1.0f;
    masterConfig.customMotorMixer[4].pitch = -0.414178f;
    masterConfig.customMotorMixer[4].yaw = -1.0f;

    //  { 1.0f,  1.0f, -0.414178f,  1.0f },          // MIDFRONT_L
    masterConfig.customMotorMixer[5].throttle = 1.0f;
    masterConfig.customMotorMixer[5].roll = 1.0f;
    masterConfig.customMotorMixer[5].pitch = -0.414178f;
    masterConfig.customMotorMixer[5].yaw = 1.0f;

    //  { 1.0f, -1.0f,  0.414178f,  1.0f },          // MIDREAR_R
    masterConfig.customMotorMixer[6].throttle = 1.0f;
    masterConfig.customMotorMixer[6].roll = -1.0f;
    masterConfig.customMotorMixer[6].pitch = 0.414178f;
    masterConfig.customMotorMixer[6].yaw = 1.0f;

    //  { 1.0f,  1.0f,  0.414178f, -1.0f },          // MIDREAR_L
    masterConfig.customMotorMixer[7].throttle = 1.0f;
    masterConfig.customMotorMixer[7].roll = 1.0f;
    masterConfig.customMotorMixer[7].pitch = 0.414178f;
    masterConfig.customMotorMixer[7].yaw = -1.0f;
#endif

    // copy first profile into remaining profile
    for (i = 1; i < MAX_PROFILE_COUNT; i++) {
        memcpy(&masterConfig.profile[i], currentProfile, sizeof(profile_t));
    }

    // copy first control rate config into remaining profile
    for (i = 1; i < MAX_CONTROL_RATE_PROFILE_COUNT; i++) {
        memcpy(&masterConfig.controlRateProfiles[i], currentControlRateProfile, sizeof(controlRateConfig_t));
    }

    for (i = 1; i < MAX_PROFILE_COUNT; i++) {
        masterConfig.profile[i].defaultRateProfileIndex = i % MAX_CONTROL_RATE_PROFILE_COUNT;
    }
}