The Combine Forum banner

21 - 25 of 25 Posts

·
Registered
Joined
·
32 Posts
Updated tree plant on github AgOpenGPS_Dev.

Here is the code for triggering in position.cs



Code:
            //tree spacing
            if (vehicle.treeSpacing != 0 && section[0].isSectionOn) treeSpacingCounter += (distanceCurrentStepFix*100);

            //keep the distance below spacing
            if (treeSpacingCounter > vehicle.treeSpacing && vehicle.treeSpacing != 0)
            {
                if (treeTrigger == 0) treeTrigger = 1;
                else treeTrigger = 0;
                while (treeSpacingCounter > vehicle.treeSpacing) treeSpacingCounter -= vehicle.treeSpacing;
            }

I’ve taken a while and took some online courses and done some sample programs. The C# is close enough to working with the Arduino that I’m finding it easy to work with. Haven’t gotten into the other areas yet.

I have attempted to make your code more dumby readable. If any of my comments are out of line please let me know.

All said and done I think I need to look for where treeTrigger = 1 is being passed to the ardduino and lastly triggering the relay. I’m on to that search next. Any hints will be appreciated!!

------------------------------ code xplination??? -----------------------------------------

Vehicle.treeSpacing vaue is set in the tree settings area
.
From there as the code executes and we fall into the section that tests for:

if (vehicle.treeSpacing not equal to 0 and section[0] (section 0 (we can only have 1 section set)) .isSectionOn ( test that the section is on)) treeSpacingCounter += (increment higher)
(distanceCurrentStepFix*100);

(If this first statement is true then the next in is exicued)

If treeSpacingCounter is grater than vehicle.treeSpacing and vehicle.treeSpacingis is not equal to 0
{
if (treeTrigger == (is equal to) 0) treeTrigger = 1 (set treeTriger to 1)
if the statement above is false
else treeTrigger = (set treeTrigger to ) 0;

while (treeSpacingCounter > (is grater than) vehicle.treeSpacing) treeSpacingCounter -=(minus) vehicle.treeSpacing;
(do the above loop until the above line returns a true value)
}
 
21 - 25 of 25 Posts
Top