Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BSP_DISCO_F746NG F746_GUI LCD_DISCO_F746NG SDFileSystem TS_DISCO_F746NG ResistiveTouchController Map CYS8218Controller MedianFilter
Screens/ManualSetpointScreen.cpp
- Committer:
- Kerneels Bezuidenhout
- Date:
- 2016-10-03
- Revision:
- 22:dd9ff475b34c
- Parent:
- 21:aa3074b237e0
- Child:
- 23:bab197887d5e
File content as of revision 22:dd9ff475b34c:
#include "ManualSetpointScreen.hpp" ManualSetpointScreen::ManualSetpointScreen(int *nextScreen, float *xSP, float *ySP, int *ballOnPlate, bool *started) : Screen(), _lbTitle( SCREEN_W/2, 0, "Manual Setpoint", Label::CENTER, Font24), _btBack( 0, SCREEN_H-30, 100, 30, "Back"), _tpSetpoint( (SCREEN_W/2)-90 ,57, 180,180, -120.0, 120.0, -136,136), _btStart( 110, SCREEN_H-30, SCREEN_W-220, 30, "Start"), _btStop( 110, SCREEN_H-30, SCREEN_W-220, 30, "Stop"), _nlbXSP(0,26,"x (mm)=%.0f",*xSP), _nlbYSP(0,40,"y (mm)=%.0f",*ySP), _btReset( SCREEN_W-100, SCREEN_H-30, 100, 30, "Reset") { _nextScreen = nextScreen; _xSP = xSP; _ySP = ySP; *_xSP = 0; *_ySP = 0; _ballOnPlate = ballOnPlate; _started = started; } void ManualSetpointScreen::Draw() { Clear(); _lbTitle.Draw(); _btBack.Draw(); _tpSetpoint.Draw(); _btStop.Inactivate(); _btStart.Inactivate(); _btStart.Draw(); _nlbXSP.Draw(); _nlbYSP.Draw(); _btReset.Draw(); } void ManualSetpointScreen::Process() { if( _btBack.Touched() ) { //TODO Stop control system if running *_nextScreen = AUTOMATIC_MORE_SCREEN; } if( _tpSetpoint.Touched() ) { _tpSetpoint.Update(); *_xSP = floor(_tpSetpoint.GetX()); *_ySP = floor(_tpSetpoint.GetY()); _nlbXSP.Draw("x (mm)=%.0f",*xSP),); _nlbYSP.Draw("y (mm)=%.0f",*ySP),); } if( _btReset.Touched() ) { _tpSetpoint.Reset(); _btReset.Draw(); *_xSP = floor(_tpSetpoint.GetX()); *_ySP = floor(_tpSetpoint.GetY()); _nlbXSP.Draw("x (mm)=%.0f",*xSP),); _nlbYSP.Draw("y (mm)=%.0f",*ySP),); } if( _btStart.IsActive() ) { if( !*_ballOnPlate ) _btStart.Inactivate(); else if( _btStart.Touched() ) { _btStart.Inactivate(); _btStart.Erase(); _btStop.Activate(); _btStop.Draw(0xFFFF0000); Thread::wait(200); *_started = true; } } else if( _btStop.IsActive() ) { if( _btStop.Touched() ) { _btStop.Inactivate(); _btStop.Erase(); _btStart.Activate(); _btStart.Draw(0xFF00FF00); Thread::wait(200); *_started = false; } } else if( *_ballOnPlate ) { if( !_btStop.IsActive() ) { _btSta.Activate(); _btStart.Drwa(0xFF00FF00); } } }