PS_Fgen_FW  4da88f4073c1cc65ea45c3a652a2751e495e50db
Firmware for an Power Supply and Function Generator build from an ATX power supply
Loading...
Searching...
No Matches
ScreenManager.h
Go to the documentation of this file.
1
7
8#ifndef SCREENMANAGER_H_
9#define SCREENMANAGER_H_
10
11#include <Arduino.h>
12#include <SPI.h>
13#include "Adafruit_GFX.h"
14#include "Adafruit_ILI9341.h"
15
16#include "../Encoder/Encoder.h"
17#include "../KeyPad/KeyPad.h"
18#include "../Configuration.h"
19#include "UI_Lib.h"
20#include "Icons.h"
21#include <string.h>
22
23#ifdef TOUCH_ENABLED
24 #include "XPT2046.h"
25#endif
26
27#define DISPLAY_WIDTH 320
28#define DISPLAY_HEIGHT 240
29#define STATUS_BAR_HEIGHT 30
30#define MSG_DIALOG_MARGIN 20
31
32#ifdef TOUCH_ENABLED
42#endif
43
49typedef enum ScreenTypes
50{
51#ifdef PS_SUBSYSTEM_ENABLED
53#endif
54#ifdef DDS_SUBSYSTEM_ENABLED
56#endif
57#ifdef MEASURE_SUBSYSTEM_ENABLED
59#endif
63
64#ifdef SPLASHSCREEN_ENABLED
69 UIElement* uiBuildSplashScreen();
70#endif
71
72#ifdef PS_SUBSYSTEM_ENABLED
77 UIElement* uiBuildScreenPS();
78#endif
79
80#ifdef DDS_SUBSYSTEM_ENABLED
85 UIElement* uiBuildScreenDDS();
86#endif
87
88#ifdef MEASURE_SUBSYSTEM_ENABLED
93 UIElement* uiBuildScreenMeasure();
94#endif
95
100UIElement* uiBuildScreenSettings();
101
106UIElement* uiBuildScreenCalibration();
107
112UIElement* StartCalibration();
113
114#ifdef MEASURE_SUBSYSTEM_ENABLED
119#endif
120
121#ifdef DDS_SUBSYSTEM_ENABLED
126#endif
127
133{
134 private:
135 Adafruit_ILI9341 _tft;
136
137 #ifdef TOUCH_ENABLED
139 unsigned long _touchStartTime = 0;
141 #endif
142
147 void uiBuildTree();
148
149 public:
152
156 #ifdef TOUCH_ENABLED
158 #endif
159
161 void Init();
162 void UpdateVisibilities();
163
164 void DoDraw();
165
166 void ShowUiMainPage();
167 void ShowUiCalibrationMenu();
168
173 void ShowHideDeviceRWLMessage(bool showMessage);
174
179 void DeviceTimerTickISR();
180
185 void UpdateSettingsChangedIndicator(bool settingsChanged);
186
191 void UpdateCalibrationValidIndicator(bool calibrationValid);
192
197 void KeyInput(Keys_t key);
198
199 #ifdef TOUCH_ENABLED
207 bool TouchInput(uint16_t x, uint16_t y, TouchTypes touchType);
208
212 void TouchHandlingISR();
213 #endif
214};
215
216#endif /* SCREENMANAGER_H_ */
Containing different defines for device configuration.
Containing functions to handle the rotary encoder.
Containing definitions for various icons.
Containing a function to check which key of the KeyPad is pressed.
void updateDmmNegativeWarningVisibility()
Update the visibility of the DMM channel negative warning icons.
Definition ScreenMeasure.cpp:38
UIElement * uiBuildScreenMeasure()
Build the Measure screen by linking all necessary components together.
Definition ScreenMeasure.cpp:44
UIElement * uiBuildScreenPS()
Build the PowerSupply screen by linking all necessary components together.
Definition ScreenPS.cpp:74
void ScreenDDSUpdateVisibility()
Update the visibility of all controls on the DDS screen.
Definition ScreenDDS.cpp:93
UIElement * uiBuildScreenSettings()
Build the Settings screen by linking all necessary components together.
Definition ScreenSettings.cpp:102
UIElement * uiBuildScreenCalibration()
Build the Calibration screen by linking all necessary components together.
Definition ScreenCalibration.cpp:275
ScreenTypes
Available screen types.
Definition ScreenManager.h:50
@ NUM_SCREEN_ELEMENTS
The last element is used to determine the number of elements in the enumeration.
Definition ScreenManager.h:61
@ SCREEN_CONF
Configuration screen.
Definition ScreenManager.h:60
@ SCREEN_PS
Power supply screen.
Definition ScreenManager.h:52
@ SCREEN_DDS
DDS screen.
Definition ScreenManager.h:55
@ SCREEN_MEAS
Measurement screen.
Definition ScreenManager.h:58
TouchEventStates
Available states for the touch handling state machine.
Definition ScreenManager.h:37
@ TOUCH_EVENTS_LONG_TOUCH_DETECTED
A long touch was detected.
Definition ScreenManager.h:40
@ TOUCH_EVENTS_WAIT_FOR_TOUCH
No touch has occured yet.
Definition ScreenManager.h:38
@ TOUCH_EVENTS_WAIT_LONG_TOUCH_DELAY
A touch has occured.
Definition ScreenManager.h:39
UIElement * uiBuildScreenDDS()
Build the DDS screen by linking all necessary components together.
Definition ScreenDDS.cpp:108
enum ScreenTypes ScreenTypes_t
Available screen types.
UIElement * uiBuildSplashScreen()
Build the SplashScreen by linking all necessary components together.
Definition SplashScreen.cpp:20
UIElement * StartCalibration()
Start the calibration by initializing all calibration screen components and the calibration state mac...
Definition ScreenCalibration.cpp:150
void UpdateVisibilities()
Update the visibility of all screens.
Definition ScreenManager.cpp:114
XPT2046 _ts
XPT2046 touchscreen handle.
Definition ScreenManager.h:138
bool CurrentScreenNeedsPeriodicRedraw
Flag that indicates if the current displayed screen needs to be periodically redrawn.
Definition ScreenManager.h:151
unsigned long _touchStartTime
Start time of the touch.
Definition ScreenManager.h:139
void ShowUiMainPage()
This method can be used to show the main page (no MessageDialog or calibration page).
Definition ScreenManager.cpp:151
void ShowHideDeviceRWLMessage(bool showMessage)
Show or hide a message indicating that the device is in RWL state (only controllable via SCPI command...
Definition ScreenManager.cpp:195
bool RedrawScreenRequest
Flag that indicates that the screen should be redrawn.
Definition ScreenManager.h:150
void UpdateSettingsChangedIndicator(bool settingsChanged)
Update the settings changed indicator (star indicating that there are unstored settings).
Definition ScreenManager.cpp:163
void UpdateCalibrationValidIndicator(bool calibrationValid)
Update the calibration valid indicator (calibration icon indicating that the calibration factors are ...
Definition ScreenManager.cpp:169
ScreenManagerClass()
Constructor of the ScreenManagerClass.
Definition ScreenManager.cpp:77
void KeyInput(Keys_t key)
Method that is used to input keys (and encoder inputs) into the screen subsystem (and the UI_Lib).
Definition ScreenManager.cpp:235
uint16_t TimeCounter_SplashScreen_ms
Timer conter value that is used to measure the time, the SplashScreen is shown.
Definition ScreenManager.h:154
bool TouchInput(uint16_t x, uint16_t y, TouchTypes touchType)
Process a touch input at the given point (x, y)
Definition ScreenManager.cpp:241
void uiBuildTree()
Build the VisualTree for all screens used for drawing.
Definition ScreenManager.cpp:121
TouchEventStates _touchEventState
Current state of the touch detection state machine.
Definition ScreenManager.h:140
void TouchHandlingISR()
Call this method cyclic for touch handling.
Definition ScreenManager.cpp:246
uint16_t TimeCounter_ScreenRedraw_ms
Variable used for measuring the time to the next screen redraw.
Definition ScreenManager.h:155
void DeviceTimerTickISR()
This method is called periodically by the device timer ISR and runs in the ISR context.
Definition ScreenManager.cpp:207
bool IsSplashScreenShown
Variable used to keep track if the SplashScreen is shown.
Definition ScreenManager.h:153
void ShowUiCalibrationMenu()
This method can be used to start the calibration and show the calibration page.
Definition ScreenManager.cpp:157
uint16_t TimeCounter_TouchHandling_ms
Variable used for measuring the time to the next touch handling.
Definition ScreenManager.h:157
void DoDraw()
Evaluate, if the screen should be redrawn.
Definition ScreenManager.cpp:175
Adafruit_ILI9341 _tft
ILI9341 graphics handle that is used with all drawing related methods.
Definition ScreenManager.h:135
void Init()
Initialize the ScreenManager.
Definition ScreenManager.cpp:84
Definition XPT2046.h:9
Containing defines and functions for basic SPI initialization and handling.