From 55d3dd4eeea85ab2793b80d54ab7060357d73c94 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Mon, 19 Oct 2020 14:09:03 +0200 Subject: [PATCH] actually fixed overflow exception --- ProftaakRH/BikeSimulator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ProftaakRH/BikeSimulator.cs b/ProftaakRH/BikeSimulator.cs index e0d0ccd..dd4be63 100644 --- a/ProftaakRH/BikeSimulator.cs +++ b/ProftaakRH/BikeSimulator.cs @@ -109,7 +109,8 @@ namespace Hardware.Simulators private byte check(int value) { - return value > 255 ? Convert.ToByte(255) : Convert.ToByte(value); + + return value > 255 ? Convert.ToByte(255) : value < 0 ? Convert.ToByte(0) : Convert.ToByte(value); } //Generate an ANT message for BPM