Added ability to read an unterminated buffer when changing slewing precision
This commit is contained in:
@@ -496,15 +496,20 @@ namespace ASCOM.Meade.net
|
|||||||
//“HIGH PRECISION” Current setting after this command.
|
//“HIGH PRECISION” Current setting after this command.
|
||||||
//“LOW PRECISION” Current setting after this command.
|
//“LOW PRECISION” Current setting after this command.
|
||||||
|
|
||||||
|
int throwAwayCharacters = "LOW PRECISION".Length - 1;
|
||||||
|
|
||||||
LogMessage("TogglePrecision", $"Result: {result}");
|
LogMessage("TogglePrecision", $"Result: {result}");
|
||||||
bool highPrecision = false;
|
bool highPrecision = false;
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case "H":
|
case "H":
|
||||||
highPrecision = true;
|
highPrecision = true;
|
||||||
|
throwAwayCharacters = "HIGH PRECISION".Length - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_sharedResourcesWrapper.ReadCharacters(throwAwayCharacters);
|
||||||
|
|
||||||
//Make sure that the buffers are cleared out.
|
//Make sure that the buffers are cleared out.
|
||||||
_sharedResourcesWrapper.SendBlind("#");
|
_sharedResourcesWrapper.SendBlind("#");
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,14 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ReadCharacters(int throwAwayCharacters)
|
||||||
|
{
|
||||||
|
lock (LockObject)
|
||||||
|
{
|
||||||
|
return SharedSerial.ReceiveCounted(throwAwayCharacters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Example of handling connecting to and disconnection from the
|
/// Example of handling connecting to and disconnection from the
|
||||||
/// shared serial port.
|
/// shared serial port.
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
|
|
||||||
void SetupDialog();
|
void SetupDialog();
|
||||||
void WriteProfile(ProfileProperties profileProperties);
|
void WriteProfile(ProfileProperties profileProperties);
|
||||||
|
string ReadCharacters(int throwAwayCharacters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
||||||
@@ -72,6 +73,11 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
return SharedResources.ReadTerminated();
|
return SharedResources.ReadTerminated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string ReadCharacters(int throwAwayCharacters)
|
||||||
|
{
|
||||||
|
return SharedResources.ReadCharacters(throwAwayCharacters);
|
||||||
|
}
|
||||||
|
|
||||||
public ProfileProperties ReadProfile()
|
public ProfileProperties ReadProfile()
|
||||||
{
|
{
|
||||||
return SharedResources.ReadProfile();
|
return SharedResources.ReadProfile();
|
||||||
|
|||||||
Reference in New Issue
Block a user