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
Revision 9:d2b700d42dbe, committed 2019-05-08
- Comitter:
- gmfortier
- Date:
- Wed May 08 15:59:47 2019 +0000
- Parent:
- 8:e82e5b78dbbd
- Commit message:
- Final configurations
Changed in this revision
I2CSlaveComm.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/I2CSlaveComm.cpp Mon May 06 20:26:33 2019 +0000 +++ b/I2CSlaveComm.cpp Wed May 08 15:59:47 2019 +0000 @@ -39,11 +39,12 @@ int offset; //Number of steps }; +//Tensiometer 0 : 1h cycles, irrigation for 10 minutes at every XX:45. struct CycleValues tensiometer0 = { .riseTime = 2700, - .fallTime = 900, - .plateauTime = 0, + .fallTime = 840, + .plateauTime = 30, .stepTime = 30, .highValue = 42, .lowValue = -3, @@ -51,7 +52,8 @@ .stepValueFall = tensiometer0.stepTime * (tensiometer0.lowValue - tensiometer0.highValue) / tensiometer0.fallTime, .offset = 0 }; - + +//Tensiometer 1 : 30 minutes cycles, irrigation for 5 minutes at every XX:15 and XX:45. struct CycleValues tensiometer1 = { .riseTime = 1200, @@ -62,7 +64,7 @@ .lowValue = 0, .stepValueRise = tensiometer1.stepTime * (tensiometer1.highValue - tensiometer1.lowValue) / tensiometer1.riseTime, .stepValueFall = tensiometer1.stepTime * (tensiometer1.lowValue - tensiometer1.highValue) / tensiometer1.fallTime, - .offset = 0 + .offset = 10 }; struct CycleValues tensiometers[2] = {tensiometer0, tensiometer1}; @@ -372,7 +374,8 @@ } else if (offset * tensiometer.stepTime > (tensiometer.riseTime + tensiometer.plateauTime) && offset * tensiometer.stepTime <= (tensiometer.riseTime + tensiometer.plateauTime + tensiometer.fallTime)) { - tension = tensiometer.highValue + (tensiometer.offset * tensiometer.stepValueFall); + int new_offset = tensiometer.offset - ((tensiometer.riseTime + tensiometer.plateauTime) / tensiometer.stepTime); + tension = tensiometer.highValue + (new_offset * tensiometer.stepValueFall); modeSwitch = 2; } else