premiere ebauche

Dependencies:   mbed PinDetect

Revision:
10:f0b382368614
Parent:
6:1a4ed88c9a4b
Child:
13:47806f4dbfcd
--- a/speedlimiter.hpp	Tue Nov 06 22:36:18 2018 +0000
+++ b/speedlimiter.hpp	Fri Nov 16 17:47:35 2018 +0000
@@ -6,6 +6,7 @@
 #define SPEED_LIMITER_HPP
 
 #include "mbed.h"
+#include "recommendedspeed.hpp"
 
 class SpeedLimiter
 {
@@ -31,8 +32,14 @@
 
     void ipControllerTransferFunction();
 
-    inline float getReferenceSpeed() {
-        float retval = _referenceSpeed;
+    inline float getReferenceSpeed(bool increment = false) {
+        //float retval = _referenceSpeed;
+        Segment& segment = _parcours->getSegment();
+        float retval = segment.getSpeed();
+        if (increment)
+        {
+            segment.incrementIndex();
+        }
         return retval;
     }
     inline float getMeasuredSpeed() {
@@ -45,6 +52,10 @@
     inline void setMeasuredSpeed(const float speed) {
         _measuredSpeed = speed;
     }
+    
+    inline void setParcours(Parcours* parcours) {
+        _parcours = parcours;
+    }
 
     float ecoEnabledAlgorithm();
     
@@ -86,6 +97,8 @@
     volatile float _measuredSpeed;
     volatile float _outputPedalVoltageHi;
     volatile float _outputPedalVoltageLo;
+    
+    Parcours *_parcours;
 
     static Serial* pc; // for communication / debugging
 };