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 {
|
||||
/// place hard-coded start marker at the beginning of the data
|
||||
/// to indicate validity
|
||||
uint32_t validMarker = VALID_MARKER_DEFAULT;
|
||||
struct Calibration {
|
||||
uint32_t validMarker = VALID_MARKER_DEFAULT;
|
||||
JoystickCalibration joystickCal;
|
||||
LinearAnalogCalibration linearCal;
|
||||
} __attribute__((packed)) calData;
|
||||
|
|
21
src/main.cpp
21
src/main.cpp
|
@ -19,12 +19,12 @@ bool runJoystickCalibrationRoutine(AlignedJoy& joy, JoystickCalibration& cal) {
|
|||
*/
|
||||
// CALIBRATION 1
|
||||
Serial.print(
|
||||
"Center Joystick Calibration \n\nLeave the joystick in the centre position during the "
|
||||
"calibration\ntime which is set to ");
|
||||
" Center calibration \n\n Leave the joystick in the centre position during "
|
||||
"the calibration\n time which is set to ");
|
||||
Serial.print(TIME_CAL_1);
|
||||
Serial.println(" milliseconds.");
|
||||
delay(5000);
|
||||
Serial.println("Calibration started!");
|
||||
Serial.println(" Calibration started!");
|
||||
delay(500);
|
||||
/*
|
||||
* for calibrate the joystick center point use "centerCalibration" method;
|
||||
|
@ -32,7 +32,7 @@ bool runJoystickCalibrationRoutine(AlignedJoy& joy, JoystickCalibration& cal) {
|
|||
* milliseconds
|
||||
*/
|
||||
joy.middleCalibration(TIME_CAL_1);
|
||||
Serial.println("Joystick Centered!");
|
||||
Serial.println(" Joystick Centered!");
|
||||
delay(2000);
|
||||
|
||||
// CALIBRATION 2
|
||||
|
@ -42,12 +42,12 @@ bool runJoystickCalibrationRoutine(AlignedJoy& joy, JoystickCalibration& cal) {
|
|||
* the calibration time.
|
||||
*/
|
||||
Serial.print(
|
||||
"Start axes Calibration \n\nRotate the joystick in a circular way along its "
|
||||
"circumference\nthroughout the calibration time (");
|
||||
" Start axes calibration \n\n Rotate the joystick in a circular way along its "
|
||||
"circumference\n throughout the calibration time (");
|
||||
Serial.print(TIME_CAL_2);
|
||||
Serial.println(" milliseconds).");
|
||||
delay(5000);
|
||||
Serial.println("Calibration started!");
|
||||
Serial.println(" Calibration started!");
|
||||
delay(500);
|
||||
/*
|
||||
* for calibrate the joystick axes points use "axesCalibration" method (bool type);
|
||||
|
@ -55,10 +55,10 @@ bool runJoystickCalibrationRoutine(AlignedJoy& joy, JoystickCalibration& cal) {
|
|||
* milliseconds.
|
||||
*/
|
||||
if (joy.axesCalibration(TIME_CAL_2)) {
|
||||
Serial.println("Calibration succesfull!");
|
||||
Serial.println(" Calibration succesfull!");
|
||||
}
|
||||
else {
|
||||
Serial.println("Calibration failed!");
|
||||
Serial.println(" Calibration failed!");
|
||||
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
|
||||
* 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(" | center -> ");
|
||||
Serial.print(joy.getCalibratedPoint(X, MID));
|
||||
|
@ -114,6 +114,7 @@ void setup() {
|
|||
calibrationInvalid |=
|
||||
!nvm.calData.joystickCal.x.valid() || !nvm.calData.joystickCal.y.valid();
|
||||
if (calibrationInvalid) {
|
||||
Serial.println("Joystick1 calibration required\n========================");
|
||||
calibrationInvalid |=
|
||||
!runJoystickCalibrationRoutine(joystick_1, nvm.calData.joystickCal);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue