nova verzija tcp+udp->serial com

Revision:
18:5ee53205451a
Parent:
16:c4e0e8b4d8fc
Child:
19:7bdb1a10043f
diff -r 74c41e3f10b8 -r 5ee53205451a main.cpp
--- a/main.cpp	Wed May 06 00:42:53 2020 +0200
+++ b/main.cpp	Sun May 17 17:16:03 2020 +0200
@@ -2,6 +2,7 @@
 #include "clubbing.h"
 #include "EthernetSetup.h"
 #include "UdpToScom.h"
+#include "TcpClients.h"
 #include "TcpServerToFlash.h"
 #include "dxml.h"
 #include "doHTML.h"
@@ -26,7 +27,7 @@
 
      } 
 } 
-Thread pfv_thread(pfv_fun);
+Thread pfv_thread(pfv_fun, osPriorityNormal, 1000);
 
 
 void input_fun( void ) 
@@ -34,40 +35,89 @@
      while(true) 
      { 
       unsigned char uc;
+      int fltip, kanal, fleg;
         uc = (unsigned char)getchar( );
         printf( "\n\runesen karakter %c\n\r", uc);
-        if( uc == 'h' ) 
+        
+        switch( uc )
         {
+            case 'h': 
+            {
             extern C_HTMLparse *gpc_html;
                     auto c = gpc_html->getHTML_free( );
                     printf("\n\r%s\n\r", c);
                     free(c);
-
+            }
+                break;
+            case 'c': 
+                fltip = 1;
+                break;
+            case 'f':
+                fltip = 2;
+                break;
+            case '0': case '1': case '2': case '3':
+                if(fltip == 1) kanal = uc - '0';
+                else           fleg = uc - '0';
+                break;
+            case 'd':
+            {
+                // extern void tcpRxThreadCancel( int i, int flag);
+                // tcpRxThreadCancel( kanal, fleg );
+                printf(" komanda za tred[%d] fleg=%d\n\r", kanal, fleg);
+            }
+                break;
+            case 'S':
+            {
+                extern void _semafor_release(void );
+                _semafor_release();
+            }
+                break;
+            case 'T':
+                     inic_TcpServerToFlash(  );
+            break;            
+            case 'R':
+            printf("systemInit()\n\r");
+                SystemInit();
+                //goto __main;
+            break;
         }
      } 
 } 
-Thread input_thread(input_fun);
+Thread input_thread(input_fun, osPriorityNormal, 1000);
 
 
     C_HTMLparse *gpc_html;
     
     
-    
-    
+
 
 int main(void)
 {
   
-    printf("\n\r----------  POCETAK  ------------- \n\r");
+    printf("\n\r\n\n----------  POCETAK  ------------- \n\n\r");
     
     init_FlashData( );
 
    gpc_html = new C_HTMLparse;
+   C_HTMLparse  *p_temp_html = new C_HTMLparse;
 
+//   PROVERA KONZISTENCIJE FLASH PODATAKA
+    putFLASHintoHTML( p_temp_html );
 
-    putHTMLintoFLASH( gpc_html );
-    putFLASHintoHTML( gpc_html );
-    showFlashData(  );
+    if( test_FlashDataProbity( ))
+    {
+        printf( "MAIN:  dobri Flash podaci\n\r");
+        putFLASHintoHTML( gpc_html );    
+    }
+    else 
+    {
+        printf("MAIN: losi FLASH podaci\n\r");
+        putHTMLintoFLASH( gpc_html );
+        putFLASHintoHTML( gpc_html );    
+    }
+    delete p_temp_html;
+
+   // showFlashData(  );
 
 
 //    init_EthToScom(  );
@@ -75,6 +125,7 @@
    extern EthernetInterface *gp_eth;
 
    init_EthToScom(  );
+  tcpRxThreadsRiseUp(  );
 
 //    gp_eth = ethernet_setup(  );
      inic_TcpServerToFlash(  );
@@ -102,7 +153,7 @@
         wait(0.01);  
     } 
 
-     deinit_FlashData(  );
+  //   deinit_FlashData(  );
 
 
 }