some print formatting cleanup
This commit is contained in:
parent
d5777031e4
commit
4b0959ecaa
|
@ -40,8 +40,8 @@ static constexpr uint32_t VALID_MARKER_DEFAULT = 0xcafecall;
|
||||||
union NonVolatileMemory {
|
union NonVolatileMemory {
|
||||||
/// place hard-coded start marker at the beginning of the data
|
/// place hard-coded start marker at the beginning of the data
|
||||||
/// to indicate validity
|
/// to indicate validity
|
||||||
uint32_t validMarker = VALID_MARKER_DEFAULT;
|
|
||||||
struct Calibration {
|
struct Calibration {
|
||||||
|
uint32_t validMarker = VALID_MARKER_DEFAULT;
|
||||||
JoystickCalibration joystickCal;
|
JoystickCalibration joystickCal;
|
||||||
LinearAnalogCalibration linearCal;
|
LinearAnalogCalibration linearCal;
|
||||||
} __attribute__((packed)) calData;
|
} __attribute__((packed)) calData;
|
||||||
|
|
21
src/main.cpp
21
src/main.cpp
|
@ -19,12 +19,12 @@ bool runJoystickCalibrationRoutine(AlignedJoy& joy, JoystickCalibration& cal) {
|
||||||
*/
|
*/
|
||||||
// CALIBRATION 1
|
// CALIBRATION 1
|
||||||
Serial.print(
|
Serial.print(
|
||||||
"Center Joystick Calibration \n\nLeave the joystick in the centre position during the "
|
" Center calibration \n\n Leave the joystick in the centre position during "
|
||||||
"calibration\ntime which is set to ");
|
"the calibration\n time which is set to ");
|
||||||
Serial.print(TIME_CAL_1);
|
Serial.print(TIME_CAL_1);
|
||||||
Serial.println(" milliseconds.");
|
Serial.println(" milliseconds.");
|
||||||
delay(5000);
|
delay(5000);
|
||||||
Serial.println("Calibration started!");
|
Serial.println(" Calibration started!");
|
||||||
delay(500);
|
delay(500);
|
||||||
/*
|
/*
|
||||||
* for calibrate the joystick center point use "centerCalibration" method;
|
* for calibrate the joystick center point use "centerCalibration" method;
|
||||||
|
@ -32,7 +32,7 @@ bool runJoystickCalibrationRoutine(AlignedJoy& joy, JoystickCalibration& cal) {
|
||||||
* milliseconds
|
* milliseconds
|
||||||
*/
|
*/
|
||||||
joy.middleCalibration(TIME_CAL_1);
|
joy.middleCalibration(TIME_CAL_1);
|
||||||
Serial.println("Joystick Centered!");
|
Serial.println(" Joystick Centered!");
|
||||||
delay(2000);
|
delay(2000);
|
||||||
|
|
||||||
// CALIBRATION 2
|
// CALIBRATION 2
|
||||||
|
@ -42,12 +42,12 @@ bool runJoystickCalibrationRoutine(AlignedJoy& joy, JoystickCalibration& cal) {
|
||||||
* the calibration time.
|
* the calibration time.
|
||||||
*/
|
*/
|
||||||
Serial.print(
|
Serial.print(
|
||||||
"Start axes Calibration \n\nRotate the joystick in a circular way along its "
|
" Start axes calibration \n\n Rotate the joystick in a circular way along its "
|
||||||
"circumference\nthroughout the calibration time (");
|
"circumference\n throughout the calibration time (");
|
||||||
Serial.print(TIME_CAL_2);
|
Serial.print(TIME_CAL_2);
|
||||||
Serial.println(" milliseconds).");
|
Serial.println(" milliseconds).");
|
||||||
delay(5000);
|
delay(5000);
|
||||||
Serial.println("Calibration started!");
|
Serial.println(" Calibration started!");
|
||||||
delay(500);
|
delay(500);
|
||||||
/*
|
/*
|
||||||
* for calibrate the joystick axes points use "axesCalibration" method (bool type);
|
* for calibrate the joystick axes points use "axesCalibration" method (bool type);
|
||||||
|
@ -55,10 +55,10 @@ bool runJoystickCalibrationRoutine(AlignedJoy& joy, JoystickCalibration& cal) {
|
||||||
* milliseconds.
|
* milliseconds.
|
||||||
*/
|
*/
|
||||||
if (joy.axesCalibration(TIME_CAL_2)) {
|
if (joy.axesCalibration(TIME_CAL_2)) {
|
||||||
Serial.println("Calibration succesfull!");
|
Serial.println(" Calibration succesfull!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Serial.println("Calibration failed!");
|
Serial.println(" Calibration failed!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ bool runJoystickCalibrationRoutine(AlignedJoy& joy, JoystickCalibration& cal) {
|
||||||
* point values use getCalibratedPoint(axis_t axis, point_t point). The parameters: the labels
|
* point values use getCalibratedPoint(axis_t axis, point_t point). The parameters: the labels
|
||||||
* of the "axis_t" shall be X and Y; the labels of "point_t" is MIN, MID and MAX.
|
* of the "axis_t" shall be X and Y; the labels of "point_t" is MIN, MID and MAX.
|
||||||
*/
|
*/
|
||||||
Serial.print("X min -> ");
|
Serial.print(" X min -> ");
|
||||||
Serial.print(joy.getCalibratedPoint(X, MIN));
|
Serial.print(joy.getCalibratedPoint(X, MIN));
|
||||||
Serial.print(" | center -> ");
|
Serial.print(" | center -> ");
|
||||||
Serial.print(joy.getCalibratedPoint(X, MID));
|
Serial.print(joy.getCalibratedPoint(X, MID));
|
||||||
|
@ -114,6 +114,7 @@ void setup() {
|
||||||
calibrationInvalid |=
|
calibrationInvalid |=
|
||||||
!nvm.calData.joystickCal.x.valid() || !nvm.calData.joystickCal.y.valid();
|
!nvm.calData.joystickCal.x.valid() || !nvm.calData.joystickCal.y.valid();
|
||||||
if (calibrationInvalid) {
|
if (calibrationInvalid) {
|
||||||
|
Serial.println("Joystick1 calibration required\n========================");
|
||||||
calibrationInvalid |=
|
calibrationInvalid |=
|
||||||
!runJoystickCalibrationRoutine(joystick_1, nvm.calData.joystickCal);
|
!runJoystickCalibrationRoutine(joystick_1, nvm.calData.joystickCal);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue