Enabled joystick

This commit is contained in:
Thomas Basler 2020-08-28 19:38:46 +02:00
parent 1fe0f33586
commit 9411b6e615
1 changed files with 16 additions and 9 deletions

View File

@ -3965,22 +3965,29 @@
* Analog Joystick(s)
* @section joystick
*/
//#define JOYSTICK
#define JOYSTICK
#if ENABLED(JOYSTICK)
#define JOY_X_PIN 5 // RAMPS: Suggested pin A5 on AUX2
#define JOY_Y_PIN 10 // RAMPS: Suggested pin A10 on AUX2
#define JOY_Z_PIN 12 // RAMPS: Suggested pin A12 on AUX2
#define JOY_EN_PIN 44 // RAMPS: Suggested pin D44 on AUX2
#define JOY_X_PIN P0_23 // RAMPS: Suggested pin A5 on AUX2
#define JOY_Y_PIN P0_24 // RAMPS: Suggested pin A10 on AUX2
#define JOY_Z_PIN P0_25 // RAMPS: Suggested pin A12 on AUX2
//#define JOY_EN_PIN 44 // RAMPS: Suggested pin D44 on AUX2
//#define INVERT_JOY_X // Enable if X direction is reversed
//#define INVERT_JOY_Y // Enable if Y direction is reversed
//#define INVERT_JOY_Z // Enable if Z direction is reversed
// MPCNC Calculation
// Voltage divider with 4,7k --> VCC (3.3V) on the board
// and 10k --> GND via wheel
// Results in a max voltage of 2.24V = 67,9% of max voltage
// 4095 (12bit ADC) * 0,679 = 2781 --> max value
// Avg. value would be 1390
// Use M119 with JOYSTICK_DEBUG to find reasonable values after connecting:
#define JOY_X_LIMITS { 5600, 8190-100, 8190+100, 10800 } // min, deadzone start, deadzone end, max
#define JOY_Y_LIMITS { 5600, 8250-100, 8250+100, 11000 }
#define JOY_Z_LIMITS { 4800, 8080-100, 8080+100, 11550 }
//#define JOYSTICK_DEBUG
#define JOY_X_LIMITS { 70, 1425-20, 1425+20, 2830 } // min, deadzone start, deadzone end, max
#define JOY_Y_LIMITS { 70, 1380-20, 1380+20, 2850 }
#define JOY_Z_LIMITS { 74, 1355-20, 1355+20, 2800 }
#define JOYSTICK_DEBUG
#endif
/**