nova verzija tcp+udp->serial com

Files at this revision

API Documentation at this revision

Comitter:
bosko001
Date:
Fri Jul 10 11:33:05 2020 +0200
Parent:
25:08f20fc5e5b5
Commit message:
ispituje se na terenu

Changed in this revision

DataFlash/flashDataBlock.cpp Show annotated file Show diff for this revision Revisions of this file
TcpServerToFlash.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 08f20fc5e5b5 -r c14d034d7459 DataFlash/flashDataBlock.cpp
--- a/DataFlash/flashDataBlock.cpp	Thu Jun 18 22:54:35 2020 +0200
+++ b/DataFlash/flashDataBlock.cpp	Fri Jul 10 11:33:05 2020 +0200
@@ -37,7 +37,7 @@
     // printf("Flash block device erase size: %x\n\r",   erase_size = bd.get_erase_size());
     // printf("Flash block device geterase value: %x\n\r", erase_value =  bd.get_erase_value());
 
-    if( bd.is_valid_read( 0, bd.get_read_size() ) )  printf(" flash data block read valid \n\r");
+    if( bd.is_valid_read( 0, bd.get_read_size() ) )  ;//printf(" flash data block read valid \n\r");
     else {printf(" flash data block read NOT valid \n\r"); return 2;}
 
     return 0;
@@ -50,8 +50,8 @@
 
 int scale_buffer_dimension( int val )
 {
-    if( val > device_size ) { val = buffer_dimension = device_size; printf("buf_dim = %d\n\r", buffer_dimension);}
-    else if( val > buffer_dimension ) { buffer_dimension = val; printf("buf_dim = %d\n\r", buffer_dimension);}
+    if( val > device_size ) { val = buffer_dimension = device_size; /*printf("buf_dim = %d\n\r", buffer_dimension);*/}
+    else if( val > buffer_dimension ) { buffer_dimension = val; /* printf("buf_dim = %d\n\r", buffer_dimension);*/}
   return val;
 }
 
diff -r 08f20fc5e5b5 -r c14d034d7459 TcpServerToFlash.cpp
--- a/TcpServerToFlash.cpp	Thu Jun 18 22:54:35 2020 +0200
+++ b/TcpServerToFlash.cpp	Fri Jul 10 11:33:05 2020 +0200
@@ -81,7 +81,7 @@
 {
   while( true )
   {  
-    printf("____Otvoren TCP server rx thread____ \n\r");   
+    printf("____Otvoren TCP WEB server rx thread____ \n\r");   
     if( gp_tcpSocket ) {delete gp_tcpSocket; gp_tcpSocket = NULL; } /* ima smisla ako se thread nasilno zatvara  */
 
       gp_tcpSocket = new TCPSocket;
@@ -97,9 +97,6 @@
 
     while(   (p_soc = gp_tcpSocket->accept( &err))  )
     {
-//    printf("\n\rTCP WEB SERVER: zahtev za konekciju - socket = %d  err = %d\n\r", p_soc, err);fflush(stdout);
-    //     s.wait();     // semafor sprecava novu konekciju dok se stara ne zavrsi 
-  //  printf("TCP WEB SERVER: Broj %d\n\r", ++nos); fflush(stdout);
 
 bws = 1;
 
@@ -137,7 +134,7 @@
 int restart = 0;
 
       int n, nr, nt;
-      printf("tcpServThread:  Otvoren socket %d\n\r",(int)p_soc);   
+   //   printf("tcpServThread:  Otvoren socket %d\n\r",(int)p_soc);   
     
         while(true)
        {        
@@ -171,6 +168,7 @@
               fflush(stdout);
               
                 inbuff[n]=0;
+    // printf("%s\n\r",inbuff);
                 //raspakivanje sadrzaja, a ako je POST preuzimanje parametara
                 char ** strniz = gpc_html->doHTTP_freereturn( inbuff);
                 char *type = strniz[0];
diff -r 08f20fc5e5b5 -r c14d034d7459 main.cpp
--- a/main.cpp	Thu Jun 18 22:54:35 2020 +0200
+++ b/main.cpp	Fri Jul 10 11:33:05 2020 +0200
@@ -5,6 +5,7 @@
 #include "TcpClients.h"
 #include "SerialCom.h"
 #include "TcpServerToFlash.h"
+#include "TcpServer.h"
 //#include "dxml.h"
 #include "doHTML.h"
 #include "dataFlash.h"
@@ -40,15 +41,18 @@
 
 void input_fun( void ) 
 {
+
      while(true) 
      { 
       unsigned char uc;
       int fltip, kanal, fleg;
+wait(0.1);
         uc = (unsigned char)getchar( );
         printf( "\n\runesen karakter %c\n\r", uc);
         
         switch( uc )
         {
+            case 'F': printf("while\n\r"); while(1); break;
             case 'h': 
             {
             extern C_HTMLparse *gpc_html;
@@ -120,13 +124,17 @@
     C_HTMLparse *gpc_html;
     
     
+#define WD_KICK     watchdog.kick()
 
 
 int main(void)
 {
   
     printf("\n\r\n\n----------  POCETAK  ------------- \n\n\r");
-    
+
+  Watchdog &watchdog = Watchdog::get_instance();
+  watchdog.start(10000);
+
     doinit_FlashData( );
 
    gpc_html = new C_HTMLparse;
@@ -154,7 +162,7 @@
    //extern EthernetInterface *gp_eth;
 
 
-   
+   WD_KICK;
 
   if( ethernet_setup(  ) )
   {
@@ -162,9 +170,18 @@
     start_UdpClients( );
      inic_TcpServerToFlash(  );
      p_led = &GLed;
+    
+    
+    extern void start_TcpServer( void );
+    start_TcpServer( );
+
   }
   else p_led = &BLed;
 
+
+WD_KICK;
+
+
   start_SerialCom( );
 
 extern void test_HTML(void);
@@ -194,6 +211,9 @@
            else *p_led = !*p_led;
 
         }
+
+        WD_KICK;
+
         wait(0.01);  
     }