Mirror actuator for RT2 lab

Dependencies:   FastPWM

Revision:
15:9f32f64eee5b
Parent:
11:d43f8b421d6d
--- a/uart_comm_thread.cpp	Wed Apr 28 12:51:02 2021 +0000
+++ b/uart_comm_thread.cpp	Sun May 02 08:17:06 2021 +0000
@@ -94,7 +94,7 @@
     // returnvalue
     bool retVal = false;
 	uint8_t checksum,k;
-	uint8_t send_state =101;
+	uint16_t send_state =101;
 	while(true)
     	{
         ThisThread::flags_wait_any(threadFlag);
@@ -112,6 +112,9 @@
 			{
 			case 101:
 				send_f_data(101,12,2*4,data.sens_phi);		// send actual phi values (1 and 2)
+				send_state = 1012;
+				break;	
+			case 1012:
 				send_f_data(101,34,2*4,data.est_xy);		// send actual xy values 
 				send_state = 202;
 				break;	
@@ -121,10 +124,10 @@
 				break;
 			case 202:		// desired phi
 				send_f_data(202,12,2*4,data.cntrl_phi_des);
-				send_state = 250;
+				send_state = 125;
 				break;
 			case 125:		// number of iterations in the trafo
-				send_data(125,1,data.num_it);		
+				send_char_data(125,1,data.num_it+50);		
 				send_state = 250;
 				break;
 			case 250:		// send GPA values
@@ -327,9 +330,15 @@
 				{
 				case 1:
 					if(buffer[7] == 1)
+						{
 						mk.trafo_is_on = true;
-					else 
+						send_text((char *)"switched Trafo on");
+						}
+					else
+						{
 						mk.trafo_is_on = false;
+						send_text((char *)"switched Trafo off");
+						}
 					return true;
 					break;
 				}