Messa in campo 4 file - 26/06/2020 Francia

Dependencies:   mbed X_NUCLEO_IHM03A1_for

Fork of FORIGO_Modula_V7_3_VdcStep_maggio2020 by Francesco Pistone

Revision:
4:de1b296e9757
Parent:
3:a469bbd294b5
Child:
5:2a3a64b52f54
--- a/main.cpp	Wed Feb 13 07:18:01 2019 +0000
+++ b/main.cpp	Wed Feb 13 07:29:30 2019 +0000
@@ -11,7 +11,7 @@
 // FIRST RELEASE OF BOARD DEC 2017
 // FIRST RELEASE OF FIRMWARE JAN 2018
 //
-// THIS RELEASE: 20 DECEMBER 2018
+// THIS RELEASE: 10 february 2019
 //
 // APPLICATION: MODULA CON DISTRIBUTORE RISO ED ENCODER MOTORE 
 //
@@ -23,6 +23,7 @@
 // 05 06 2018 - INSERITO IL CONTROLLO DI GESTIONE DEL QUINCONCE SENZA ENCODER
 // 09 06 2018 - INSERITO CONTROLLO DI FASE CON ENCODER MASTER PER QUINCONCE - DATO SCAMBIATO IN CAN
 // 03 01 2019 - INSERITA GESTIONE IN RTOS PER IL DRIVER POWERSTEP01
+// 10 02 2019 - INSERITO FUNZIONAMENTO STEPPER IN MODALITA' CONTROLLO DI TENSIONE E STEP DA CLOCKPIN
 /********************
 IL FIRMWARE SI COMPONE DI 10 FILES:
     - main.cpp
@@ -30,6 +31,7 @@
     - iodefinition.hpp
     - canbus.hpp
     - parameters.hpp
+    - powerstep.hpp
     - timeandtick.hpp
     - variables.hpp
     - powerstep.hpp
@@ -428,12 +430,22 @@
             posError = posSD - (double)TBactualPosition;    
             // interviene sulla velocità di TB per raggiungere la corretta posizione relativa
             if((lowSpeed==0)&&(aspettaStart==0)){
-                double lowLim=-500.0f;
-                double higLim= 500.0f;
+                double lowLim=-50.0f;
+                double higLim= 50.0f;
+                double divide= 100.0f;
+                if (pickNumber <= 5){
+                    lowLim=-500.0f;
+                    higLim= 500.0f;
+                    divide= 25.0f;
+                }else{
+                    lowLim=-50.0f;
+                    higLim= 50.0f;
+                    divide= 100.0f;
+                }
                 if (posError>higLim){posError=higLim;}
                 if (posError<lowLim){posError=lowLim;}
                 if ((posError >=1.0f)||(posError<=-1.0f)){   
-                    ePpos = periodo /(1.0f+ ((posError/25.0f)));
+                    ePpos = periodo /(1.0f+ ((posError/divide)));
                     cambiaTB(ePpos);
                 }
                     #if defined(pcSerial)