During the last weekend I wanted to implement the use of a joystick for a better usage of the program as it is a little troublesome to rech for the tablet during basic tasks so I wanted to implement the Joystick from the cerea projekt.
The Project I used as the basis is this one from the Cerea forum.
Cerea joystick
To implement the functions in AG Open GPS I basically copied the work of GialucaRav from this Thread and changed it a little bit to fit more of my needs
Esp 32 bluetooth joystick
To set this up you need the following parts.
Arduino Leonardo/ Arduino Pro Micro
A regular Arduino UNO wont work as it doesnt support HID and therefore cant be used as a keyboard.
Some Jumper cables
A USB Cable for the Arduino to the HUB
Some cheap Push buttons for the controls
Some 50k Resistors.
You have to wire up the Arduino like this
I used the following sketch for the Arduino
AGopen_Joystick_6_Funktionen.ino (3,9 KB)
The keyboard print function doesnt work with agopen the HID library needs to be included
for it to work as it gives out actual keyboard strokes and not only the letters.
My programming knowledge basically amounts to pattern recognition so the code is probably subpar but it works.
To use all of the shortcuts implemented in the script, you have to edit the source Code of Ag Open and publish your own version
Therefore follow this path: Sourcecode>GPS>Forms>UDPComm.Designer
I used Microsoft Visual Studio to edit the Code
You have to include the following lines of Code under the region keystrokes in the File.
//A-B linie verstellen
if (keyData == (Keys.O)) // Full Screen click
{
btnCycleLines.PerformClick();
return true; // indicate that you handled this keystroke
}
// U Turn aktivieren
if (keyData == (Keys.U)) // Full Screen click
{
btnAutoYouTurn.PerformClick();
return true; // indicate that you handled this keystroke
}
// TB wegschalten links
if (keyData == (Keys.L)) // Full Screen click
{
btnSection1Man.PerformClick();
return true; // indicate that you handled this keystroke
}
// TB wegschalten rechts
if (keyData == (Keys.I)) // Full Screen click
{
btnSection8Man.PerformClick();
return true; // indicate that you handled this keystroke
Afterwards you have to publish your own Version of AG open and the changes will only be in that specific Version so they will be gone with each new Update.
I edited it to my specific needs as I use Sprayer with 8 sections and have to switch away the outer sections regularly this obviously would be different for other users.
The other Functions use the already build in hotkeys of Agopen like “a” for Autosteer “m” for auto sections and “n” to mark the applied area during work.
I would like to implement features to snap the AB left and right like GialucaRav did but unfortuneatly that doesnt seem to work with version 5 and my programming knowledge is to limited for this as the icons only appear after activating Autosteer. Maybe someone here could help with that?
EDIT:
I found a working solution
if (keyData == (Keys.L)) //snap A-B line left
{
if (ABLine.isBtnABLineOn || curve.isBtnCurveOn)
if (isLateralOn)
{
if (isTT)
{
MessageBox.Show(gStr.h_lblLateralTurnTouch, gStr.gsHelp);
ResetHelpBtn();
return true;
}
yt.BuildManualYouLateral(false);
return true;
}
}
if (keyData == (Keys.R)) //snap A-B line Right
{
if (ABLine.isBtnABLineOn || curve.isBtnCurveOn)
if (isLateralOn)
{
if (isTT)
{
MessageBox.Show(gStr.h_lblLateralTurnTouch, gStr.gsHelp);
ResetHelpBtn();
return true;
}
yt.BuildManualYouLateral(true);
return true;
}
}
I think it could be very usefull to build in more hotkeys for certain tasks.
maybe we can find a working solution here that can be implemented into the main build of AGopen.
Thanks to all the guys that publish their work like GialucaRav otherwise I wouldnt be able to change anything as I have basically no programming skills except the use of copy and paste.
I hope this can help someone that had the same problems implementing the Cerea joystick for example
This is the “joystick” in Action.