The subsystem design/basis for the final project

Dependencies:   mbed-rtos mbed-src pixylib

main.cpp

Committer:
balsamfir
Date:
2016-03-18
Revision:
4:01252f56e0e5
Parent:
3:dfb6733ae397
Child:
5:f655435d0782

File content as of revision 4:01252f56e0e5:

// Includes
// ----------------------------------------------------------------

#include "global.h"
#include "robot.h"
#include "response.h"
#include "tuning.h"


// Definitions
// ----------------------------------------------------------------
enum Mode {
    AUTO_TRACK = '0', 
    MANUAL_CONTROL = '1', 
    MOTOR_RESPONSE = '2',
    SPEED_RESPONSE = '3',
    STEERING_RESPONSE = '4',
    TILT_RESPONSE = '5',
    MOTOR_TUNING = '6',
    SPEED_TUNING = '7',
    STEERING_TUNING = '8',
    TILT_TUNING = '9'
};

void PrintMenu(Serial *pc);


// Wiring - TODO
// ----------------------------------------------------------------
//
//
//
//
//
//

// Main Program
// ----------------------------------------------------------------
int main() {  
    int mode;

    while (1) {
        PrintMenu(&pc);
        mode = pc.getc();
        pc.printf("\r\n\r\n");
        switch (mode) {
            case AUTO_TRACK: 
                AutoTrack();
                break;
            case MANUAL_CONTROL: 
                ManualControl();
                break;
            case MOTOR_RESPONSE: 
                MotorResponse();
                break;
            case SPEED_RESPONSE: 
                SpeedResponse();
                break;
            case STEERING_RESPONSE: 
                SteeringResponse();
                break;
            case TILT_RESPONSE: 
                TiltResponse();
                break;
            case MOTOR_TUNING: 
                MotorTuning();
                break;
            case SPEED_TUNING: 
                SpeedTuning();
                break;
            case STEERING_TUNING: 
                SteeringTuning();
                break;
            case TILT_TUNING: 
                TiltTuning(); 
                break;
            default:
                pc.printf("Error: Invalid Selection \r\n\r\n");
                break;
        }
        wait_ms(2000);
    }
}

// Other Functions
// ----------------------------------------------------------------
void PrintMenu(Serial *pc){
    pc->printf("\e[1;1H\e[2J");
    pc->printf("Select Mode: \r\n\r\n");
    
    pc->printf("---------------------------------------------------------------- \r\n");
    pc->printf("0. Automated Tracking \r\n");
    pc->printf("1. Manual Control \r\n");
    pc->printf("2. Motor Response \r\n");
    pc->printf("3. Speed Response \r\n");
    pc->printf("4. Steering Response \r\n");
    pc->printf("5. Tilt Response \r\n");
    pc->printf("6. Motor Tunning  \r\n");
    pc->printf("7. Speed Tunning \r\n");
    pc->printf("8. Steeing Tunning \r\n");
    pc->printf("9. Tilit Tunning \r\n");
    pc->printf("---------------------------------------------------------------- \r\n\r\n");
    
    pc->printf("=> ");
}