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
Diff: main.cpp
- Revision:
- 31:92a9e183be8e
- Parent:
- 30:32e770e91998
- Child:
- 32:cfc3d7420fa5
--- a/main.cpp Thu May 23 14:12:06 2019 +0000 +++ b/main.cpp Fri May 24 10:29:09 2019 +0000 @@ -1171,7 +1171,7 @@ uint16_t steps = (uint32_t) rxMsg.data[2]*0x00000100; steps = steps + ((uint32_t)rxMsg.data[1]); TBmotorSteps =steps; - pc.printf("pippo; %d",steps); + //pc.printf("pippo; %d",steps); //stepSetting(); cellsCountSet = rxMsg.data[3]; if ((flags&0x01)==0x01) { @@ -1660,6 +1660,19 @@ if (tractorSpeedRead==0) { speedClock=0; } + if ((tractorSpeed_MtS_timed>0.0f)&&(oldTractStop==1)){ + alarmDelay.start(); + oldTractStop=0; + } + if (alarmDelay.read()>5){ + alarmEnable=true; + } + if ((tractorSpeed_MtS_timed<=0.05f)){ + oldTractStop=1; + alarmDelay.stop(); + alarmDelay.reset(); + alarmEnable=false; + } // inversione segnali ingressi #if !defined(simulaBanco) @@ -1853,7 +1866,7 @@ #endif if (tractorSpeed_MtS_timed>0.2f){ if (timeIntraPick >= (memoIntraPick*2)) { - if ((aspettaStart==0)) { + if ((aspettaStart==0)&&(alarmEnable==true)) { if (firstStart==0) { all_pickSignal=1; } @@ -1881,7 +1894,7 @@ } } } - if (tractorSpeed_MtS_timed>0.2f){ + if ((tractorSpeed_MtS_timed>0.2f)&&(alarmEnable==true)){ double oldLastPr = (double)oldLastPulseRead*2.8f; if((double)speedTimeOut.read_us()> (oldLastPr)) { if ((firstStart==0)&&(simOk==0)&&(enableSimula==0)) { @@ -2025,7 +2038,7 @@ #endif } if (((double)TBactualPosition > ((TBgiroStep/cellsNumber)*1.8f)&&(erroreTamburo==0))&&(simStepper==0)) { - if (firstStart==0) { + if ((firstStart==0)&&(alarmEnable==true)) { if (tractorSpeed_MtS_timed>0.4f){ if (cntTbError>5) { all_cellSignal=1; @@ -2067,7 +2080,7 @@ #endif } } - if (tractorSpeed_MtS_timed>0.0f){ + if ((tractorSpeed_MtS_timed>0.0f)&&(alarmEnable==true)){ if (((double)TBactualPosition > ((TBgiroStep/cellsNumber)*3.0f))||(cntTbError>5)) { if (firstStart==0) { all_noStepRota=1; @@ -2384,7 +2397,7 @@ olddcActualDuty=dcActualDuty; } // allarme - if (tractorSpeed_MtS_timed>0.0f){ + if ((tractorSpeed_MtS_timed>0.0f)&&(alarmEnable==true)){ if (SDwheelTimer.read_ms()>4000) { if (firstStart==0) { all_noDcRotati=1;