Skip to content

Commit

Permalink
Add non-shutter optimized version of performPostSlice that will delay…
Browse files Browse the repository at this point in the history
… showing the slice image until after calculations are done
  • Loading branch information
jmkao committed Aug 7, 2016
1 parent 9dc3ed0 commit b7c0fe6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,12 @@ public JobStatus performPreSlice(DataAid aid, List<StlError> errors) throws Inap
return null;
}


public JobStatus performPostSlice(DataAid aid) throws ExecutionException, InterruptedException, InappropriateDeviceException, ScriptException {
return this.performPostSlice(aid, null);
}

public JobStatus performPostSlice(DataAid aid, BufferedImage sliceImage) throws ExecutionException, InterruptedException, InappropriateDeviceException, ScriptException {
if (aid == null) {
throw new IllegalStateException("initializeDataAid must be called before this method");
}
Expand All @@ -171,6 +176,11 @@ public JobStatus performPostSlice(DataAid aid) throws ExecutionException, Interr
aid.printer.getGCodeControl().executeGCodeWithTemplating(aid.printJob, aid.slicingProfile.getgCodeShutter());
}

if (sliceImage != null) {
logger.info("ExposureStart:{}", ()->Log4jTimer.startTimer(EXPOSURE_TIMER));
aid.printer.showImage(sliceImage);
}

//Sleep for the amount of time that we are exposing the resin.
Thread.sleep(aid.printJob.getExposureTime());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Iterator;
import java.util.Map;
import java.util.SortedMap;
Expand All @@ -26,7 +25,7 @@
import org.area515.resinprinter.printer.Printer;
import org.area515.resinprinter.server.Main;
import org.area515.resinprinter.services.PrinterService;
import org.area515.util.Log4jTimer;
//import org.area515.util.Log4jTimer;

import se.sawano.java.text.AlphanumericComparator;

Expand Down Expand Up @@ -112,11 +111,11 @@ public JobStatus processFile(PrintJob printJob) throws Exception {
currentImageByJob.put(printJob, imageData);

//Start the exposure timer
logger.info("ExposureStart:{}", ()->Log4jTimer.startTimer(EXPOSURE_TIMER));
//logger.info("ExposureStart:{}", ()->Log4jTimer.startTimer(EXPOSURE_TIMER));

dataAid.printer.showImage(imageData.getImage());
//dataAid.printer.showImage(imageData.getImage());

status = performPostSlice(dataAid);
status = performPostSlice(dataAid, imageData.getImage());

if (oldImage != null) {
oldImage.getImage().flush();
Expand Down

0 comments on commit b7c0fe6

Please sign in to comment.