Put a delay in the com tester

Made the sync o print follow the printer better.
This commit is contained in:
Lars Brubaker 2015-01-09 15:49:08 -08:00
parent 5a98936302
commit 3d765929b5
4 changed files with 24 additions and 6 deletions

View file

@ -27,6 +27,7 @@
# This is to test connection and printing. We use it with com0com
# to validate MatterControl under various situations.
from time import sleep
import sys
import argparse
import serial
@ -65,6 +66,7 @@ def main(argv):
if len(line) > 0:
print(line)
response = getCorrectResponse(line)
sleep(0.02)
print response
ser.write(response)
ser.close()

View file

@ -334,7 +334,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private void SetAnimationPosition()
{
int currentLayer = PrinterConnectionAndCommunication.Instance.CurrentlyPrintingLayer;
if (currentLayer >= 0)
if (currentLayer <= 0)
{
selectLayerSlider.Value = 0;
layerRenderRatioSlider.SecondValue = 0;
layerRenderRatioSlider.FirstValue = 0;
}
else
{
selectLayerSlider.Value = currentLayer-1;
layerRenderRatioSlider.SecondValue = PrinterConnectionAndCommunication.Instance.RatioIntoCurrentLayer;

View file

@ -684,7 +684,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
{
if (currentIndex < loadedGCode.IndexOfChangeInZ[zIndex])
{
return zIndex-1;
return zIndex;
}
}
@ -720,11 +720,15 @@ namespace MatterHackers.MatterControl.PrinterCommunication
&& currentIndex < loadedGCode.Count)
{
int currentLayer = CurrentlyPrintingLayer;
int startIndex = loadedGCode.IndexOfChangeInZ[currentLayer];
int endIndex = loadedGCode.Count - 1;
if (currentLayer < loadedGCode.NumChangesInZ - 2)
int startIndex = 0;
if (currentLayer > 0)
{
endIndex = loadedGCode.IndexOfChangeInZ[currentLayer + 1] - 1;
startIndex = loadedGCode.IndexOfChangeInZ[currentLayer-1];
}
int endIndex = loadedGCode.Count - 1;
if (currentLayer < loadedGCode.NumChangesInZ - 1)
{
endIndex = loadedGCode.IndexOfChangeInZ[currentLayer];
}
int deltaFromStart = Math.Max(0, currentIndex - startIndex);

View file

@ -3029,3 +3029,9 @@ Translated:Location: 'Advanced Controls' -> 'Slice Settings' -> 'Filament' -> 'F
English:Save Slice Configuration
Translated:Save Slice Configuration
English:Printing: {0}
Translated:Printing: {0}
English:Finished Print: {0}
Translated:Finished Print: {0}