Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
30:8dfb6d8de53d
Parent:
29:7246460b73f8
Child:
31:bb5fb28a77df
--- a/prompt.cpp	Wed Sep 24 18:02:18 2014 +0000
+++ b/prompt.cpp	Thu Sep 25 14:37:02 2014 +0000
@@ -12,6 +12,7 @@
 uint8_t debug_sip = 0;
 uint8_t debug_vector = 0;
 uint8_t debug_cb = 0;
+uint8_t debug_main = 0;
 uint8_t pcks_s = 0;
 uint8_t pshowcb = 0;
 
@@ -20,6 +21,7 @@
 
 #define DEBUGBUFSIZE 50
 char debug_buf[DEBUGBUFSIZE];
+char last_debug_buf[ DEBUGBUFSIZE ] = "help";
 FILE *fip, *fmask, *fgate, *fport, *fsip, *fsport, *fext, *fserext;
 uint8_t dog = 1;
 uint8_t debug_prompt = 0;
@@ -219,10 +221,17 @@
 // main prompt process
 void prompt_process(){
     //FIXME dar flush na serial
-    
     volatile char b = 0;
     static uint8_t bufret = 0;
-    
+    static Timer flood_timeout;
+        
+    if( flood_timeout.read() > 60 ){
+        debug_msg("");
+        pflood = 0;
+        flood_timeout.stop();
+        flood_timeout.reset();
+    }
+        
     if ( pc.readable() ){
             // imput do teclado
             b = pc.getc();
@@ -250,6 +259,12 @@
         static unsigned int promptcb_last_ext = 0;                                                                                                                                
         static unsigned int promptcb_last_port = 0;  
         
+        if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) ".",1 )) {
+            miss_match = false;
+            //xmemcpy( (uint)debug_buf, last_debug_buf, 300);
+            strcpy( debug_buf, last_debug_buf );
+        }
+        
         if( !bufptr ){
             miss_match = false;
         }     
@@ -369,15 +384,17 @@
                 tflood.reset();
                 floodcount =0;
                 pflood = 1;
+                flood_timeout.start();
             }
             if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "off",3 )) {
                 miss_match = false;
                 pc.printf("\n\r\t Flood OFF\n\r\t");
                 pflood = 0;
                 tflood.stop();
+                flood_timeout.reset();
             }
         }
-
+        
         if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug ",6 )) {
             if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "on",2 )) {
                 miss_match = false;
@@ -524,7 +541,10 @@
 
         }
         */
+        
         if( miss_match ) pc.printf("\n\r%s: command not found\n\r", debug_buf );
+        
+        else strcpy( last_debug_buf, debug_buf );
     }
     
     if ( b == 0x0D || bufret == 1 || bufptr > DEBUGBUFSIZE ) {