Huseyin Berkay Berabi / GA-Final

Dependencies:   mbed-dev

Fork of GA-Berkay_Alex by Alejandro Ungria Hirte

Revision:
3:8bee1711d186
Parent:
2:5adf0b785944
Child:
4:120ff05a7c27
--- a/main_minimal.cpp	Wed Jan 10 16:14:49 2018 +0000
+++ b/main_minimal.cpp	Wed Feb 28 16:10:21 2018 +0000
@@ -19,6 +19,7 @@
 void rangeAndDisplayOne(uint8_t addr);
 void rangeAndDisplayAll();
 void executeOrder(char* command);
+void rangeAndDisplayInt(uint8_t from, uint8_t to);
 
 
 // PA_7 MOSI, PA_6 MISO, PA_5 SCLK, PB_6 CS, PB_9 IRQ
@@ -114,6 +115,9 @@
                                     break;
                     case RANGE_ONE: rangeAndDisplayOne(beaconNode.getDestination());
                                     break;
+                    case RANGE_INT:  rangeAndDisplayInt(beaconNode.getRepetitions(), beaconNode.getDestination());
+                                   
+                                    break;
                     default:        break;
                 }
                 beaconNode.decreaseRepetitions();
@@ -128,9 +132,7 @@
              
              // EXECUTE THIS IF A BASE STATION
             pc.readcommand(executeOrder);
-             wait_ms(10);
-
-            wdt.kick();
+            //wdt.kick();
         }
         else { // All Anchor Action is in the Interrupt functions!
             // EXECUTE THIS IF AN ANCHOR
@@ -173,7 +175,10 @@
         pc.printf("Base Station is RESETTED  \r\n\r\n");
     }
     
-    
+    else if (strncmp(command,"int",3)==0){
+        baseStationNode.sendOrder(0,dest1,RANGE_INT,repetitions, Node::BASE_ORDER);
+        // pc.print("Mode: Range interval \r\n");
+        }
     else if (strncmp(command, "all", 3) == 0){
         baseStationNode.sendOrder(0, NOT_USED, RANGE_ALL, repetitions, Node::BASE_ORDER); 
        // pc.printf("Mode: Range all \r\n");
@@ -246,6 +251,9 @@
         baseStationNode.sendOrder(dest3, NOT_USED, BECOME_ANCHOR, NOT_USED, Node::SWITCH_TYPE);
         
     } 
+    else{
+        pc.printf("test");
+        }
   
 }
 
@@ -322,7 +330,9 @@
     pc.printf("%f(%f) \r\n", beaconNode.getDistance(addr), beaconNode.getSignalStrength(addr));
 }
 
-
+void rangeAndDisplayInt(uint8_t from,uint8_t to){
+    beaconNode.requestRangingInt(from,to);
+    }
 
 void rangeAndDisplayAll(){
     beaconNode.requestRangingAll();