Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package hu.bme.mit.train.controller;

import java.util.Timer;
import java.util.TimerTask;

import hu.bme.mit.train.interfaces.TrainController;

public class TrainControllerImpl implements TrainController {
Expand All @@ -8,6 +11,20 @@ public class TrainControllerImpl implements TrainController {
private int referenceSpeed = 0;
private int speedLimit = 0;

TrainControllerImpl(){

Timer timer = new Timer();
timer.schedule(new TimerTask() {


//This calls the followSpeed in every 0,1 seconds
@Override
public void run() {
followSpeed();
}
}, 100);
}

@Override
public void followSpeed() {
if (referenceSpeed < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class TrainUserImpl implements TrainUser {
private TrainController controller;
private int joystickPosition;



public TrainUserImpl(TrainController controller) {
this.controller = controller;
}
Expand Down