The subsystem design/basis for the final project

Dependencies:   mbed-rtos mbed-src pixylib

main.cpp

Committer:
balsamfir
Date:
2016-03-25
Revision:
7:5ef312aa2678
Parent:
5:f655435d0782
Child:
14:2d609d465f00

File content as of revision 7:5ef312aa2678:

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

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


// Definitions
// ----------------------------------------------------------------
enum Mode {
    AUTO_TRACK = '0', 
    MANUAL_CONTROL = '1', 
    MOTOR_TUNING = '2',
    SPEED_TUNING = '3',
    STEERING_TUNING = '4',
    TILT_TUNING = '5',
    SYSTEM_TUNING = '6'
};

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_TUNING: 
                MotorTuning();
                break;
            case SPEED_TUNING: 
                SpeedTuning();
                break;
            case STEERING_TUNING: 
                SteeringTuning();
                break;
            case TILT_TUNING: 
                TiltTuning();
                break;
            case SYSTEM_TUNING:
                SystemTuning();
                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 Tuning \r\n");
    pc->printf("3. Speed Tuning \r\n");
    pc->printf("4. Steering Tuning \r\n");
    pc->printf("5. Tilt Tuning \r\n");
     pc->printf("6. System Tuning \r\n");
    pc->printf("---------------------------------------------------------------- \r\n\r\n");
    
    pc->printf("=> ");
}