My final year project
Dependencies: BSP_DISCO_F746NG F746_GUI LCD_DISCO_F746NG SDFileSystem TS_DISCO_F746NG ResistiveTouchController Map CYS8218Controller MedianFilter
Diff: Screens/CalibrateScreen.cpp
- Revision:
- 37:93c7563f2078
- Parent:
- 35:6baa558d3b86
- Child:
- 38:f1c571d22919
--- a/Screens/CalibrateScreen.cpp Mon Oct 03 17:43:28 2016 +0200 +++ b/Screens/CalibrateScreen.cpp Mon Oct 03 18:14:33 2016 +0200 @@ -1,6 +1,6 @@ #include "CalibrateScreen.hpp" -CalibrateScreen::CalibrateScreen(int *nextScreen, int *ballOnPlate, bool *calStarted, int *calPoint, float *calHeldTime) : +CalibrateScreen::CalibrateScreen(int *nextScreen, int *ballOnPlate, bool *calStarted, bool *calFinished, int *calPoint, float *calHeldTime) : Screen(), _lbTitle( SCREEN_W/2, 0, "Calibrate", Label::CENTER, Font24), _btBack( 0, SCREEN_H-30, 100, 30, "Back"), @@ -10,6 +10,8 @@ _ballOnPlate = ballOnPlate; _calStarted = calStarted; _calHeldTime = calHeldTime; + _calPoint = calPoint; + _calFinished = calFinished; } void CalibrateScreen::Draw() @@ -26,6 +28,7 @@ { if( _btBack.Touched() ) { + *_calFinished = false; *_calStarted = false; *_calPoint = 0; *_nextScreen = MAIN_SETTINGS_SCREEN; @@ -41,20 +44,20 @@ if( *_ballOnPlate ) { float _tempHeldTime = 5; - _tempHeldTime -= *_heldTime; + _tempHeldTime -= *_calHeldTime; if( _tempHeldTime <= 0 ) { - sprintf(message, "Release"); + sprintf(_message, "Release"); } else { - sprintf(message, "%.0f", _tempHeldTime); + sprintf(_message, "%.0f", _tempHeldTime); } } else { - sprintf(message, "Touch and hold position %d", *_pointToMeasure); + sprintf(_message, "Touch and hold position %d", *_calPoint+1); } } else @@ -65,7 +68,14 @@ } else { - *_calStarted = true; + if( *_calFinished ) + { + sprintf(_message, "Calibration Done"); + } + else + { + *_calStarted = true; + } } }