@@ -68,13 +68,13 @@ Joystick joystick;
68
68
void Joystick::report () {
69
69
SERIAL_ECHOPGM (" Joystick" );
70
70
#if HAS_JOY_ADC_X
71
- SERIAL_ECHOPGM_P (SP_X_STR, JOY_X (x.raw ));
71
+ SERIAL_ECHOPGM_P (SP_X_STR, JOY_X (x.getraw () ));
72
72
#endif
73
73
#if HAS_JOY_ADC_Y
74
- SERIAL_ECHOPGM_P (SP_Y_STR, JOY_Y (y.raw ));
74
+ SERIAL_ECHOPGM_P (SP_Y_STR, JOY_Y (y.getraw () ));
75
75
#endif
76
76
#if HAS_JOY_ADC_Z
77
- SERIAL_ECHOPGM_P (SP_Z_STR, JOY_Z (z.raw ));
77
+ SERIAL_ECHOPGM_P (SP_Z_STR, JOY_Z (z.getraw () ));
78
78
#endif
79
79
#if HAS_JOY_ADC_EN
80
80
SERIAL_ECHO_TERNARY (READ (JOY_EN_PIN), " EN=" , " HIGH (dis" , " LOW (en" , " abled)" );
@@ -91,29 +91,29 @@ Joystick joystick;
91
91
if (READ (JOY_EN_PIN)) return ;
92
92
#endif
93
93
94
- auto _normalize_joy = [](float &axis_jog, const int16_t raw, const int16_t (&joy_limits)[4 ]) {
94
+ auto _normalize_joy = [](float &axis_jog, const raw_adc_t raw, const raw_adc_t (&joy_limits)[4 ]) {
95
95
if (WITHIN (raw, joy_limits[0 ], joy_limits[3 ])) {
96
96
// within limits, check deadzone
97
97
if (raw > joy_limits[2 ])
98
98
axis_jog = (raw - joy_limits[2 ]) / float (joy_limits[3 ] - joy_limits[2 ]);
99
99
else if (raw < joy_limits[1 ])
100
- axis_jog = (raw - joy_limits[1 ]) / float (joy_limits[1 ] - joy_limits[0 ]); // negative value
100
+ axis_jog = int16_t (raw - joy_limits[1 ]) / float (joy_limits[1 ] - joy_limits[0 ]); // negative value
101
101
// Map normal to jog value via quadratic relationship
102
102
axis_jog = SIGN (axis_jog) * sq (axis_jog);
103
103
}
104
104
};
105
105
106
106
#if HAS_JOY_ADC_X
107
- static constexpr int16_t joy_x_limits[4 ] = JOY_X_LIMITS;
108
- _normalize_joy (norm_jog.x , JOY_X (x.raw ), joy_x_limits);
107
+ static constexpr raw_adc_t joy_x_limits[4 ] = JOY_X_LIMITS;
108
+ _normalize_joy (norm_jog.x , JOY_X (x.getraw () ), joy_x_limits);
109
109
#endif
110
110
#if HAS_JOY_ADC_Y
111
- static constexpr int16_t joy_y_limits[4 ] = JOY_Y_LIMITS;
112
- _normalize_joy (norm_jog.y , JOY_Y (y.raw ), joy_y_limits);
111
+ static constexpr raw_adc_t joy_y_limits[4 ] = JOY_Y_LIMITS;
112
+ _normalize_joy (norm_jog.y , JOY_Y (y.getraw () ), joy_y_limits);
113
113
#endif
114
114
#if HAS_JOY_ADC_Z
115
- static constexpr int16_t joy_z_limits[4 ] = JOY_Z_LIMITS;
116
- _normalize_joy (norm_jog.z , JOY_Z (z.raw ), joy_z_limits);
115
+ static constexpr raw_adc_t joy_z_limits[4 ] = JOY_Z_LIMITS;
116
+ _normalize_joy (norm_jog.z , JOY_Z (z.getraw () ), joy_z_limits);
117
117
#endif
118
118
}
119
119
0 commit comments