From 422cfd80e5e992234e82471b39ca2e0b225fcaeb Mon Sep 17 00:00:00 2001 From: cloud Date: Mon, 22 Feb 2021 18:11:31 +0100 Subject: [PATCH 1/2] readme changes --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 79305a760..503b0cc93 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,19 @@ The figure below illustrates this behavior using an example. 1. As the joystick remains at a positive value, the reference speed is incremented again. 1. However, it reaches the speed limit so in the next step it is not incremented even though the joystick still has a positive value. 1. Later, the joystick is set to a negative position for one time unit, making the reference speed to decrease as well. + +# My Added extra lines + +```bash +#this is how I cloned this repository +git clone https://github.com/Tiegris/base +``` + +Here is a hierarchical list + +- Main category 1 + - sub category 1.1 + - sub category 1.2 +- Main caetogory 2 + + From 19434c0682609530061c915eee37be1b5767b856 Mon Sep 17 00:00:00 2001 From: Tiegris <33226948+Tiegris@users.noreply.github.com> Date: Tue, 2 Mar 2021 11:24:35 +0100 Subject: [PATCH 2/2] lights feature --- .../bme/mit/train/controller/TrainControllerImpl.java | 5 +++++ .../hu/bme/mit/train/interfaces/TrainController.java | 4 ++++ .../java/hu/bme/mit/train/system/TrainSystemTest.java | 11 ++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 06649d278..707db3400 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -7,6 +7,11 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; private int speedLimit = 0; + private boolean lights = false; + + public boolean toggleLights() { return this.lights = !this.lights; } + + public boolean getLights() { return lights; } @Override public void followSpeed() { diff --git a/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java b/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java index c8adca066..613b4affd 100644 --- a/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java +++ b/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java @@ -10,4 +10,8 @@ public interface TrainController { void setJoystickPosition(int joystickPosition); + boolean toggleLights(); + + boolean getLights(); + } diff --git a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java index 04ae3dac0..174ab0490 100644 --- a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java +++ b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java @@ -24,7 +24,16 @@ public void before() { sensor.overrideSpeedLimit(50); } - + + @Test + public void LightsTest() { + Assert.assertFalse(controller.getLights()); + Assert.assertTrue(controller.toggleLights()); + + Assert.assertTrue(controller.getLights()); + Assert.assertFalse(controller.toggleLights()); + } + @Test public void OverridingJoystickPosition_IncreasesReferenceSpeed() { sensor.overrideSpeedLimit(10);