mbed2 pre-final

Dependencies:   LCD_DISCO_F429ZI mbed BSP_DISCO_F429ZI

Revision:
4:a8494b656292
Parent:
3:404526e83702
--- a/servo.cpp	Mon Jun 15 16:26:47 2020 +0000
+++ b/servo.cpp	Mon Jun 15 17:31:23 2020 +0000
@@ -1,12 +1,7 @@
 #include "servo.h"
 
-#define SERVO_FREQUENCY 80
-
 Servo::Servo(void) {
     
-    MyServoGui.uiMarkerPos = 0;
-    uiDesiredPosition = 0;
-    uiCurrentPosition = 0;
     Callib();
     
 }
@@ -15,27 +10,30 @@
     uiDesiredPosition = uiPosition % 360;
     eState = IN_PROGRESS;
     while(eState != IDLE) {
-        wait(1/SERVO_FREQUENCY);
         Automat();
     }
 }
 
 void Servo::Callib(void) {
-    MyServoGui.uiMarkerStartPos = MyServoGui.uiMarkerPos;
+    
+    MyServoGui.uiMarkerStartPos = 0;
     MyServoGui.uiMarkerPos = 0;
+    MyServoGui.ucLedPos = 0;
+    
     eState = CALLIB;
     while(eState != IDLE) {
-        wait(1/SERVO_FREQUENCY);
         Automat();
     }
-    wait(0.01);
+    
     MyServoGui.uiMarkerStartPos = MyServoGui.uiMarkerPos;
     MyServoGui.uiMarkerPos = 0;
+    MyServoGui.ucLedPos = 0;
     uiCurrentPosition = 0;
     uiDesiredPosition = 0;
 }
 
 void Servo::Automat(void) {
+    wait(0.02);
     switch(eState) {
         case IN_PROGRESS:
             if(uiCurrentPosition < uiDesiredPosition) {
@@ -69,4 +67,5 @@
         break;
     }
     uiCurrentPosition = MyServoGui.uiMarkerPos;
+    wait(0.02);
 }