Luis Miguel Castro Tenjica / Mbed 2 deprecated 02_LAB_serial_protocol

Dependencies:   mbed

Fork of 02_LAB_serial_protocol by ferney alberto beltran molina

Revision:
8:cd9b52716920
Parent:
7:fab201aa45b7
Child:
9:3a8624147a4c
--- a/main.cpp	Sat Sep 23 14:44:47 2017 +0000
+++ b/main.cpp	Sat Sep 30 14:29:33 2017 +0000
@@ -24,7 +24,7 @@
 
 // COMANDOS 
 #define LED_NC 0
-#define DOT_NC 1
+#define DOT_NC 31
 #define LINE_NC 2
 #define RECTANGLE_NC 3
 #define CICLE_NC 4
@@ -71,19 +71,8 @@
 
 uint8_t check_command()
 {
-       if (buffer_command[BUFF_SIZE-1]== '>'){
-        
-            #if DEBUG
-                command.printf("\nComando:");
-                print_bin2hex(buffer_command[COMM_N]);
-                command.printf(" -> ");
-            #endif
-            return 1;
-        }
-        #if DEBUG
-            command.printf("\n ERROR COMANDO -> ");
-            echo_command();
-        #endif
+       if (buffer_command[BUFF_SIZE-1]== '>')
+             return 1;
         return 0;        
         
      
@@ -151,10 +140,17 @@
             Read_command();
             if (check_command()){
                 command_exe();
+            }else{
                 #if DEBUG
-                 echo_command();
+                    command.printf("\n ERROR COMANDO -> ");
+                    echo_command();
                 #endif
-        }
+            }        
+        }else{
+                #if DEBUG
+                 command.printf("error de inicio de trama: ");
+                 command.putc(val);
+                #endif
         }
         
     }