Skip to content

Commit

Permalink
Added live view mode, fixed minor bugs like USB Voltage readout
Browse files Browse the repository at this point in the history
  • Loading branch information
andymanic committed May 24, 2022
1 parent 0051590 commit 0a48ca1
Show file tree
Hide file tree
Showing 11 changed files with 1,396 additions and 76 deletions.
80 changes: 77 additions & 3 deletions Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Keyboard.h"
#include "Mouse.h"
#include <Keyboard.h>
#include <Mouse.h>
#include <SPI.h>
#include <ArduinoUniqueID.h>
#define INPUT_SIZE 2
Expand Down Expand Up @@ -36,7 +36,7 @@ SPISettings settingsA(10000000, MSBFIRST, SPI_MODE0);

//Serial connection values
bool connected = false;
String firmware = "2.4";
String firmware = "2.5";
int testRuns = 4;
bool vsync = true;
bool extendedGamma = true;
Expand Down Expand Up @@ -234,6 +234,7 @@ int checkUSBVoltage(int l) // Check USB voltage is between 4.8V and 5.2V
Serial.print(",");
}
Serial.println();
Serial.println();
ADC1->SWTRIG.bit.START = 0; //Stop ADC
return 1;
}
Expand Down Expand Up @@ -791,5 +792,78 @@ void loop() {
digitalPotWrite(0x80);
}
}
else if (input[0] == 'O')
{
// Brightness Calibration screen
Serial.setTimeout(200);
int mod = input[1] - '0';
int potVal = 165 + mod;
digitalPotWrite(potVal);
Serial.println("LIVE VIEW");
delay(200);
while (input[0] != 'X')
{
for (int i = 0; i < INPUT_SIZE + 1; i++)
{
input[i] = ' ';
}
byte sized = Serial.readBytes(input, INPUT_SIZE);
input[sized] = 0;
if (input[0] == 'P')
{

long startTime = micros();
long currentTime = micros();
long times[16000];
int count = 0;
while (currentTime < (startTime + 3000000))
{
ADC0->SWTRIG.bit.START = 1; //Start ADC
while(!ADC0->INTFLAG.bit.RESRDY); //wait for ADC to have a new value
currentTime = micros();
times[count] = currentTime - startTime;
adcBuff[count] = ADC0->RESULT.reg;
delayMicroseconds(250);
count++;
}
Serial.print("LiveData:");
for (int i = 0; i < count; i++)
{
Serial.print(times[i]);
Serial.print(":");
Serial.print(adcBuff[i]);
Serial.print(",");
}
Serial.println();
Serial.println("End");
}
int in = 0;
if (input[0] <= 57)
{
in = input[0] - '0'; // Convert char to int
}
else
{
in = input[0] - 55;
}

if (in >= 1 && in <= 15)
{
// Increment potentiometer value by multiples of 10 up to 220
int add = 3 * in;
potVal = 165 + add;
digitalPotWrite(potVal);
Serial.print("pot val:");
Serial.println(potVal);
}
else if (in == 0)
{
potVal = 165;
digitalPotWrite(potVal);
Serial.print("pot val:");
Serial.println(potVal);
}
}
}
delay(100);
}
3 changes: 3 additions & 0 deletions OSRTT Launcher/OSRTT Launcher/Heatmaps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public void hideText(bool state)
osSubTitle.Visible = state;
vrrTitle.Visible = state;
vrrSubTitle.Visible = state;
label1.Visible = state;
label5.Visible = state;
label11.Visible = state;
}
public Heatmaps()
{
Expand Down
594 changes: 594 additions & 0 deletions OSRTT Launcher/OSRTT Launcher/LiveView.Designer.cs

Large diffs are not rendered by default.

Loading

0 comments on commit 0a48ca1

Please sign in to comment.