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
Fork of FORIGO_Modula_V7_3_VdcStep_maggio2020 by
Diff: main.cpp
- Revision:
- 32:cfc3d7420fa5
- Parent:
- 31:92a9e183be8e
- Child:
- 33:81b406a911b6
diff -r 92a9e183be8e -r cfc3d7420fa5 main.cpp
--- a/main.cpp Fri May 24 10:29:09 2019 +0000
+++ b/main.cpp Thu Jun 20 07:56:35 2019 +0000
@@ -1168,58 +1168,62 @@
if (tractorSpeed_MtS_timed <= 0.01f){
if (rxMsg.id==RX_Configure) {
uint8_t flags = rxMsg.data[0];
- uint16_t steps = (uint32_t) rxMsg.data[2]*0x00000100;
- steps = steps + ((uint32_t)rxMsg.data[1]);
- TBmotorSteps =steps;
- //pc.printf("pippo; %d",steps);
- //stepSetting();
- cellsCountSet = rxMsg.data[3];
- if ((flags&0x01)==0x01) {
- if (encoder==false) {
- encoder=true;
- speedFromPick=0;
- DcEncoder.rise(NULL);
- dcSetting();
+ if ((flags&0x80)==0x80) { // comando taglianylon
+ tagliaNylonAttivo=true;
+ } else {
+ tagliaNylonAttivo=false;
+ uint16_t steps = (uint32_t) rxMsg.data[2]*0x00000100;
+ steps = steps + ((uint32_t)rxMsg.data[1]);
+ TBmotorSteps =steps;
+ //stepSetting();
+ cellsCountSet = rxMsg.data[3];
+ if ((flags&0x01)==0x01) {
+ if (encoder==false) {
+ encoder=true;
+ speedFromPick=0;
+ DcEncoder.rise(NULL);
+ dcSetting();
+ }
+ } else {
+ if (encoder==true) {
+ encoder=false;
+ speedFromPick=1;
+ DcEncoder.rise(NULL);
+ dcSetting();
+ }
}
- } else {
- if (encoder==true) {
- encoder=false;
- speedFromPick=1;
- DcEncoder.rise(NULL);
- dcSetting();
+ if ((flags&0x02)==0x02) {
+ tankLevelEnable=true;
+ } else {
+ tankLevelEnable=false;
+ }
+ if ((flags&0x04)==0x04) {
+ seedSensorEnable=true;
+ } else {
+ seedSensorEnable=false;
+ }
+ if ((flags&0x08)==0x08) {
+ drumSelect=true; // usare per selezione del tamburo =0 meccanico =1 PNEUMATICO
+ } else {
+ drumSelect=false; // forzato a true per Germania
}
- }
- if ((flags&0x02)==0x02) {
- tankLevelEnable=true;
- } else {
- tankLevelEnable=false;
+ if ((flags&0x10)==0x10) {
+ canDataCheckEnable=true;
+ } else {
+ canDataCheckEnable=false;
+ }
+ if ((flags&0x20)==0x20) {
+ tamburoStandard=1;
+ } else {
+ tamburoStandard=0;
+ }
+ if ((flags&0x40)==0x40) {
+ currentCheckEnable=true;
+ } else {
+ currentCheckEnable=false;
+ }
+ aggiornaParametri();
}
- if ((flags&0x04)==0x04) {
- seedSensorEnable=true;
- } else {
- seedSensorEnable=false;
- }
- if ((flags&0x08)==0x08) {
- drumSelect=true; // usare per selezione del tamburo =0 meccanico =1 PNEUMATICO
- } else {
- drumSelect=false; // forzato a true per Germania
- }
- if ((flags&0x10)==0x10) {
- canDataCheckEnable=true;
- } else {
- canDataCheckEnable=false;
- }
- if ((flags&0x20)==0x20) {
- tamburoStandard=1;
- } else {
- tamburoStandard=0;
- }
- if ((flags&0x40)==0x40) {
- currentCheckEnable=true;
- } else {
- currentCheckEnable=false;
- }
- aggiornaParametri();
}
}
}
@@ -2117,9 +2121,8 @@
// calcola velocità trattore
if(enableSpeed>=2) {
if ((pulseSpeedInterval>=0.0f)) { //minIntervalPulse)&&(pulseSpeedInterval<maxInterval)){
+ // todo: separare il controllo su speedfrommaster per attivarlo solo sullo slave
if((quincCnt<3)||(speedFromMaster==0.0f)||(enableSimula==1)) {
- //TODO: limite inferiore e superiore per non modificare la velocità selezionata
- // serve un timer a 5 secondi dopo l'avviamento che fa partire il controllo
tractorSpeed_MtS_timed = ((pulseDistance / pulseSpeedInterval)); // tractor speed (unit= Mt/S) from pulse time interval
if (delaySpeedCheck.read()>=5.0f){
if ((tractorSpeed_MtS_timed<=(oldLocalTractorSpeed+hiLimitSpeed))&&(tractorSpeed_MtS_timed>=(oldLocalTractorSpeed-loLimitSpeed))){
