Setup Dialog Guide
Relevant source files
The following files were used as context for generating this wiki page:The SettingsForm is a Windows Form that provides a graphical user interface for configuring the Pulsar Dome Driver. It allows users to set up the serial port, logging preferences, integration options like MQTT and GNS, and detailed parameters for the dome's automatic reset functionality. All settings are persisted to the ASCOM profile via the ConfigManager class.
The main driver class DomeDriver invokes this form through its SetupDialog() method, which creates an instance of the form and displays it modally. This ensures that all driver configurations are managed through a centralized and user-friendly interface.
Sources: UI/SettingsForm.cs, Driver/Pulsar_DomeDriver.cs:2020-2029
Architecture and Data Flow
The SettingsForm acts as the view layer for the driver's configuration. It interacts with a ConfigManager instance, which in turn reads from and writes to the ASCOM Profile. This decouples the UI from the direct management of registry settings.
Sources: UI/SettingsForm.cs:10-15, Config/ConfigManager.cs:39-44
This class diagram illustrates the relationship between the key components involved in the setup process.
Loading and Saving Settings
The process of loading and saving settings follows a clear lifecycle managed by the form's event handlers.
- Loading: When the form loads, the
SettingsForm_Loadevent handler is triggered. It populates all UI controls with values retrieved from theConfigManagerproperties. For example, it lists available serial ports and sets the currently configured one. - Saving: When the user clicks the "OK" button (
btnOK_Click), the form reads the current state of all UI controls and writes these values back to the correspondingConfigManagerproperties. TheConfigManagerthen persists them to the ASCOM profile. - Cancelling: Clicking the "Cancel" button (
btnCancel_Click) closes the form without saving any changes.
Sources: UI/SettingsForm.cs:17-82, UI/SettingsForm.cs:84-120
This flowchart shows the data flow when the SettingsForm is loaded.
Sources: UI/SettingsForm.cs:17-82
UI Components and Configuration
The SettingsForm is composed of several sections, each managing a specific aspect of the driver's configuration.
Sources: UI/SettingsForm.Designer.cs
Main Settings
This section covers the primary operational parameters.
| UI Component | ConfigManager Property | Description | Source File |
|---|---|---|---|
comboBoxSerialPort | SerialPort | Selects the COM port for communicating with the dome controller. | UI/SettingsForm.cs:20-33 |
txtBoxLogLocation | LogLocation | Specifies the directory where log files will be saved. | UI/SettingsForm.cs:35 |
btnLog | N/A | Opens a folder browser dialog to select the log file location. | UI/SettingsForm.cs:123-135 |
chkBoxMQTT | UseMQTT | Enables or disables MQTT publishing. | UI/SettingsForm.cs:37 |
chkBoxDebugLog | DebugLog | Enables verbose debug-level logging. | UI/SettingsForm.cs:39 |
chkBoxTraceLog | TraceLog | Enables highly verbose trace-level logging. | UI/SettingsForm.cs:40 |
GNS Integration
The "GNS" group box configures the integration with the Goodnight System (GNS) for notifications.
This diagram shows the UI controls for GNS configuration and their dependencies.
Sources: UI/SettingsForm.cs:162-168, UI/SettingsForm.Designer.cs:642-663
| UI Component | ConfigManager Property | Description | Source File |
|---|---|---|---|
chkBoxGNS | UseGNS | Toggles the GNS integration on or off. | UI/SettingsForm.cs:42 |
txtBoxGNSLocation | GNSPath | Path to the GNS executable. | UI/SettingsForm.cs:44 |
txtBoxGNSDispatherLocation | GNSDispatcherPath | Path to the GNS Dispatcher executable. | UI/SettingsForm.cs:45 |
The SendGNS method in the GNS class uses these paths to dispatch messages via a named pipe.
Sources: GNS/GNS.cs:25-45
Reset Configuration
The "Reset" group box provides extensive options for configuring the automatic hardware reset routines, which are critical for unattended operation.
Sources: UI/SettingsForm.Designer.cs:302-461
Reset Modes and Timeouts
| UI Component | ConfigManager Property | Description | Source File |
|---|---|---|---|
checkBoxInternalReset | SoftReset | Enables the "soft reset" routine, which sends a RESTART command to the controller. | UI/SettingsForm.cs:48 |
checkBoxExternalReset | HardReset | Enables the "hard reset" routine, which uses an external executable to power-cycle the controller. | UI/SettingsForm.cs:49 |
txtBoxShutterTimeout | ShutterTimeout | Timeout in seconds for shutter open/close operations. Stored in ms. | UI/SettingsForm.cs:69 |
txtBoxRotationTimeout | RotationTimeout | Timeout in seconds for dome rotation operations. Stored in ms. | UI/SettingsForm.cs:70 |
txtBoxResetDelay | ResetDelay | Delay in seconds to wait after a hard reset for the controller to initialize. Stored in ms. | UI/SettingsForm.cs:68 |
txtBoxCycleDelay | CycleDelay | Delay in seconds between power-off and power-on commands during a hard reset. Stored in ms. | UI/SettingsForm.cs:71 |
External (Hard) Reset
When checkBoxExternalReset is checked, the controls for configuring the external reset process are enabled. This feature is designed to physically power-cycle the dome controller.
Sources: UI/SettingsForm.cs:137-145
| UI Component | ConfigManager Property | Description |
|---|---|---|
txtBoxExternalExe | ResetExe | The full path to the executable that controls the power switch (e.g., a script for a smart plug). |
btnReset | N/A | Opens a file dialog to select the reset executable. |
txtBoxOnParameters | ResetOnParameters | Command-line arguments to pass to the executable to turn the power ON. |
txtBoxOffParameters | ResetOffParameters | Command-line arguments to pass to the executable to turn the power OFF. |
btnTestResetOn | N/A | A button to test the "power on" command. |
btnTestResetOff | N/A | A button to test the "power off" command. |
The test buttons (btnTestResetOn_Click, btnTestResetOff_Click) directly invoke the specified executable with the corresponding parameters, allowing the user to verify the hard reset mechanism without triggering a full driver reset.
Sources: UI/SettingsForm.cs:189-232
This sequence diagram shows the process of saving the configuration.
Conclusion
The Setup Dialog (SettingsForm) is a vital component of the Pulsar_DomeDriver, providing a comprehensive and user-friendly interface for all driver settings. By leveraging the ConfigManager to interact with the ASCOM profile, it ensures a robust and decoupled architecture for configuration management. The detailed options, particularly for logging and hardware reset, empower users to tailor the driver's behavior for reliable, unattended observatory operation.
Sources: UI/SettingsForm.cs, Config/ConfigManager.cs