From 66b1b71ac590c88b4e3edf275078c3aeb7fd0ff4 Mon Sep 17 00:00:00 2001
From: Pascal Engeler <engelerp@phys.ethz.ch>
Date: Wed, 11 Sep 2024 12:45:48 +0200
Subject: [PATCH] Fixed boolean bug, fixed number of states

---
 stitch_project/stitch/DistanceUnwrapper.vhd | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/stitch_project/stitch/DistanceUnwrapper.vhd b/stitch_project/stitch/DistanceUnwrapper.vhd
index 7f64de8..df55a19 100644
--- a/stitch_project/stitch/DistanceUnwrapper.vhd
+++ b/stitch_project/stitch/DistanceUnwrapper.vhd
@@ -33,7 +33,7 @@ end DistanceUnwrapper;
 
 architecture Behavioral of DistanceUnwrapper is
 
-type STATE_T is (IDLE_S, STATE1, STATE2, STATE3, STATE4, STATE5, STATE6);
+type STATE_T is (IDLE_S, STATE1, STATE2, STATE3);
 
 signal current_state : STATE_T := IDLE_S;
 
@@ -102,7 +102,7 @@ begin
 				--calculate change to offset here 
 				if calcDelta > maxDelta then
 					--we have wrapped around 
-					if newIsLarger then
+					if newIsLarger = '1' then
 						--went negative
 						currentOffset <= currentOffset + corrDeltaN;
 					else 
@@ -116,7 +116,7 @@ begin
 				newIsLarger <= newIsLarger;
 				calcDelta <= calcDelta;
 				currentDistance <= currentDistance;
-				dr_out <= dr_out;
+				dr_out <= '0';
 				prevDistance <= prevDistance;
 					
 			when STATE2 => 
@@ -127,7 +127,7 @@ begin
 				newIsLarger <= newIsLarger;
 				calcDelta <= calcDelta;
 				currentOffset <= currentOffset;
-				dr_out <= dr_out;
+				dr_out <= '0';
 				prevDistance <= latchedDistance;
 
 			when STATE3 =>
-- 
GitLab