My final year project

Dependencies:   BSP_DISCO_F746NG F746_GUI LCD_DISCO_F746NG SDFileSystem TS_DISCO_F746NG ResistiveTouchController Map CYS8218Controller MedianFilter

Committer:
Generic
Date:
Wed Oct 26 10:40:54 2016 +0000
Revision:
62:58e846621435
Parent:
26:f57db8d6d79e
Firmware

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kerneels.bez@gmail.com 24:70d7fd892334 1 #include "ChangeValScreen.hpp"
kerneels.bez@gmail.com 24:70d7fd892334 2
kerneels.bez@gmail.com 24:70d7fd892334 3 ChangeValScreen::ChangeValScreen(int *nextScreen, int prevScreen, float *valueToChange, string title) :
kerneels.bez@gmail.com 24:70d7fd892334 4 Screen(),
Kerneels Bezuidenhout 26:f57db8d6d79e 5 _lbTitle( SCREEN_W/2, 0, title, Label::CENTER, Font24),
kerneels.bez@gmail.com 24:70d7fd892334 6 _btBack( 0, SCREEN_H-30, 100, 30, "Back"),
kerneels.bez@gmail.com 24:70d7fd892334 7 _btSave( SCREEN_W-100, SCREEN_H-30, 100, 30, "Save"),
Kerneels Bezuidenhout 26:f57db8d6d79e 8 _npValue( 0, 48, SCREEN_W, SCREEN_H-83),
kerneels.bez@gmail.com 24:70d7fd892334 9 _nlbValue(SCREEN_W/2, 26, "%.3f", *valueToChange, Label::CENTER, Font20)
kerneels.bez@gmail.com 24:70d7fd892334 10 {
kerneels.bez@gmail.com 24:70d7fd892334 11 _nextScreen = nextScreen;
kerneels.bez@gmail.com 24:70d7fd892334 12 _prevScreen = prevScreen;
kerneels.bez@gmail.com 24:70d7fd892334 13 _value = valueToChange;
kerneels.bez@gmail.com 24:70d7fd892334 14 }
kerneels.bez@gmail.com 24:70d7fd892334 15
kerneels.bez@gmail.com 24:70d7fd892334 16 void ChangeValScreen::Draw()
kerneels.bez@gmail.com 24:70d7fd892334 17 {
kerneels.bez@gmail.com 24:70d7fd892334 18 Clear();
kerneels.bez@gmail.com 24:70d7fd892334 19 _lbTitle.Draw();
kerneels.bez@gmail.com 24:70d7fd892334 20 _btBack.Draw();
kerneels.bez@gmail.com 24:70d7fd892334 21 _btSave.Draw();
Kerneels Bezuidenhout 26:f57db8d6d79e 22 _nlbValue.Draw();
kerneels.bez@gmail.com 24:70d7fd892334 23 _npValue.Draw();
kerneels.bez@gmail.com 24:70d7fd892334 24 _nlbValue.Draw();
kerneels.bez@gmail.com 24:70d7fd892334 25 }
kerneels.bez@gmail.com 24:70d7fd892334 26
kerneels.bez@gmail.com 24:70d7fd892334 27 void ChangeValScreen::Process()
kerneels.bez@gmail.com 24:70d7fd892334 28 {
kerneels.bez@gmail.com 24:70d7fd892334 29 if( _btBack.Touched() )
Kerneels Bezuidenhout 26:f57db8d6d79e 30 *_nextScreen = _prevScreen;
kerneels.bez@gmail.com 24:70d7fd892334 31
kerneels.bez@gmail.com 24:70d7fd892334 32 if( _btSave.Touched() )
kerneels.bez@gmail.com 24:70d7fd892334 33 {
Kerneels Bezuidenhout 25:bfff3d661f92 34 *_value = _npValue.GetVal();
Kerneels Bezuidenhout 26:f57db8d6d79e 35 *_nextScreen = _prevScreen;
kerneels.bez@gmail.com 24:70d7fd892334 36 }
kerneels.bez@gmail.com 24:70d7fd892334 37
kerneels.bez@gmail.com 24:70d7fd892334 38 if( _npValue.Touched() )
kerneels.bez@gmail.com 24:70d7fd892334 39 {
Kerneels Bezuidenhout 26:f57db8d6d79e 40 _nlbValue.Draw("%.3f",_npValue.GetVal() );
Kerneels Bezuidenhout 26:f57db8d6d79e 41 Thread::wait(200);
kerneels.bez@gmail.com 24:70d7fd892334 42 }
kerneels.bez@gmail.com 24:70d7fd892334 43
Kerneels Bezuidenhout 26:f57db8d6d79e 44 if( _btSave.Touched() )
kerneels.bez@gmail.com 24:70d7fd892334 45 {
kerneels.bez@gmail.com 24:70d7fd892334 46 *_value = _npValue.GetVal();
Kerneels Bezuidenhout 26:f57db8d6d79e 47 *_nextScreen = _prevScreen;
kerneels.bez@gmail.com 24:70d7fd892334 48 }
kerneels.bez@gmail.com 24:70d7fd892334 49 }