Forced all code to 64-bit only, will make this 32/64 bit before release.

Fixed issue in the SerialProcessor when setting the time, makes sure that there's no chance of thread stealing when pulling out the junk messages
Added ConformanceResult.txt to show the progress of the driver development
This commit is contained in:
2019-04-30 18:52:32 +01:00
parent e339831f0c
commit 90eb1c604b
7 changed files with 209 additions and 22 deletions
@@ -22,5 +22,7 @@ namespace ASCOM.MeadeAutostar497.Controller
char CommandChar(string command);
string ReadTerminated(string terminator);
void Command(string command);
void Lock();
void Unlock();
}
}
+18 -8
View File
@@ -72,7 +72,7 @@ namespace ASCOM.MeadeAutostar497.Controller
public string CommandTerminated(string command, string terminator)
{
serialMutex.WaitOne();
Lock();
try
{
_serialPort.Write(command);
@@ -81,13 +81,13 @@ namespace ASCOM.MeadeAutostar497.Controller
}
finally
{
serialMutex.ReleaseMutex();
Unlock();
}
}
public char CommandChar(string command)
{
serialMutex.WaitOne();
Lock();
try
{
_serialPort.Write(command);
@@ -96,13 +96,13 @@ namespace ASCOM.MeadeAutostar497.Controller
}
finally
{
serialMutex.ReleaseMutex();
Unlock();
}
}
public string ReadTerminated(string terminator)
{
serialMutex.WaitOne();
Lock();
try
{
string result = _serialPort.ReadTo("#");
@@ -110,21 +110,31 @@ namespace ASCOM.MeadeAutostar497.Controller
}
finally
{
serialMutex.ReleaseMutex();
Unlock();
}
}
public void Command(string command)
{
serialMutex.WaitOne();
Lock();
try
{
_serialPort.Write(command);
}
finally
{
serialMutex.ReleaseMutex();
Unlock();
}
}
public void Lock()
{
serialMutex.WaitOne();
}
public void Unlock()
{
serialMutex.ReleaseMutex();
}
}
}
@@ -93,7 +93,7 @@ namespace ASCOM.MeadeAutostar497.Controller
private void TestConnectionActive()
{
var firmwareVersionNumber = SerialPort.CommandTerminated("#:GVN#", "#");
var firmwareVersionNumber = SerialPort.CommandTerminated(":GVN#", "#");
if (string.IsNullOrEmpty(firmwareVersionNumber))
{
throw new InvalidOperationException("Failed to communicate with telescope.");
@@ -106,7 +106,7 @@ namespace ASCOM.MeadeAutostar497.Controller
{
if (!Connected) return false;
var result = SerialPort.CommandTerminated("#:D#", "#");
var result = SerialPort.CommandTerminated(":D#", "#");
return result != string.Empty;
}
}
@@ -115,8 +115,8 @@ namespace ASCOM.MeadeAutostar497.Controller
{
get
{
string telescopeDate = SerialPort.CommandTerminated("#:GC#", "#");
string telescopeTime = SerialPort.CommandTerminated("#:GL#", "#");
string telescopeDate = SerialPort.CommandTerminated(":GC#", "#");
string telescopeTime = SerialPort.CommandTerminated(":GL#", "#");
int month = telescopeDate.Substring(0, 2).ToInteger();
int day = telescopeDate.Substring(3, 2).ToInteger();
@@ -138,21 +138,29 @@ namespace ASCOM.MeadeAutostar497.Controller
set
{
//var result = SerialCommand(":SLHH:MM:SS#", true);
var timeResult = SerialPort.CommandChar($"#:SL{value:hh:mm:ss}#");
var timeResult = SerialPort.CommandChar($":SL{value:hh:mm:ss}#");
if (timeResult != '1')
{
throw new InvalidOperationException("Failed to set local time");
}
var dateResult = SerialPort.CommandChar($"#:SC{value:MM/dd/yy}#");
if (dateResult != '1')
SerialPort.Lock();
try
{
throw new InvalidOperationException("Failed to set local time");
}
var dateResult = SerialPort.CommandChar($":SC{value:MM/dd/yy}#");
if (dateResult != '1')
{
throw new InvalidOperationException("Failed to set local time");
}
//throwing away these two strings which represent
SerialPort.ReadTerminated("#"); //Updating Planetary Data#
SerialPort.ReadTerminated("#"); // #
//throwing away these two strings which represent
SerialPort.ReadTerminated("#"); //Updating Planetary Data#
SerialPort.ReadTerminated("#"); // #
}
finally
{
SerialPort.Unlock();
}
}
}
+1 -1
View File
@@ -46,7 +46,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RegisterForComInterop>true</RegisterForComInterop>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">