diff --git a/Source/SerialInterface.h b/Source/SerialInterface.h index 331143e2f2..acaa25d8eb 100644 --- a/Source/SerialInterface.h +++ b/Source/SerialInterface.h @@ -10,7 +10,7 @@ int init_port (int baud); int read_sensors(int first_measurement, float * avg_adc_channels, int * adc_channels, int * samples_averaged, int * LED_state); #define NUM_CHANNELS 6 -#define SERIAL_PORT_NAME "/dev/tty.usbmodemfd131" +#define SERIAL_PORT_NAME "/dev/tty.usbmodem411" // Acceleration sensors, in screen/world coord system (X = left/right, Y = Up/Down, Z = fwd/back) #define ACCEL_X 4 diff --git a/Source/oscilloscope.cpp b/Source/oscilloscope.cpp new file mode 100644 index 0000000000..a589906322 --- /dev/null +++ b/Source/oscilloscope.cpp @@ -0,0 +1,30 @@ +// +// oscilloscope.cpp +// interface +// +// Created by Philip on 1/28/13. +// Copyright (c) 2013 Rosedale Lab. All rights reserved. +// + +#include "oscilloscope.h" + +Oscilloscope::Oscilloscope(int w, + int h) { + width = w; + height = h; + data = new float[width]; + for (int i = 0; i < width; i++) { + data[i] = 0.0; + } + current_sample = 0; +} + +void Oscilloscope::addData(float d) { + data[current_sample++] = d; +} + +void Oscilloscope::render() { + glBegin(GL_LINES); + //glVertex2f( + glEnd(); +} \ No newline at end of file diff --git a/Source/oscilloscope.h b/Source/oscilloscope.h new file mode 100644 index 0000000000..2a9edf8cee --- /dev/null +++ b/Source/oscilloscope.h @@ -0,0 +1,30 @@ +// +// oscilloscope.h +// interface +// +// Created by Philip on 1/28/13. +// Copyright (c) 2013 Rosedale Lab. All rights reserved. +// + +#ifndef __interface__oscilloscope__ +#define __interface__oscilloscope__ + +#include "glm.hpp" +#include "util.h" +#include "world.h" +#include +#include + +class Oscilloscope { +public: + Oscilloscope(int width, + int height); + void addData(float data); + void render(); +private: + int width; + int height; + float * data; + int current_sample; +}; +#endif /* defined(__interface__oscilloscope__) */ diff --git a/Source/util.cpp b/Source/util.cpp index d33ac70c66..9bd3df2590 100644 --- a/Source/util.cpp +++ b/Source/util.cpp @@ -29,8 +29,6 @@ float angle_to(glm::vec3 head_pos, glm::vec3 source_pos, float render_yaw, float return atan2(head_pos.x - source_pos.x, head_pos.z - source_pos.z) * 180 / PI + render_yaw + head_yaw; } - - void render_vector(glm::vec3 * vec) { // Show edge of world diff --git a/interface.xcodeproj/project.pbxproj b/interface.xcodeproj/project.pbxproj index ebc198df7c..c5ae3b0d68 100644 --- a/interface.xcodeproj/project.pbxproj +++ b/interface.xcodeproj/project.pbxproj @@ -59,6 +59,7 @@ B6BDADE415F44AC7002A07DF /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6BDADDC15F444D3002A07DF /* AudioUnit.framework */; }; D40BDFD513404BA300B0BE1F /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D40BDFD413404BA300B0BE1F /* GLUT.framework */; }; D40BDFD713404BB300B0BE1F /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D40BDFD613404BB300B0BE1F /* OpenGL.framework */; }; + D477AEAC16B7696200F3F8F6 /* oscilloscope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D477AEAA16B7696200F3F8F6 /* oscilloscope.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -513,6 +514,8 @@ B6BDADDE15F444DB002A07DF /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; D40BDFD413404BA300B0BE1F /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = /System/Library/Frameworks/GLUT.framework; sourceTree = ""; }; D40BDFD613404BB300B0BE1F /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; + D477AEAA16B7696200F3F8F6 /* oscilloscope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = oscilloscope.cpp; sourceTree = ""; }; + D477AEAB16B7696200F3F8F6 /* oscilloscope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = oscilloscope.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -623,6 +626,8 @@ 5325C24B16AF4DBE0051A40B /* texture.cpp */, 5325C24C16AF4DBE0051A40B /* texture.h */, 5325C24D16AF4DBE0051A40B /* util.cpp */, + D477AEAA16B7696200F3F8F6 /* oscilloscope.cpp */, + D477AEAB16B7696200F3F8F6 /* oscilloscope.h */, 5325C24E16AF4DBE0051A40B /* util.h */, 5325C24F16AF4DBE0051A40B /* world.h */, ); @@ -1364,6 +1369,7 @@ 5325C26016AF4DBE0051A40B /* texture.cpp in Sources */, 5325C26116AF4DBE0051A40B /* util.cpp in Sources */, 5325C26416AF4E2C0051A40B /* audio.cpp in Sources */, + D477AEAC16B7696200F3F8F6 /* oscilloscope.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/interface.xcodeproj/project.xcworkspace/xcuserdata/philip.xcuserdatad/UserInterfaceState.xcuserstate b/interface.xcodeproj/project.xcworkspace/xcuserdata/philip.xcuserdatad/UserInterfaceState.xcuserstate index 0cd3691198..325c38ce91 100644 Binary files a/interface.xcodeproj/project.xcworkspace/xcuserdata/philip.xcuserdatad/UserInterfaceState.xcuserstate and b/interface.xcodeproj/project.xcworkspace/xcuserdata/philip.xcuserdatad/UserInterfaceState.xcuserstate differ