Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
],
"intelliSenseMode": "gcc-x64",
"includePath": [
"C:\\Users\\swp791\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino",
"C:\\Users\\swp791\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega",
"C:\\Users\\swp791\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.7\\cores\\arduino",
"C:\\Users\\swp791\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.7\\variants\\mega",
"c:\\users\\swp791\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\lib\\gcc\\avr\\7.3.0\\include",
"c:\\users\\swp791\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\lib\\gcc\\avr\\7.3.0\\include-fixed",
"c:\\users\\swp791\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\avr\\include"
],
"forcedInclude": [
"C:\\Users\\swp791\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino\\Arduino.h"
"C:\\Users\\swp791\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.7\\cores\\arduino\\Arduino.h"
],
"cStandard": "c11",
"cppStandard": "c++11",
Expand Down
16 changes: 10 additions & 6 deletions mainCode/logData.pde
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ public void initLogFile() {
textFieldFileDirInput = textFieldFileDir.getText() + OsDirChar;
fileDirectory = textFieldFileDirInput + fileNameInput + ".log";
fileDirectoryReplaced = fileDirectory.replace("\\", "/");

try {
File logFile = new File(fileDirectoryReplaced);
// Creating File
if (logFile.createNewFile()) {
logFileExists = false;
textAreaMainMsg("\n", "File created: " + textFieldFileDirInput + logFile.getName(), "");
systemPrintln("File created: " + textFieldFileDirInput + logFile.getName());
} else {
textAreaMainMsg("\n", "File already exists. ", "");
systemPrintln("File already exists.");
} else if (logFile.exists()) {
logFileExists = true;
textAreaMainMsg("\n", "File already exists: " + textFieldFileDirInput + logFile.getName(), "");
systemPrintln("File already exists: " + textFieldFileDirInput + logFile.getName());
}
}
catch (IOException e) {
Expand All @@ -22,8 +25,7 @@ public void initLogFile() {
}

try {
//create file writer
Writer = new FileWriter(fileDirectoryReplaced);
Writer = new FileWriter(fileDirectoryReplaced, true);
initLogFileOk = true;
logData = true;
textAreaMainMsg("\n", "Logging data to. " + fileDirectory, "");
Expand All @@ -38,7 +40,8 @@ public void initLogFile() {
public void writeToFile(String data) {
if (logData == true && dataLogPause == false) {
try {
Writer.write(data);
Writer.append(data);
//Writer.write(data);
Writer.flush();
loggingData = true;
}
Expand All @@ -47,3 +50,4 @@ public void writeToFile(String data) {
}
}
}

5 changes: 3 additions & 2 deletions mainCode/settingsWindowUI.pde
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ void drawLogConfig() {
//action performed event handler
public void actionPerformed(ActionEvent actionEvent) {
if (loggingData == false) {
dataLogPause = false;
initLogFile();
}
systemPrintln("buttonStartLog clicked" + " @ " + millis());
Expand All @@ -461,7 +462,7 @@ void drawLogConfig() {
//action performed event handler
public void actionPerformed(ActionEvent actionEvent) {
try {
if (loggingData) {
if (loggingData || dataLogPause) {
Writer.flush();
Writer.close();
Writer = null;
Expand All @@ -470,7 +471,7 @@ void drawLogConfig() {
loggingData = false;
}
}
catch (IOException e) {
catch (Exception e) {
textAreaMainMsg("\n", "Failed to stop logging data. " + e, "");
}
systemPrintln("buttonStopLog clicked" + " @ " + millis());
Expand Down
3 changes: 2 additions & 1 deletion mainCode/variables.pde
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ int prevCommandsIndex = 0; //count of up key presses for previous command retrie

char selectedParity = 'N'; //serial port parity 'N' for none, 'E' for even, 'O' for odd, 'M' for mark, 'S' for space ('N' is the default)

boolean showDebugStatements = true; //if true show debug statements in console
boolean connectToCOM = false; //if connecting to com port
boolean connectedToCOM = false; //if connected to com port
boolean loggingData = false ; //if logging succeeded
Expand All @@ -28,7 +29,7 @@ boolean portsFound = false;
boolean textAreaMainMsgIsRunning = false;
boolean textFieldSearchHasText = false; //if textFieldSearch has text other than prompt text
boolean serialPortRemoved = false; //if serial port was removed while connected
boolean showDebugStatements = false; //if true show debug statements in console
boolean logFileExists = false; //if log file already exists when creating log file

boolean mainUiInit, settingsUiInit, drawPortConfigInit, drawDataConfigInit, drawLogConfigInit = false; //if UI has been initialized
boolean commandFound = false; //true if entered command is a valid command
Expand Down
Loading