Send calibration data (on keystroke, Linux cmdline only)

This commit is contained in:
PaulStoffregen 2016-03-13 06:18:44 -07:00
commit 61cab7d7cd
5 changed files with 139 additions and 3 deletions

View file

@ -21,6 +21,23 @@ static void glut_display_callback(void)
glutSwapBuffers();
}
static void glut_keystroke_callback(unsigned char ch, int x, int y)
{
if (magcal.fFitErrorpc > 9.0) {
printf("Poor Calibration: ");
printf("soft iron fit error = %.1f%%\n", magcal.fFitErrorpc);
return;
}
printf("Magnetic Calibration: (%.1f%% fit error)\n", magcal.fFitErrorpc);
printf(" %7.2f %6.3f %6.3f %6.3f\n",
magcal.fV[0], magcal.finvW[0][0], magcal.finvW[0][1], magcal.finvW[0][2]);
printf(" %7.2f %6.3f %6.3f %6.3f\n",
magcal.fV[1], magcal.finvW[1][0], magcal.finvW[1][1], magcal.finvW[1][2]);
printf(" %7.2f %6.3f %6.3f %6.3f\n",
magcal.fV[2], magcal.finvW[2][0], magcal.finvW[2][1], magcal.finvW[2][2]);
send_calibration();
}
int main(int argc, char *argv[])
{
raw_data_reset();
@ -35,6 +52,7 @@ int main(int argc, char *argv[])
glutReshapeFunc(resize_callback);
glutDisplayFunc(glut_display_callback);
glutTimerFunc(TIMEOUT_MSEC, timer_callback, 0);
glutKeyboardFunc(glut_keystroke_callback);
if (!open_port(PORT)) die("Unable to open %s\n", PORT);
glutMainLoop();