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
10 changes: 8 additions & 2 deletions src/devices/data_logging/data_logging.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var connection_command = NAN
# called everytime a signal is received from main.gd to save it
func _scene_signal_received(scene_name):
scenes["new"] = scene_name.get_file().split(".")[0].replace("_", "")
# When logging in on, initiate a new file (trial) and update current scene if new
# When logging in on, update current scene if new
if scenes["current"] != scenes["new"]:
# If a trial was in progress (i.e. previous scene is not blank), end it
if scenes["current"] != "":
Expand All @@ -32,7 +32,13 @@ func _scene_signal_received(scene_name):

scenes["current"] = scenes["new"]
update_data()
if logging["current"] == true and Globals.main.has_node("PythonBridge"):

# If new trial is not empty, create one
if (
logging["current"] == true
and scene_name != ""
and Globals.main.has_node("PythonBridge")
):
Globals.main.get_node("PythonBridge").send("create_trial", data, "once")


Expand Down
2 changes: 2 additions & 0 deletions src/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func load_scene(path: String):
func unload_scene():
if _current_scene_node:
_current_scene_node.queue_free()
if (Config.get_value("devices.data_logging.enabled")) == true:
SignalBus.session_scene.emit("")


func _current_scene(_connection):
Expand Down
Loading