Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed X_NUCLEO_IHM03A1_for
Revision 48:d46f3c5638ee, committed 2021-02-05
- Comitter:
- francescopistone
- Date:
- Fri Feb 05 10:35:50 2021 +0000
- Parent:
- 47:8455eedea226
- Commit message:
- test 2021
Changed in this revision
| 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/main.cpp Wed Dec 02 09:07:00 2020 +0000
+++ b/main.cpp Fri Feb 05 10:35:50 2021 +0000
@@ -268,10 +268,10 @@
pulseRised2=1;
dcEncoderCnt++;
double sincronizza = frazioneImpulsi * dcEncoderCnt;
- prePosSD=500+(uint32_t)sincronizza; // preposizionamento SD
+ prePosSD=prePosSDmin+(uint32_t)sincronizza; // preposizionamento SD
#if defined(speedMaster)
if (quinconceActive==0) {
- posForQuinc=500+(uint32_t)sincronizza;
+ posForQuinc=prePosSDmin+(uint32_t)sincronizza;
}
#endif
}
@@ -449,6 +449,16 @@
// aggiornamento parametri di lavoro fissi e da Tritecnica
void aggiornaParametri()
{
+ if (pickNumber > cellsNumber){
+ prePosSD=250; // actual position of seed wheel (step of motor)
+ prePosSDmin=250;
+ prePosSDvar=290;
+ }else{
+ prePosSD=500; // actual position of seed wheel (step of motor)
+ prePosSDmin=500;
+ prePosSDvar=580;
+
+ }
speedPerimeter = Pi * speedWheelDiameter ; // perimeter of speed wheel
pulseDistance = (speedPerimeter / speedWheelPulse)*1000.0f; // linear space between speed wheel pulse
seedPerimeter = Pi * (seedWheelDiameter-(deepOfSeed*2.0f)); // perimeter of seed wheel
@@ -1876,10 +1886,10 @@
#if !defined(simulaBanco)
seedWheelZeroPinInput = !seedWheelZeroPinInputRev;
#else
- if ((prePosSD-500) >= SDsectorStep) {
+ if ((prePosSD-prePosSDmin) >= SDsectorStep) {
seedWheelZeroPinInput=1;
}
- if ((prePosSD > 500)&&(prePosSD<580)) {
+ if ((prePosSD > prePosSDmin)&&(prePosSD<prePosSDvar)) {
seedWheelZeroPinInput=0;
}
#endif
@@ -1893,15 +1903,15 @@
if (seedWheelZeroPinInput==1) {
quinconceOut=0;
}
- if (((double)(prePosSD-500) >= (SDsectorStep/((double)quincSector)))&&(quinconceOut=1)) {
+ if (((double)(prePosSD-prePosSDmin) >= (SDsectorStep/((double)quincSector)))&&(quinconceOut=1)) {
quinconceOut=1;
}
if (quinconceActive==1) {
if ((quinconceOut==1)&&(oldQuinconceOut==1)) {
- posForQuinc=500;
+ posForQuinc=prePosSDmin;
oldQuinconceOut=0;
}
- if (((double)posForQuinc-500.0f)> (SDsectorStep-200)) {
+ if (((double)posForQuinc-(double)prePosSDmin)> (SDsectorStep-200)) {
oldQuinconceOut=1;
}
}
@@ -2026,7 +2036,7 @@
}
if ((seedWheelZeroPinInput==1)&&(oldSeedWheelZeroPinInput==0)) {
timeIntraPick = (double)intraPickTimer.read_ms();
- prePosSD=500; // preposizionamento SD
+ prePosSD = prePosSDmin; // preposizionamento SD
intraPickTimer.reset();
rotationTimeOut.reset();
seedFilter.reset();
--- a/variables.hpp Wed Dec 02 09:07:00 2020 +0000 +++ b/variables.hpp Fri Feb 05 10:35:50 2021 +0000 @@ -107,6 +107,8 @@ // variable for speed and step calculation uint32_t prePosSD=0; // actual position of seed wheel (step of motor) +uint32_t prePosSDmin=500; +uint32_t prePosSDvar=580; uint32_t SDactualPosition=0; // actual position of seed wheel (step of motor) uint32_t TBactualPosition=0; uint32_t TBpassPosition=0;