Skip to content

Commit

Permalink
fixed jobmetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
alex9849 committed Dec 26, 2023
1 parent f75c9f5 commit 43c93f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ public void run() {
pump.setPumpedUp(getDirection() == Direction.FORWARD);
}

pump.getMotorDriver().shutdown();
this.stopTime = System.currentTimeMillis();
PumpJobState.RunningState runningState = getRunningState();
this.finishedJobMetrics = getJobMetrics();
this.finishedRunningState = runningState;
pump.getMotorDriver().shutdown();
callback.run();
} catch (InterruptedException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
public class StepperMotorTask extends PumpTask {
StepperPump stepperPump;
long stepsToRun;
long stepsMade;

private AcceleratingStepper driver;


Expand All @@ -30,11 +28,11 @@ public StepperMotorTask(Long prevJobId, StepperPump stepperPump, Direction direc
}

public long getMlPumped() {
return (stepsMade * 10) / stepperPump.getStepsPerCl();
return (getStepsMade() * 10) / stepperPump.getStepsPerCl();
}

public long getStepsMade() {
return stepsMade;
return stepsToRun - Math.abs(driver.distanceToGo());
}

@Override
Expand Down Expand Up @@ -70,8 +68,7 @@ protected void pumpRun() {
@Override
protected PumpJobState.RunningState genRunningState() {
PumpJobState.RunningState runningState = new PumpJobState.RunningState();
long stepsMade = stepsToRun - Math.abs(driver.distanceToGo());
runningState.setPercentage((int) (stepsMade * 100 / stepsToRun));
runningState.setPercentage((int) (getStepsMade() * 100 / stepsToRun));
runningState.setForward(getDirection() == Direction.FORWARD);
runningState.setRunInfinity(isRunInfinity());
runningState.setJobId(getJobId());
Expand Down

0 comments on commit 43c93f7

Please sign in to comment.