Hello Malda,
When you first run a new protocol and select the automatically-created default settings file (an empty struct), the launch manager populates BpodSystem.ProtocolSettings with the empty struct.
The settings struct is copied from BpodSystem.ProtocolSettings to SessionData.SettingsFile by AddTrialEvents(), to preserve a snapshot of the settings as they were initially loaded. In your protocol, the call to AddTrialEvents() on line 212 occurs before you replace the empty protocol settings with your protocol's on lines 226-227:
BpodSystem.ProtocolSettings = S;
SaveBpodProtocolSettings;
Since you called SaveBpodProtocolSettings(), your settings struct was written over the empty struct on the disk, so on subsequent sessions the launch manager will copy them into BpodSystem.ProtocolSettings on launch.
This is the expected behavior of the system.
If you'd like the initial settings in your protocol file instead of the file as it was loaded, I'd try moving these two lines to just before your call to AddTrialEvents().
I'd also point out that SessionData.TrialSettings contains a separate record of the settings used to prepare each trial, and may already have the information you're looking for.
Thanks,
Josh