WappAutomation 2 : - WITH RESET - WITHOUT Switch Cable Tested on TEL50

Dependencies:   MFRC522

Revision:
10:4eebb90e8e06
Parent:
9:cfa9a379dbd3
Child:
11:275b5ff86ab0
--- a/main.cpp	Mon Apr 16 15:07:19 2018 +0000
+++ b/main.cpp	Tue Dec 03 08:45:15 2019 +0000
@@ -4,14 +4,13 @@
 
 
 //***************************** Change this for each new prober installation ********************************
-#define PROBER_NAME "tl37"
-#define IP          "10.129.97.108"
+#define PROBER_NAME "tl47"
+#define IP          "10.129.97.129"
 /*Please update the list below:
     TEL12 : 10.129.97.100
     TEL20 : 10.129.97.101
     TEL23 : 10.129.97.102
     TEL36 : 10.129.97.103
-    TEL15 : 10.129.97.104
     TEL01 : 10.129.97.105
     TEL19 : 10.129.97.106
     TEL27 : 10.129.97.107
@@ -34,6 +33,10 @@
     TEL42 : 10.129.97.124
     TEL43 : 10.129.97.125
     TEL44 : 10.129.97.126
+    TEL45 : 10.129.97.127
+    TEL46 : 10.129.97.128
+    TEL47 : 10.129.97.129
+    TEL48 : 10.129.97.104
 ************************************************************************************************************/
 
 
@@ -381,6 +384,7 @@
     PC.printf("\tInit Ethernet...");
     eth.set_network(IP, MASK, GATEWAY);
     int rtrn = eth.connect();
+    int reset_eth = 0;
     if (rtrn == 0){
         PC.printf("DONE\r\n");
         const char *ip = eth.get_ip_address();
@@ -394,15 +398,19 @@
         red = 0;
         green = 0;
         PC.printf("Running FAIL -> Program aborted\r\n\r\n");
-        while (true){
+        while (reset_eth <= 900){
             blue = !blue;
             TagReadLED = !TagReadLED;
             wait_ms(200);
+            reset_eth++;
         }
+        NVIC_SystemReset(); // reset system if no ethernet connection succeeded after 180sec Added by B. Tournier
+            
     }
    
     //Waiting Tag and WAPP alarm
     int count = 0;
+    int reset_trigger = 0;
     while (true) {
         //Check if Tag read
         if (WappExchangeSwitch == 1){
@@ -462,6 +470,10 @@
 
         green = !green;
         count++;
+        reset_trigger++;
         wait_ms(500);
+        if (reset_trigger >= 14400){
+            NVIC_SystemReset(); // reset system each 2 hours
+        }
     }
-}
+}
\ No newline at end of file