Skip to content

Commit 6200846

Browse files
committed
Fixes #5
I am an idiot, and know beans about mutexes.
1 parent a7e6df5 commit 6200846

File tree

4 files changed

+54
-45
lines changed

4 files changed

+54
-45
lines changed

Software/OpenAstroTracker ASCOM/OAT PC Control/frmMain.Designer.vb

Lines changed: 35 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Software/OpenAstroTracker ASCOM/OAT PC Control/frmMain.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,13 @@ slew is finished.</value>
150150
<metadata name="Timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
151151
<value>17, 17</value>
152152
</metadata>
153+
<metadata name="ToolTipPark.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
154+
<value>106, 17</value>
155+
</metadata>
156+
<metadata name="ToolTipSlew.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
157+
<value>222, 17</value>
158+
</metadata>
159+
<metadata name="ToolTipHalt.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
160+
<value>488, 17</value>
161+
</metadata>
153162
</root>

Software/OpenAstroTracker ASCOM/OAT PC Control/frmMain.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Public Class frmMain
4040

4141
lblVersion.Text = driver.Action("Telescope:getFirmwareVer","")
4242

43-
'Timer1.Enabled = True
43+
Timer1.Enabled = True
4444
End If
4545
SetUIState()
4646

Software/OpenAstroTracker ASCOM/OpenAstroTracker ASCOM/Driver.vb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Public Class Telescope
7474
Private objSerial As ASCOM.Utilities.Serial
7575
Private isParked As Boolean = False
7676

77+
Dim mutexBlind As Mutex, mutexCommand As Mutex
78+
7779
'
7880
' Constructor - Must be public for COM registration!
7981
'
@@ -149,9 +151,8 @@ Public Class Telescope
149151

150152
Public Sub CommandBlind(ByVal Command As String, Optional ByVal Raw As Boolean = False) Implements ITelescopeV3.CommandBlind
151153
CheckConnected("CommandBlind")
152-
Dim webMutex As Mutex ' Very simple multithreading for now.
153-
webMutex = New Mutex(False, "RRMutex")
154-
webMutex.WaitOne()
154+
mutexBlind = New Mutex(False, "CommMutex")
155+
mutexBlind.WaitOne()
155156
If Not Raw Then
156157
Command = Command + "#"
157158
End If
@@ -161,7 +162,7 @@ Public Class Telescope
161162
Catch ex As Exception
162163
TL.LogMessage("CommandBlind(" + Command + ")", "Error : " + ex.Message)
163164
Finally
164-
webMutex.ReleaseMutex()
165+
mutexBlind.ReleaseMutex()
165166
End Try
166167
End Sub
167168

@@ -178,9 +179,8 @@ Public Class Telescope
178179
Implements ITelescopeV3.CommandString
179180
Dim response As String
180181
CheckConnected("CommandString")
181-
Dim webMutex As Mutex ' Very simple multithreading for now.
182-
webMutex = New Mutex(False, "RRMutex")
183-
webMutex.WaitOne()
182+
mutexCommand = New Mutex(False, "CommMutex")
183+
mutexCommand.WaitOne()
184184
If Not Raw Then
185185
Command = Command + "#"
186186
End If
@@ -203,7 +203,7 @@ Public Class Telescope
203203
TL.LogMessage("CommandString(" + Command + ")", ex.Message)
204204
Return "255"
205205
Finally
206-
webMutex.ReleaseMutex()
206+
mutexCommand.ReleaseMutex()
207207
End Try
208208
End Function
209209

@@ -728,7 +728,7 @@ Public Class Telescope
728728
If Not AtPark Then
729729
TL.LogMessage("SlewToCoordinates", "RA " + RightAscension.ToString + ", Dec " + Declination.ToString)
730730
Dim strRAcmd = ":Sr" + utilities.HoursToHMS(RightAscension, ":", ":")
731-
Dim strDeccmd = utilities.DegreesToDMS(Declination, "*", ":")
731+
Dim strDeccmd = utilities.DegreesToDMS(Declination, "*", ":", "")
732732
If Declination < 0 Then
733733
strDeccmd = "-" + strDeccmd
734734
Else

0 commit comments

Comments
 (0)