/// <summary> /// Prepares all systems for use by zeroing them. This takes a while. /// </summary> public void InitializeSystems(BBBPinManager.ApplicationMode AppMode) { BBBPinManager.ApplyPinSettings(AppMode); this.RailController.Initialize(); this.TurntableController.Initialize(); this.ToolheadController.Initialize(); this.DrillController.Initialize(); }
private static void ParseArgs(string[] Args) { if (Args == null || Args.Length == 0) { return; } // Nothing to parse. for (int i = 0; i < Args.Length; i++) { if (Args.Length > i + 1) // Dual-part arguments. { if (Args[i] == "-s" || Args[i] == "--server") { IP = Args[i + 1]; i++; } if (Args[i] == "-pt" || Args[i] == "--port-tcp") { PortTCP = int.Parse(Args[i + 1]); i++; } if (Args[i] == "-pu" || Args[i] == "--port-udp") { PortUDP = int.Parse(Args[i + 1]); i++; } if (Args[i] == "-l" || Args[i] == "--log") { if (Args[i + 1].Equals("DEBUG", StringComparison.OrdinalIgnoreCase)) { LogLevel = Log.Severity.DEBUG; i++; } else if (Args[i + 1].Equals("INFO", StringComparison.OrdinalIgnoreCase)) { LogLevel = Log.Severity.INFO; i++; } else if (Args[i + 1].Equals("WARNING", StringComparison.OrdinalIgnoreCase)) { LogLevel = Log.Severity.WARNING; i++; } else { Console.WriteLine("Unknown log level specified. Use 'DEBUG', 'INFO', or 'WARNING'."); i++; } } } // Single-part arguments if (Args[i] == "-?" || Args[i] == "/?" || Args[i] == "-h" || Args[i] == "/h" || Args[i] == "help" || Args[i] == "-help" || Args[i] == "--help") { Console.WriteLine("Command-line paramters:"); Console.WriteLine(" -?|/?|-h|/h|help|-help|--help : Outputs this text."); Console.WriteLine(" -l|--log <Level> : Sets the default log level to 'DEBUG', 'INFO', or 'WARNING'."); Console.WriteLine(" Networking:"); Console.WriteLine(" -s|--server <IP> : Connects to the given server instead of the default."); Console.WriteLine(" -pt|--port-tcp <Port> : Connects to the server via TCP using the given port instead of the default."); Console.WriteLine(" -pu|--port-udp <Port> : Connects to the server via UDP using the given port instead of the default."); Console.WriteLine(" Device Tree (BBB):"); Console.WriteLine(" --no-dt : Do not attempt to remove/add device tree overlays."); Console.WriteLine(" --replace-dt : Remove all Scarlet DT overlays, then apply the new one. DANGEROUS!"); Console.WriteLine(" --add-dt : Add device tree overlay even if there is one already."); } if (Args[i] == "--no-dt") { ApplyDevTree = BBBPinManager.ApplicationMode.NO_CHANGES; } if (Args[i] == "--replace-dt") { ApplyDevTree = BBBPinManager.ApplicationMode.REMOVE_AND_APPLY; } if (Args[i] == "--add-dt") { ApplyDevTree = BBBPinManager.ApplicationMode.APPLY_REGARDLESS; } } }