Browse Source

SERVICE_SW: fix dhcp tries

balbekova 7 years ago
parent
commit
417bf98549
1 changed files with 4 additions and 4 deletions
  1. 4 4
      service_hw/Ethernet/netconf.c

+ 4 - 4
service_hw/Ethernet/netconf.c

@@ -20,7 +20,7 @@
 #include <string.h>
 #include <string.h>
 
 
 
 
-#define MAX_DHCP_TRIES 10
+#define MAX_DHCP_TRIES 4
 
 
 #define TIME_COUNTER_10_MIN   600
 #define TIME_COUNTER_10_MIN   600
 #define TIME_COUNTER_1_MIN    60
 #define TIME_COUNTER_1_MIN    60
@@ -90,7 +90,7 @@ void LwIP_DHCP_task(void * pvParameters)
   struct ip4_addr gw;
   struct ip4_addr gw;
   uint8_t DHCP_state;  
   uint8_t DHCP_state;  
   DHCP_state = DHCP_START;
   DHCP_state = DHCP_START;
-  static uint8_t dhcpTry = 0;
+  struct dhcp *dhcp = netif_dhcp_data(&xnetif);
 
 
   for (;;)
   for (;;)
   {
   {
@@ -143,7 +143,7 @@ void LwIP_DHCP_task(void * pvParameters)
         else
         else
         {
         {
           /* DHCP timeout */
           /* DHCP timeout */
-          if (dhcpTry++ > MAX_DHCP_TRIES)
+          if (dhcp->tries > MAX_DHCP_TRIES)
           {
           {
               DHCP_state = DHCP_TIMEOUT;
               DHCP_state = DHCP_TIMEOUT;
 
 
@@ -185,7 +185,7 @@ void LwIP_DHCP_task(void * pvParameters)
       default: break;
       default: break;
     }
     }
 
 
-    vTaskDelay(1250);
+    vTaskDelay(250);
   }   
   }   
 }
 }