Skip to content

Commit

Permalink
Fixed FPS Limit function in firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
andymanic committed Dec 10, 2023
1 parent 02b0239 commit b7bea78
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 16 deletions.
21 changes: 12 additions & 9 deletions Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ String firmware = "3.2";
int testRuns = 4;
bool vsync = true;
bool extendedGamma = true;
char fpsLimit = '1';
int fpsLimit = '1';
int USBV = 0;

void ADC_Clocks() // Turns out to be superfluous as Adafruit wiring.c already sets these clocks. Keeping for now to guarantee settings are set.
Expand Down Expand Up @@ -530,12 +530,15 @@ void loop() {
Serial.println(testRuns);
}
else if (input[0] == 'L')
{
fpsLimit = (convertHexToDec(input[1]) * 100) + (convertHexToDec(input[2]) * 10) + convertHexToDec(input[3]);
delay(100);
Serial.print("FPS Key:");
Serial.println(fpsLimit);
}
{
int hundreds = convertHexToDec(input[1]) * 100;
int tens = convertHexToDec(input[2]) * 10;
int ones = convertHexToDec(input[3]);
fpsLimit = hundreds + tens + ones;
delay(100);
Serial.print("FPS Key:");
Serial.println(fpsLimit);
}
else if (input[0] == 'G')
{
runGammaTest();
Expand Down Expand Up @@ -587,8 +590,8 @@ void loop() {
if (buttonState == HIGH) //Run when button pressed
{
Serial.setTimeout(500);
Keyboard.print(fpsLimit);
Keyboard.print(fpsLimit);
Keyboard.print((char)fpsLimit);
Keyboard.print((char)fpsLimit);
// Check USB voltage level
//int voltageTest = checkUSBVoltage();
//if (voltageTest == 0)
Expand Down
4 changes: 2 additions & 2 deletions Hardware/OSRTT_Pro_Code/file2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ SPISettings settingsA(1000000, MSBFIRST, SPI_MODE0);

//Serial connection values
int boardType = 1;
String firmware = "1.7";
String firmware = "1.8";
int testRuns = 4;
bool vsync = true;
bool extendedGamma = true;
char fpsLimit = '1';
int fpsLimit = 49;
bool highspeed = false;

unsigned long loopTimer = millis();
Expand Down
36 changes: 32 additions & 4 deletions Hardware/OSRTT_Pro_Code/file3.ino
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ void loop() {
}
else if (input[0] == 'L')
{
fpsLimit = (convertHexToDec(input[1]) * 100) + (convertHexToDec(input[2]) * 10) + convertHexToDec(input[3]);
int hundreds = convertHexToDec(input[1]) * 100;
int tens = convertHexToDec(input[2]) * 10;
int ones = convertHexToDec(input[3]);
fpsLimit = hundreds + tens + ones;
delay(100);
Serial.print("FPS Key:");
Serial.println(fpsLimit);
Expand Down Expand Up @@ -260,8 +263,8 @@ void loop() {
if (buttonState == HIGH) //Run when button pressed
{
Serial.setTimeout(500);
Keyboard.print(fpsLimit);
Keyboard.print(fpsLimit);
Keyboard.print((char)fpsLimit);
Keyboard.print((char)fpsLimit);
oledFourLines("CHECKING", "FOR", "STROBING", "");
int sample_count = 0;
while (sample_count < 1000)
Expand Down Expand Up @@ -585,9 +588,34 @@ void loop() {
Serial.print("Rotation set as: ");
Serial.println(rotation);
}
else if (input[0] == 'W')
{
delay(1000);
Keyboard.print((char)fpsLimit);
}
else if (input[0] == 'Y')
{
//digitalWrite(2, LOW);
int counter = 0;
digitalPotWrite(0);
while (input[0] != 'X')
{
if (digitalRead(buttonPin))
{
counter *= 2;
if (counter == 0)
{
counter++;
} else if (counter > 128)
{
counter = 0;
}
digitalPotWrite(counter);
Serial.print("Current value:");
Serial.println(counter);
delay(300);
}
delay(10);
}
}
else if (input[0] == 'Z')
{
Expand Down
4 changes: 3 additions & 1 deletion OSRTT Launcher/OSRTT Launcher/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2598,6 +2598,7 @@ private void setFPSLimit()
var item = fpsList.Find(x => x.FPSValue == getSelectedFps());
//var item = fpsList.Find(x => x.FPSValue == Properties.Settings.Default.FPS.ToString()); //Doesn't work, cba to work out why atm.
port.Write("L" + int.Parse(item.Key).ToString("000"));
Console.WriteLine("L" + int.Parse(item.Key).ToString("000"));
}

private void setCaptureTime()
Expand Down Expand Up @@ -3301,7 +3302,8 @@ private void setProgressBar(bool on)
private void testButtonToolStripMenuItemToolStripMenuItem_Click(object sender, EventArgs e)
{
//testRawInput();
port.Write("J");
//port.Write("J");
port.Write("W");
//runDirectXWindow();
}
static void testRawInput()
Expand Down
3 changes: 3 additions & 0 deletions OSRTT Launcher/OSRTT Launcher/OSRTT Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@
<Compile Include="Heatmaps.Designer.cs">
<DependentUpon>Heatmaps.cs</DependentUpon>
</Compile>
<Compile Include="WebServer\WebServer.cs" />
<Compile Include="WebServer\WebSocketServer.cs" />
<EmbeddedResource Include="Gamma.resx">
<DependentUpon>Gamma.cs</DependentUpon>
</EmbeddedResource>
Expand Down Expand Up @@ -373,6 +375,7 @@
<Content Include="DirectX\Font\font01.txt" />
<Content Include="DirectX\Font\fontdata.txt" />
<Content Include="osrttIcon.ico" />
<Content Include="WebServer\responsetime.html" />
<None Include="Resources\arrow-rotate-right.png" />
<None Include="Resources\check.png" />
<None Include="Resources\icon_small.png" />
Expand Down

0 comments on commit b7bea78

Please sign in to comment.