コード例 #1
0
ファイル: setupwizard.cpp プロジェクト: Crash1/TauLabs
int SetupWizard::nextId() const
{
    switch (currentId()) {
        case PAGE_START:
            if(canAutoUpdate()) {
                return PAGE_UPDATE;
            } else {
                return PAGE_CONTROLLER;
            }
        case PAGE_UPDATE:
            return PAGE_CONTROLLER;
        case PAGE_CONTROLLER: {
            switch(getControllerType())
            {
                case CONTROLLER_CC:
                case CONTROLLER_CC3D:
                    return PAGE_INPUT;
                case CONTROLLER_REVO:
                case CONTROLLER_PIPX:
                default:
                    return PAGE_NOTYETIMPLEMENTED;
            }
        }
        case PAGE_VEHICLES: {
            switch(getVehicleType())
            {
                case VEHICLE_MULTI:
                    return PAGE_MULTI;
                case VEHICLE_FIXEDWING:
                    return PAGE_FIXEDWING;
                case VEHICLE_HELI:
                    return PAGE_HELI;
                case VEHICLE_SURFACE:
                    return PAGE_SURFACE;
                default:
                    return PAGE_NOTYETIMPLEMENTED;
            }
        }
        case PAGE_MULTI:
            return PAGE_OUTPUT;
        case PAGE_INPUT:
            if(isRestartNeeded()) {
                saveHardwareSettings();
                return PAGE_REBOOT;
            }
            else {
                return PAGE_VEHICLES;
            }
        case PAGE_REBOOT:
            return PAGE_VEHICLES;
        case PAGE_OUTPUT:
            return PAGE_SUMMARY;
        case PAGE_LEVELLING:
            return PAGE_CALIBRATION;
        case PAGE_CALIBRATION:
            return PAGE_SAVE;
        case PAGE_SUMMARY:
            return PAGE_LEVELLING;
        case PAGE_SAVE:
            return PAGE_END;
        case PAGE_NOTYETIMPLEMENTED:
            return PAGE_END;
        default:
            return -1;
    }
}
コード例 #2
0
int SetupWizard::nextId() const
{
    switch (currentId()) {
    case PAGE_START:
        if (canAutoUpdate()) {
            return PAGE_UPDATE;
        } else {
            return PAGE_CONTROLLER;
        }
    case PAGE_UPDATE:
        return PAGE_CONTROLLER;

    case PAGE_CONTROLLER:
    {
        switch (getControllerType()) {
        case CONTROLLER_CC:
        case CONTROLLER_CC3D:
        case CONTROLLER_REVO:
        case CONTROLLER_DISCOVERYF4:
            return PAGE_INPUT;

        case CONTROLLER_NANO:
            if (isRestartNeeded()) {
                reboot();
            }
            return PAGE_INPUT;

        case CONTROLLER_OPLINK:
        default:
            return PAGE_NOTYETIMPLEMENTED;
        }
    }
    case PAGE_VEHICLES:
    {
        switch (getVehicleType()) {
        case VEHICLE_MULTI:
            return PAGE_MULTI;

        case VEHICLE_FIXEDWING:
            return PAGE_FIXEDWING;

        case VEHICLE_HELI:
            return PAGE_HELI;

        case VEHICLE_SURFACE:
            return PAGE_SURFACE;

        default:
            return PAGE_NOTYETIMPLEMENTED;
        }
    }
    case PAGE_MULTI:
        return PAGE_ESC;

    case PAGE_FIXEDWING:
    case PAGE_SURFACE:
        if (getVehicleSubType() == GROUNDVEHICLE_DIFFERENTIAL) {
            return PAGE_ESC;
        } else {
            return PAGE_SERVO;
        }

    case PAGE_INPUT:
        if (isRestartNeeded()) {
            saveHardwareSettings();
            reboot();
        }
        return PAGE_VEHICLES;

    case PAGE_ESC:
        if (getVehicleSubType() == MULTI_ROTOR_TRI_Y) {
            return PAGE_SERVO;
        } else {
            switch (getControllerType()) {
            case CONTROLLER_REVO:
            case CONTROLLER_NANO:
                return PAGE_GPS;

            default:
                return PAGE_SUMMARY;
            }
        }

    case PAGE_SERVO:
    {
        switch (getControllerType()) {
        case CONTROLLER_REVO:
        case CONTROLLER_NANO:
            return PAGE_GPS;

        default:
            return PAGE_SUMMARY;
        }
    }

    case PAGE_BIAS_CALIBRATION:
        if (getVehicleType() == VEHICLE_MULTI) {
            return PAGE_ESC_CALIBRATION;
        } else {
            return PAGE_OUTPUT_CALIBRATION;
        }

    case PAGE_ESC_CALIBRATION:
        return PAGE_OUTPUT_CALIBRATION;

    case PAGE_OUTPUT_CALIBRATION:
        return PAGE_AIRFRAME_INITIAL_TUNING;

    case PAGE_AIRFRAME_INITIAL_TUNING:
        return PAGE_SAVE;

    case PAGE_GPS:
        switch (getVehicleType()) {
        case VEHICLE_FIXEDWING:
            if (getGpsType() != GPS_DISABLED) {
                return PAGE_AIRSPEED;
            } else {
                return PAGE_SUMMARY;
            }
        default:
            return PAGE_SUMMARY;
        }

    case PAGE_AIRSPEED:
        return PAGE_SUMMARY;

    case PAGE_SUMMARY:
    {
        switch (getControllerType()) {
        case CONTROLLER_CC:
        case CONTROLLER_CC3D:
        case CONTROLLER_REVO:
        case CONTROLLER_NANO:
        case CONTROLLER_DISCOVERYF4:
            switch (getVehicleType()) {
            case VEHICLE_FIXEDWING:
                return PAGE_OUTPUT_CALIBRATION;

            default:
                return PAGE_BIAS_CALIBRATION;
            }
        default:
            return PAGE_NOTYETIMPLEMENTED;
        }
    }
    case PAGE_SAVE:
        return PAGE_END;

    case PAGE_NOTYETIMPLEMENTED:
        return PAGE_END;

    default:
        return -1;
    }
}