Skip to content

Commit 1ee3620

Browse files
committed
Adds support for sending command line arguments
Closes #16
1 parent 601bbdb commit 1ee3620

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

FRC-Extension/RoboRIOCode/DeployManager.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public async Task DeployCode(string teamNumber, SettingsPageGrid page, bool debu
8686
return;
8787
}
8888
OutputWriter.Instance.WriteLine("Successfully Deployed Files. Starting Code.");
89-
await UploadCode(codeReturn.RobotExe, page, debug);
89+
await UploadCode(codeReturn.RobotExe, page, debug, robotProject);
9090
OutputWriter.Instance.WriteLine("Successfully started robot code.");
9191
}
9292
else
@@ -164,7 +164,7 @@ public async Task<CodeReturnStruct> BuildAndPrepareCode(bool debug, Project robo
164164
string robotExe = Path.GetFileName(path);
165165
string buildDir = Path.GetDirectoryName(path);
166166

167-
167+
168168
writer.WriteLine("Parsing Robot Files");
169169
//While connecting, parse all of the output files.
170170
List<string> files = new List<string>();
@@ -209,6 +209,19 @@ await Task.Run(() =>
209209
}
210210
}
211211

212+
public string GetCommandLineArguments(Project robotProject)
213+
{
214+
var settings = (SettingsPageGrid)Frc_ExtensionPackage.Instance.PublicGetDialogPage(typeof(SettingsPageGrid));
215+
if (!settings.ConsoleArgs)
216+
{
217+
return "";
218+
}
219+
220+
Configuration configuration = robotProject.ConfigurationManager.ActiveConfiguration;
221+
222+
return (string) configuration.Properties.Item("StartArguments").Value;
223+
}
224+
212225
public async Task<bool> DeployRobotFiles(List<string> files)
213226
{
214227
OutputWriter.Instance.WriteLine("Deploying robot files");
@@ -270,7 +283,7 @@ internal string GetAssemblyPath(Project vsProject)
270283
return assemblyPath;
271284
}
272285

273-
public async Task UploadCode(string robotName, SettingsPageGrid page, bool debug)
286+
public async Task UploadCode(string robotName, SettingsPageGrid page, bool debug, Project robotProject)
274287
{
275288
if (page.Netconsole)
276289
{
@@ -289,12 +302,14 @@ public async Task UploadCode(string robotName, SettingsPageGrid page, bool debug
289302
deployedCmdFrame = DeployProperties.RobotCommandFileName;
290303
}
291304

305+
string args = GetCommandLineArguments(robotProject);
306+
292307
//Must be run as admin, so is seperate
293308
await RoboRIOConnection.RunCommand("killall -q netconsole-host || :", ConnectionUser.Admin);
294309

295310
//Combining all other commands, since they should be safe running together.
296311
List<string> commands = new List<string>();
297-
commands.Add($"echo {deployedCmd} > {DeployProperties.CommandDir}/{deployedCmdFrame}");
312+
commands.Add($"echo {deployedCmd} {args} > {DeployProperties.CommandDir}/{deployedCmdFrame}");
298313
if (debug)
299314
{
300315
commands.AddRange(DeployProperties.DebugFlagCommand);

FRC-Extension/Settings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class SettingsPageGrid : DialogPage
2222
[Category("Team Options"), DisplayName("Auto Start Netconsole"), Description("Auto start the netconsole viewer when running code")]
2323
public bool Netconsole { get; set; }
2424

25+
[Category("Robot Options"), DisplayName("Send Command Line Arguments"), Description("Sends the command line arguments for the project to the robot.")]
26+
public bool ConsoleArgs { get; set; }
27+
2528
[Category("Extension Options"), DisplayName("Enable Verbose Output"), Description("Enables verbose output during the deploy process")]
2629
public bool Verbose { get; set; }
2730

0 commit comments

Comments
 (0)