Skip to content

Commit

Permalink
Minor improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
RomekRJM committed Jan 6, 2020
1 parent 4f4538c commit cded56e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
18 changes: 9 additions & 9 deletions Madkomat/lejos/ATM.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private class MotorMovement {
private final NXTRegulatedMotor motor;
private final StopBehaviour stopBehaviour;

public MotorMovement(int speed, int duration, boolean forward,
MotorMovement(int speed, int duration, boolean forward,
NXTRegulatedMotor motor, StopBehaviour stopBehaviour) {
this.speed = speed;
this.duration = duration;
Expand Down Expand Up @@ -53,24 +53,24 @@ public void perform() {
}
}

private final MotorMovement OPEN_HATCH =
private final MotorMovement openHatch =
new MotorMovement(540, 300, false, Motor.A, StopBehaviour.STOP);
private final MotorMovement CLOSE_HATCH =
private final MotorMovement closeHatch =
new MotorMovement(540, 300, true, Motor.A, StopBehaviour.STOP_TO_FLOAT);
private final MotorMovement LOAD_BANKNOTE =
private final MotorMovement loadBanknote =
new MotorMovement(300, 300, false, Motor.C, StopBehaviour.FLOAT);
private final MotorMovement GIVE_BANKNOTE =
private final MotorMovement giveBanknote =
new MotorMovement(360, 1200, false, Motor.C, StopBehaviour.FLOAT);

public void loadBanknotes() {
LOAD_BANKNOTE.perform();
loadBanknote.perform();
}

public void serve() {
OPEN_HATCH.perform();
GIVE_BANKNOTE.perform();
openHatch.perform();
giveBanknote.perform();
sleepCalmly(2500);
CLOSE_HATCH.perform();
closeHatch.perform();
}

public static void sleepCalmly(long millis) {
Expand Down
7 changes: 4 additions & 3 deletions Madkomat/lejos/Madkomat.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Madkomat implements ButtonListener {

private final ATM atm;
private final BTServer btServer;
private static final String EMPTY_LINE = " ";
private static final String EMPTY_LINE = " ";

public Madkomat() {
atm = new ATM();
Expand All @@ -34,8 +34,9 @@ public void start() {

while(true) {
clearScreen();
LCD.drawString("Awaiting connection...", 0, 2);
LCD.drawString("ESCAPE to exit", 0, 4);
LCD.drawString("Awaiting conn.", 0, 2);
LCD.drawString("ESCAPE to exit.", 0, 4);
LCD.drawString("L/R load banknt.", 0, 5);

btServer.initConnection();

Expand Down

0 comments on commit cded56e

Please sign in to comment.