Changeset de10cbc in orbit for iOS/Orbit/Orbit/controllers


Ignore:
Timestamp:
08/02/13 19:00:35 (8 years ago)
Author:
Jonathon Horsman <jonathon@…>
Branches:
master, Servo, Tab_Interface, pyramid
Children:
1472980
Parents:
ce0a7ee
Message:

Add a test button on flight tab
Add a reset button on advanced tab
Correctly detect device volume
Add more tutorial HTML

Location:
iOS/Orbit/Orbit/controllers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • iOS/Orbit/Orbit/controllers/AdvancedViewController.h

    rab9d63b rde10cbc  
    1717@property (nonatomic, retain) IBOutlet UILabel *pitchPercent; 
    1818@property (nonatomic, retain) IBOutlet UISlider *pitch; 
     19@property (nonatomic, retain) IBOutlet UIBarButtonItem *resetButton; 
    1920 
    2021- (IBAction) pitchChanged:(id)sender; 
     
    2223- (IBAction) throttleChanged:(id)sender; 
    2324 
     25- (IBAction) resetButtonPressed:(id)button; 
     26 
    2427@end 
  • iOS/Orbit/Orbit/controllers/AdvancedViewController.m

    rce0a7ee rde10cbc  
    5353- (void) adjustValues 
    5454{ 
    55      
     55    [signalConverter setYaw:[self yawValue]throttle:[self throttleValue] pitch:[self pitchValue]]; 
     56} 
     57 
     58- (int) yawValue 
     59{ 
     60    return round(yaw.value * 100); 
     61} 
     62 
     63- (int) pitchValue 
     64{ 
     65    return round(pitch.value * 100); 
     66} 
     67 
     68- (int) throttleValue 
     69{ 
     70    return round(throttle.value * 100); 
     71} 
     72 
     73- (IBAction) resetButtonPressed:(id)button 
     74{ 
     75    pitch.value = 0.5; 
     76    yaw.value = 0.5; 
     77    throttle.value = 0.5; 
     78    NSString *zero = @"0%"; 
     79    throttlePercent.text = zero; 
     80    yawPercent.text = zero; 
     81    pitchPercent.text = zero; 
     82    [self adjustValues]; 
    5683} 
    5784 
  • iOS/Orbit/Orbit/controllers/FlightViewController.h

    rab9d63b rde10cbc  
    2727@property (nonatomic, retain) IBOutlet UISlider *meditationThreshold; 
    2828@property (nonatomic, retain) IBOutlet UIBarButtonItem *connectButton; 
     29@property (nonatomic, retain) IBOutlet UIBarButtonItem *testButton; 
    2930@property (nonatomic, retain) IBOutlet UIImageView *statusImage; 
    3031 
    3132- (IBAction) connectButtonPressed:(id) sender; 
     33- (IBAction) testButtonPressed:(id) sender; 
    3234 
    3335@end 
  • iOS/Orbit/Orbit/controllers/FlightViewController.m

    rce0a7ee rde10cbc  
    2626} 
    2727 
    28 @synthesize status, attention, meditation, signal, power, attentionThreshold, meditationThreshold, connectButton, statusImage, signalPercent, attentionPercent, meditationPercent, powerPercent; 
     28@synthesize status, attention, meditation, signal, power, attentionThreshold, meditationThreshold, connectButton, testButton, statusImage, signalPercent, attentionPercent, meditationPercent, powerPercent; 
    2929 
    3030- (void)viewDidLoad 
     
    142142        [signalConverter stopProcessing]; 
    143143        [self resetViews]; 
     144    } else if (!signalConverter.isVolumeMax) { 
     145        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Turn Up The Volume" message:@"Your device volume must be at the maximum for proper operation" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 
     146        [alert show]; 
    144147    } else if (!signalConverter.isBluetoothReady) { 
    145148        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Device not found" message:@"No Bluetooth device detected. Ensure Bluetooth is on and the Mindwave headset is paired" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 
    146         [alert show]; 
    147     } else if (!signalConverter.isVolumeMax) { 
    148         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Turn Up The Volume" message:@"Your device volume must be at the maximum for proper operation" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 
    149149        [alert show]; 
    150150    } else if ([signalConverter startProcessing]) { 
     
    157157} 
    158158 
     159- (IBAction) testButtonPressed:(id) sender { 
     160    if (signalConverter.running) { 
     161        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Stop test sound" message:@"Press Stop first to end the test" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 
     162        [alert show]; 
     163    } else { 
     164        if (signalConverter.testing) { 
     165            testButton.title = @"Test"; 
     166            [signalConverter stopTestSound]; 
     167        } else { 
     168            testButton.title = @"Stop"; 
     169            [signalConverter playTestSound]; 
     170        } 
     171    } 
     172} 
     173 
    159174@end 
  • iOS/Orbit/Orbit/controllers/TutorialViewController.m

    rce0a7ee rde10cbc  
    1515- (void)viewDidLoad 
    1616{ 
    17     NSString *file = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]; 
    18     NSString *html = [NSString stringWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil]; 
    19     [webView loadHTMLString:html baseURL:nil]; 
     17    [webView loadRequest: 
     18     [NSURLRequest requestWithURL: 
     19      [NSURL fileURLWithPath: 
     20       [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]]]]; 
    2021    [super viewDidLoad]; 
    2122} 
Note: See TracChangeset for help on using the changeset viewer.