Skip to content
This repository has been archived by the owner on Sep 17, 2022. It is now read-only.

Commit

Permalink
FInish commit changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Serenity committed Aug 16, 2021
1 parent d51dc9e commit cc82baf
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 8 deletions.
15 changes: 8 additions & 7 deletions Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 129 additions & 0 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ private void Form1_Load(object sender, EventArgs e)
// start receive connection timer
tmrUpdateConnectionData.Start();

// Reset stream file data / populate with NaN values
dumpStreamDefaults();

// ## Diable in dev ##
// check for application updates
tmrCheckForUpdates.Enabled = true;
tmrCheckForUpdates.Start();
Expand Down Expand Up @@ -160,6 +164,9 @@ private void tsConnect_Click(object sender, EventArgs e)

// Reset value labels
resetValueLabels();

// Reset stream values
//dumpStreamDefaults();
break;
default:
// No connection has been made to the remote server
Expand Down Expand Up @@ -1118,6 +1125,119 @@ private void streamToFiles()

#endregion

#region Reset stream files data

private void dumpStreamDefaults()
{
// Define base location for data fields
string defaultDirectory = System.Windows.Forms.Application.StartupPath + "/stream/";

// Define sub-directories
string printerDir = "printer/";
string tempDir = "temp/";
string progressDir = "progress/";
string displayLayerProgressDir = "displayLayerProgress/";

#region Printer

// Check for file: printerStatus
if (System.IO.File.Exists(defaultDirectory + printerDir + "printerStatus.txt") == true)
{
// File exists, stream data to file
System.IO.StreamWriter printerStatus = new System.IO.StreamWriter(defaultDirectory + printerDir + "printerStatus.txt");
printerStatus.Write("Not connected");
printerStatus.Close();
}

// Check for file: printerFile
if (System.IO.File.Exists(defaultDirectory + printerDir + "printerFile.txt") == true)
{
// File exists, stream data to file
System.IO.StreamWriter printerFile = new System.IO.StreamWriter(defaultDirectory + printerDir + "printerFile.txt");
printerFile.Write("NaN");
printerFile.Close();
}

#endregion

#region Temp

// Check for file: tempStatusHotend
if (System.IO.File.Exists(defaultDirectory + tempDir + "tempStatusHotend.txt") == true)
{
// File exists, stream data to file
System.IO.StreamWriter tempStatusHotend = new System.IO.StreamWriter(defaultDirectory + tempDir + "tempStatusHotend.txt");
tempStatusHotend.Write("NaN");
tempStatusHotend.Close();
}

// Check for file: tempStatusBed
if (System.IO.File.Exists(defaultDirectory + tempDir + "tempStatusBed.txt") == true)
{
// File exists, stream data to file
System.IO.StreamWriter tempStatusBed = new System.IO.StreamWriter(defaultDirectory + tempDir + "tempStatusBed.txt");
tempStatusBed.Write("NaN");
tempStatusBed.Close();
}

#endregion

#region Progress

// Check for file: printProgressCompleted
if (System.IO.File.Exists(defaultDirectory + progressDir + "printProgressCompleted.txt") == true)
{
// File exists, stream data to file
System.IO.StreamWriter printProgressCompleted = new System.IO.StreamWriter(defaultDirectory + progressDir + "printProgressCompleted.txt");
printProgressCompleted.Write("NaN");
printProgressCompleted.Close();
}

// Check for file: printProgressElasped
if (System.IO.File.Exists(defaultDirectory + progressDir + "printProgressElasped.txt") == true)
{
// File exists, stream data to file
System.IO.StreamWriter printProgressElasped = new System.IO.StreamWriter(defaultDirectory + progressDir + "printProgressElasped.txt");
printProgressElasped.Write("NaN");
printProgressElasped.Close();
}

// Check for file: printProgressLeft
if (System.IO.File.Exists(defaultDirectory + progressDir + "printProgressLeft.txt") == true)
{
// File exists, stream data to file
System.IO.StreamWriter printProgressLeft = new System.IO.StreamWriter(defaultDirectory + progressDir + "printProgressLeft.txt");
printProgressLeft.Write("NaN");
printProgressLeft.Close();
}

#endregion

#region DisplayLayerProgress

// Check for file: layerStatus
if (System.IO.File.Exists(defaultDirectory + displayLayerProgressDir + "layerStatus.txt") == true)
{
// File exists, stream data to file
System.IO.StreamWriter layerStatus = new System.IO.StreamWriter(defaultDirectory + displayLayerProgressDir + "layerStatus.txt");
layerStatus.Write("NaN");
layerStatus.Close();
}

// Check for file: fanSpeed
if (System.IO.File.Exists(defaultDirectory + displayLayerProgressDir + "fanSpeed.txt") == true)
{
// File exists, stream data to file
System.IO.StreamWriter fanSpeed = new System.IO.StreamWriter(defaultDirectory + displayLayerProgressDir + "fanSpeed.txt");
fanSpeed.Write("NaN");
fanSpeed.Close();
}

#endregion
}

#endregion

#region Application Update Check

private void tmrCheckForUpdates_Tick(object sender, EventArgs e)
Expand Down Expand Up @@ -1185,5 +1305,14 @@ private void githubIssuesRequestsToolStripMenuItem_Click(object sender, EventArg
}
#endregion

#region Form Closing

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
// Reset all stream values before closing the application
dumpStreamDefaults();
}

#endregion
}
}
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Octo_Streamer
static class Program
{
// Define application version
public static string ApplicationVersion = "v0.0.1";
public static string ApplicationVersion = "v0.0.2";

[STAThread]
static void Main()
Expand Down

0 comments on commit cc82baf

Please sign in to comment.