-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ionut Muthi <[email protected]>
- Loading branch information
1 parent
e7f94f0
commit bcbe098
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//This import paht is relative to where scopy is build | ||
importFileContent("../JS/scpyDefaultJsFunctions.js") | ||
importFileContent("../plugins/datalogger/JS/dataLoggerFunctions.js") | ||
|
||
function dataLogAndLoadTest(){ | ||
//TODO REPLACE WITH VAR | ||
const filePath = "../plugins/datalogger/JS/test.csv" | ||
|
||
printToConsole("FILE IS " + filePath) | ||
|
||
//CONNECT TO EMU | ||
connect() | ||
|
||
msleep(1000) | ||
//TEST DATA LOGGER | ||
printToConsole(datalogger.showAvailableMonitors()) | ||
|
||
//CREATE NEW TOOL | ||
msleep(1000) | ||
var tool = "DataLogger 0" | ||
|
||
if (tool !== "") { | ||
//GET 2 CHANNELS OF THE TOOL | ||
scopy.switchTool(tool) | ||
var selectedMonitors = getMonitors(tool) | ||
printToConsole("Monitors : " + selectedMonitors) | ||
//LOG DATA ON THE TOOL CHANNELS | ||
logData(tool, filePath, selectedMonitors) | ||
msleep(1000) | ||
//LOAD DATA FOR THE TOOL CHANNELS | ||
loadData(tool, filePath, selectedMonitors) | ||
msleep(1000) | ||
} | ||
disconnect() | ||
} | ||
|
||
dataLogAndLoadTest() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* log data test */ | ||
function logData(tool, filePath, selectedMonitors) { | ||
datalogger.enableMonitorOfTool(tool, selectedMonitors[0]) | ||
datalogger.enableMonitorOfTool(tool, selectedMonitors[1]) | ||
datalogger.clearData() | ||
msleep(500) | ||
datalogger.setRunning(true) | ||
msleep(1000) | ||
datalogger.logAtPathForTool(tool, filePath) | ||
datalogger.continuousLogAtPathForTool(tool, filePath) | ||
msleep(5000) | ||
datalogger.disableMonitorOfTool(tool, selectedMonitors[0]) | ||
datalogger.disableMonitorOfTool(tool, selectedMonitors[1]) | ||
datalogger.setRunning(false) | ||
datalogger.stopContinuousLogForTool(tool) | ||
|
||
printToConsole("Data logged for tool : " + tool + " at :" + filePath) | ||
} | ||
|
||
/* load data test */ | ||
function loadData(tool, filePath, selectedMonitors) { | ||
|
||
datalogger.importDataFromPathForTool(tool, filePath) | ||
msleep(500) | ||
datalogger.enableMonitorOfTool(tool, "Import: test.csv:" + selectedMonitors[0]) | ||
datalogger.enableMonitorOfTool(tool, "Import: test.csv:" + selectedMonitors[1]) | ||
|
||
printToConsole("Data loaded for tool : " + tool + " from :" + filePath) | ||
} | ||
|
||
function getMonitors(tool){ | ||
var monitors = datalogger.showAvailableMonitors() | ||
printToConsole("Monitors list: " + monitors) | ||
var monitorList = monitors.split(/\n/) | ||
var voltage0Monitor = monitorList[2] | ||
printToConsole("Monitor1 : " + voltage0Monitor) | ||
var voltage1Monitor = monitorList[3] | ||
printToConsole("Monitor2 : " + voltage1Monitor) | ||
var selectedMonitors = [] | ||
selectedMonitors[0] = voltage0Monitor | ||
selectedMonitors[1] = voltage1Monitor | ||
|
||
return selectedMonitors | ||
} | ||
|
||
function createTool(deviceID){ | ||
printToConsole("############################### HERE in file ") | ||
var newTool = datalogger.createTool() | ||
if (newTool !== "") { | ||
scopy.switchTool(deviceID, newTool) | ||
printToConsole("New tool created: " + newTool) | ||
} else { | ||
printToConsole("ERROR: Tool creation failed") | ||
exit(1) | ||
} | ||
return "DataLogger 1" | ||
} | ||
|
||
function test(ceva){ | ||
printToConsole("############################### HERE in file test " + ceva) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Time, xadc:voltage0, xadc:voltage1 | ||
10/07/2024 13:59:18, 1.01221, 1.79663 | ||
10/07/2024 13:59:19, 1.0166, 1.79736 | ||
10/07/2024 13:59:20, 1.01953, 1.79956 | ||
10/07/2024 13:59:21, 1.01074, 1.79443 | ||
10/07/2024 13:59:22, 1.01587, 1.79956 | ||
10/07/2024 13:59:23, 1.00781, 1.79663 |