22 #include <TextBoxNumber.h> 25 #include "PumpController.h" 40 TabVacuum(
PumpController *pumpController,
const __FlashStringHelper * name,
int left,
int top,
int width,
int height) :
Window(name, left, top, width, height)
42 _pumpController = pumpController;
46 initLabel(
new Label(0, 0, 0, 0, F(
"Active")));
47 initLabel(
new Label(0, 0, 0, 0, F(
"min")));
48 initLabel(
new Label(0, 0, 0, 0, F(
"Pause")));
49 initLabel(
new Label(0, 0, 0, 0, F(
"min")));
53 initTextWindow(_txtActive);
56 initTextWindow(_txtPause);
58 _btnStart =
new Button(0, 0, 0, 0, F(
"Start"));
59 initButton(_btnStart);
61 _btnStop =
new Button(0, 0, 0, 0, F(
"Stop"));
66 void initLabel(
Label *label)
76 wnd->SetPrecission(1);
80 void initButton(
Button *btn)
89 int szx =
Width() - 10;
91 int gauge_axis_margins = 5;
94 _gaugeBar =
new GaugeBar(gaugeAxis, 5, 105, szx, szy);
100 Children()[1]->Move(220, 20, 50, 30);
102 Children()[3]->Move(220, 75, 50, 30);
103 _txtActive->
Move(140, 15, 70, 30);
104 _txtPause->
Move(140, 70, 70, 30);
106 _btnStart->
Move(5, 150, 135, 50);
107 _btnStop->
Move(172, 150, 135, 50);
123 if (window == _btnStart)
125 _pumpController->initVacuumValve();
127 _activeTimer.
SetInterval(_txtActive->GetNumber() * 60 * 1000);
128 _pauseTimer.
SetInterval(_txtPause->GetNumber() * 60 * 1000);
133 _gaugeBar->
SetMinMax(0, _txtActive->GetNumber()*60*1000);
137 _pumpController->startVacuum();
139 else if (window == _btnStop)
141 _pumpController->stopVacuum();
144 _activeTimer.
Reset();
157 if (timer == &_updateTimer)
161 out << F(
"Active timer: ")<<_activeTimer.
Elapsed()<<F(
" ");
166 out << F(
"Pause timer: ") << _activeTimer.
Elapsed() << F(
" ");
170 else if (timer == &_activeTimer)
172 _pumpController->stopVacuum();
173 _activeTimer.
Reset();
177 _gaugeBar->
SetMinMax(0, _txtPause->GetNumber() * 60 * 1000);
179 else if (timer == &_pauseTimer)
185 _gaugeBar->
SetMinMax(0, _txtActive->GetNumber() * 60 * 1000);
186 _pumpController->startVacuum();
void NotifyTouch(Window *window)
Events routing for gui interaction (see RegisterTouchEventReceiver and public ITouchEventReceiver dec...
Definition: TabVacuum.h:121
Interface that provides screen touch notifications. If you want receive this notification in the targ...
Definition: ITimerEventReceiver.h:24
void SetBarColor(Color color)
Set Bar color.
Definition: GaugeBar.h:47
void RegisterTouchEventReceiver(ITouchEventReceiver *touchEventReceiver)
Registers receiver for touch event.
Definition: Window.h:102
DecoratorList * GetDecorators()
Returns window decorators list.
Definition: Window.h:81
Base class for all window objects. Provides basic window functionality.
Definition: Window.h:34
bool IsEnabled()
Returns true if timer is active.
Definition: ATimer.h:58
float SetValue(float value)
Sets display value.
Definition: Gauge.h:75
void SetFont(uint8_t *font)
Sets font.
Definition: TextBox.h:64
void SetIsReadOnly(bool isReadOnly)
Defines whether window is readonly.
Definition: TextBoxNumber.h:64
void SetInterval(uint32_t milliseconds)
Set timer interval in milliseconds.
Definition: ATimer.h:53
void Enable()
Starts timer.
Definition: ATimer.h:63
Not implemented yet.
Definition: DecoratorPrimitives.h:151
void Reset()
Disabels timer.
Definition: ATimer.h:69
static Environment * Get()
Returns singltone instance of environment.
Definition: Environment.h:44
Window * RootWindow()
Returns pointer to root window. MainWindow does not have any parents.
Definition: Window.h:133
uint32_t Elapsed()
Returns actual elapsed time.
Definition: ATimer.h:74
Text box for numbers.
Definition: TextBoxNumber.h:24
void SetOffset(int offsetX, int offsetY)
Sets decorator offset in the parent window coordinate system.
Definition: DecoratorPrimitives.h:188
virtual void Move(int left, int top, int width, int height)
Moves and resizes window relativly to the parent window.
Definition: Window.h:149
Axis decorator primitive. It is shared between gauge and chart objects. Overriden members description...
Definition: DecoratorPrimitives.h:145
void RegisterTimerEventReceiver(ITimerEventReceiver *timerEventReceiver)
Registers event receiver.
Definition: ATimer.h:43
LinkedList< Window > & Children()
Returns list of children window.
Definition: Window.h:223
void Invalidate()
If function is called than the window manager updates the window.
Definition: Window.h:157
void NotifyTimer(ATimer *timer)
Events routing for timer.
Definition: TabVacuum.h:155
Tab that implements GUI to vacuum controller.
Definition: TabVacuum.h:28
void Initialize()
Initilizes positions of child windows + timers.
Definition: TabVacuum.h:86
Window(const __FlashStringHelper *name, int left, int top, int width, int height)
Constructor.
Definition: Window.h:60
void AddChild(Window *window)
Adds window child window.
Definition: Window.h:194
void SetNumber(float number)
Initialize window with number.
Definition: TextBoxNumber.h:74
virtual void SetDecorators(DecoratorList *decorators)
Sets window decorators list.
Definition: Window.h:76
Base class for main application window. Each application has to have one main window, which is root parent for all other application windows.
Definition: MainWindow.h:38
void SetAutoReset(bool isAutoreset)
Set whether timer is in autoreset modus.
Definition: ATimer.h:48
void SetMinMax(float minVal, float maxVal)
Sets values range.
Definition: Gauge.h:65
void SetFillColor(Color fillColor)
Sets fill color.
Definition: Gauge.h:56
Interface that provides screen touch notifications. If you want receive this notification in the targ...
Definition: ITouchEventReceiver.h:24
Implements pump control logic.
Definition: PumpController.h:22
int Width()
Returns window width.
Definition: Window.h:184
Bar gauge class.
Definition: GaugeBar.h:25
Implement Label control.
Definition: Label.h:24
void SetMargins(int offset_x, int offset_y)
Defines offset from left and top for text.
Definition: TextBox.h:58