Changeset 2246ba0 in orbit


Ignore:
Timestamp:
01/02/14 09:22:48 (6 years ago)
Author:
Steve Castellotti <sc@…>
Branches:
master, Servo
Children:
fc960da
Parents:
c1a500d
Message:
Location:
iOS/Orbit/Orbit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • iOS/Orbit/Orbit/SignalConverter.h

    rb094d6c r2246ba0  
    3232} 
    3333 
     34//@property (nonatomic, retain) [NSArray arrayWithObjects:[NSNumber numberWithFloat:6.9]] *rawEEG; 
     35//Number[] rawEEG = new Number[512]; 
     36 
     37//@property (nonatomic, retain) [NSArray arrayWithObjects:[NSNumber numberWithFloat:6.9]] *historyAttention; 
     38 
     39//@property (nonatomic, retain) NSArray *rawEEG; 
     40//@property (nonatomic, retain) NSArray *historyAttention; 
     41//@property (nonatomic, retain) NSArray *historyMeditation; 
     42 
     43//@property (nonatomic, retain) int historyAttention[30]; 
     44//@property (nonatomic, retain) historyMeditation; 
     45 
    3446@property (weak) id <SignalConverterDelegate> delegate; 
    3547@property (nonatomic) float attentionThreshold; 
  • iOS/Orbit/Orbit/SignalConverter.m

    r16249e0 r2246ba0  
    3131    int signalStrength, attentionLevel, meditationLevel; // the latest readings from the headset 
    3232    int yaw, throttle, pitch; 
     33     
     34    int historyAttention[30]; 
     35    int historyAttentionIndex; 
     36    int historyMeditation[30]; 
     37    int historyMeditationIndex; 
     38     
     39//    _historyAttention = [NSArray arrayWithObjects:[NSNumber numberWithFloat:6.9]]; 
     40     
     41 
     42     
    3343} 
    3444 
     
    5161        pitch = 31; 
    5262         
     63        historyAttentionIndex = 0; 
     64        historyMeditationIndex = 0; 
     65         
    5366        // initialise the audio session - this should only be done once 
    5467        AudioSessionInitialize(NULL, NULL, NULL, NULL); 
    5568        AudioSessionSetActive(YES); 
     69         
     70//        NSArray *tempFood = [[NSArray alloc] initWithArray:[self returnOtherArray]]; 
     71//        NSArray *tempFood = [[NSArray alloc] arrayWithObjects:[NSNumber numberWithFloat:6.9]]]; 
     72         
     73//        _historyAttention = tempFood; 
    5674         
    5775#if USE_AUDIO_GENERATOR 
     
    110128    [self setAttentionLevel:(NSNumber *)[data valueForKey:ATTENTION_KEY]]; 
    111129    [self setMeditationLevel:(NSNumber *)[data valueForKey:MEDITATION_KEY]]; 
     130     
     131    historyAttention[historyAttentionIndex] = attentionLevel; 
     132    historyMeditation[historyMeditationIndex] = meditationLevel; 
     133     
     134    historyAttentionIndex = historyAttentionIndex + 1; 
     135    historyMeditationIndex = historyMeditationIndex + 1; 
     136     
     137    if (historyAttentionIndex == 30) { 
     138        NSLog(@"Attention Array Full"); 
     139        historyAttentionIndex = 0; 
     140        historyMeditationIndex = 0; 
     141         
     142        for (int i=0; i<30; i++){ 
     143            NSLog(@"%d: %d", i, historyAttention[i]); 
     144        } 
     145         
     146    } 
     147     
    112148} 
    113149 
  • iOS/Orbit/Orbit/controllers/FlightViewController.m

    rc6dde93 r2246ba0  
    1515#import "SignalConverter.h" 
    1616 
     17#import "StatisticsViewController.h" 
     18 
    1719#define STATUS_DEFAULT 0 
    1820#define STATUS_CONNECTING 1 
     
    187189    
    188190   //   NSLog(@"Available fonts: %@", [UIFont familyNames]); 
     191    
     192//   StatisticsViewController *statisticsViewController=[[StatisticsViewController alloc] init]; 
     193//   [statisticsViewController.graphBottom reloadData]; 
    189194    
    190195   [signalConverter isAudioJackPlugged]; 
  • iOS/Orbit/Orbit/controllers/StatisticsViewController.h

    rc1a500d r2246ba0  
    2222@property (nonatomic, strong) CPTGraphHostingView *hostViewBottom; 
    2323 
     24@property CPTGraph *graphTop; 
     25@property CPTGraph *graphBottom; 
     26 
     27 
     28//-(void)reloadData; 
     29 
    2430- (NSArray *)secondsInHistory; 
    2531 
  • iOS/Orbit/Orbit/controllers/StatisticsViewController.m

    rc1a500d r2246ba0  
    4545   [self configurePlots]; 
    4646   [self configureAxes]; 
     47   // Block for .5 seconds 
     48//   [NSThread sleepForTimeInterval:5]; 
     49//   [self reloadData]; 
    4750} 
    4851 
     
    7679        self.hostView.hostedGraph = graphTop; 
    7780    
    78  
     81    
    7982        // Bottom graph 
    8083        CPTGraph *graphBottom = [[CPTXYGraph alloc] initWithFrame:self.hostViewBottom.bounds]; 
     
    216219        CPTMutableLineStyle *powerSymbolLineStyle = [CPTMutableLineStyle lineStyle]; 
    217220        powerSymbolLineStyle.lineColor = powerColor; 
    218 //      CPTPlotSymbol *powerSymbol = [CPTPlotSymbol ellipsePlotSymbol]; 
    219 //      powerSymbol.fill = [CPTFill fillWithColor:powerColor]; 
    220 //      powerSymbol.lineStyle = powerSymbolLineStyle; 
    221 //      powerSymbol.size = CGSizeMake(3.0f, 3.0f); 
    222 //      powerPlot.plotSymbol = powerSymbol; 
     221   //   CPTPlotSymbol *powerSymbol = [CPTPlotSymbol ellipsePlotSymbol]; 
     222   //   powerSymbol.fill = [CPTFill fillWithColor:powerColor]; 
     223   //   powerSymbol.lineStyle = powerSymbolLineStyle; 
     224   //   powerSymbol.size = CGSizeMake(3.0f, 3.0f); 
     225   //   powerPlot.plotSymbol = powerSymbol; 
    223226    
    224227} 
     
    335338        NSInteger majorIncrement = 100; 
    336339        NSInteger minorIncrement = 50; 
    337         CGFloat yMax = 700.0f;  // should determine dynamically based on max price 
     340        CGFloat yMax = 700.0f;  // should determine dynamically based on max value 
    338341        NSMutableSet *yLabels = [NSMutableSet set]; 
    339342        NSMutableSet *yMajorLocations = [NSMutableSet set]; 
     
    381384                         
    382385                case CPTScatterPlotFieldY: 
    383          //         return [NSDecimalNumber one]; 
    384386         if (index < valueCount) { 
    385                                 return [NSNumber numberWithUnsignedInteger:index]; 
     387            //         return [NSDecimalNumber one]; 
     388            //                          return [NSNumber numberWithUnsignedInteger:index]; 
     389            return [[NSNumber alloc]initWithInt:(random() % 100)]; 
    386390         } 
    387391          
     
    389393        } 
    390394        return [NSDecimalNumber zero]; 
     395} 
     396 
     397-(void)reloadData 
     398{ 
     399   [self.graphTop reloadData]; 
     400   [self.graphBottom reloadData]; 
    391401} 
    392402 
Note: See TracChangeset for help on using the changeset viewer.