Forigo / Mbed 2 deprecated FORIGO_Modula_V7_3_VdcStep_DICEMBRE2020

Dependencies:   mbed X_NUCLEO_IHM03A1_for

Files at this revision

API Documentation at this revision

Comitter:
francescopistone
Date:
Mon Jun 06 08:21:47 2022 +0000
Parent:
50:144a92eeddb9
Commit message:
versione fotocellula testata

Changed in this revision

canbus.hpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
variables.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/canbus.hpp	Sat Feb 27 16:18:50 2021 +0000
+++ b/canbus.hpp	Mon Jun 06 08:21:47 2022 +0000
@@ -20,7 +20,7 @@
         const unsigned int  RX_ID = 0x104;
         const unsigned int  TX_ID = 0x105;
         const float ritAvv = 1.0f;
-        #define seedSensor
+        //#define seedSensor
     #endif
     #if defined(M4)
         const unsigned int  RX_ID = 0x106;
--- a/main.cpp	Sat Feb 27 16:18:50 2021 +0000
+++ b/main.cpp	Mon Jun 06 08:21:47 2022 +0000
@@ -286,6 +286,11 @@
 // rise of seed presence sensor
 void seedSensorTask(){
     seedSee=1;
+    seed_counter++; // è un byte trasferito via canbus , quindi lo azzero a 250 e lato opus considero solo la variazione
+    if (seed_counter == 250)
+    {
+       seed_counter = 0; 
+    }
     #if defined(pcSerial)
         #if defined(checkLoop)
             pc.printf("3\n");
@@ -1096,6 +1101,7 @@
     val1[4]=resetComandi;
     val1[5]=cellsCounterLow;
     val1[6]=cellsCounterHig;
+    val1[7]=seed_counter;
     #if defined(canbusActive)
         if(can1.write(CANMessage(TX_ID, *&val1,8))) {
             checkState=0;
@@ -1215,6 +1221,14 @@
                     simOk=0;
                 }
             }
+            // modulo 6
+            if (RX_ID==0x110) {
+                if ((selezionato&0x20)==0x20) {
+                    simOk=1;
+                } else {
+                    simOk=0;
+                }
+            }
 
         }
         //if (tractorSpeed_MtS_timed <= 0.01f){
@@ -1794,9 +1808,9 @@
         #endif
         seedCorrection.attach(&seedCorrect,0.010f); // con 16 becchi a 4,5Kmh ci sono 37mS tra un becco e l'altro, quindi 8 correzioni di tb
         dcSetting();
-        #if defined(seedSensor)
+        //#if defined(seedSensor)
             seedCheck.fall(&seedSensorTask);
-        #endif
+        //#endif
     } else {
         tftUpdate.attach(&videoUpdate,0.125f);
     }
--- a/variables.hpp	Sat Feb 27 16:18:50 2021 +0000
+++ b/variables.hpp	Mon Jun 06 08:21:47 2022 +0000
@@ -236,6 +236,8 @@
 uint8_t pickCounterHig=0;
 uint8_t seedSee=0;
 
+uint32_t seed_counter=0;
+
 uint8_t cntCellsCorrect=0;
 uint8_t cntSpeedError=0;