6
6
#include " ezTime.h"
7
7
8
8
#include " screens/DiveInoScreen.h"
9
+ #include " deco/Buhlmann.h"
9
10
10
11
#define SAFE_MODE 510
11
12
#define SAFETY_STOP_MODE 520
12
13
#define DECO_MODE 530
13
14
#define TILT_MODE 540
14
15
16
+ #define SAFETY_STOP_NOT_STARTED 0
17
+ #define SAFETY_STOP_IN_PROGRESS 1
18
+ #define SAFETY_STOP_DONE 2
19
+ #define SAFETY_STOP_VIOLATED 3
20
+
15
21
class DiveScreen : public DiveInoScreen {
16
22
17
23
public:
18
- void init (DiveInoSettings diveInoSettings, PressureSensorData sensorData);
24
+ DiveScreen (Buhlmann* buhlmann);
25
+
26
+ void init (DiveInoSettings diveInoSettings, PressureSensorData sensorData, bool replayEnabled, bool emulatorEnabled);
19
27
20
28
void display (PressureSensorData sensorData);
21
29
@@ -31,14 +39,44 @@ class DiveScreen : public DiveInoScreen {
31
39
32
40
void handleButtonPress (String buttonName);
33
41
34
- private:
42
+ private:
43
+ Buhlmann* _buhlmann;
44
+ DiveInoSettings _diveInoSettings;
35
45
int _currentMode = SAFE_MODE;
46
+ bool _diveStarted = false ;
47
+
48
+ bool _emulatorEnabled = false ;
49
+ bool _replayEnabled = false ;
50
+
51
+ unsigned long _previousDiveDurationInSeconds = 0 ;
52
+ void _replayDive ();
36
53
37
54
bool _isStopWatchRunning = false ;
38
55
unsigned long _stopwatchStartTimestamp;
39
56
unsigned long _stopwatchElapsedTime = 0 ;
40
57
41
- void refreshSensorData (PressureSensorData sensorData);
58
+ void _displayActualTime (unsigned long elapsedTimeInSeconds);
59
+
60
+ float _maxDepthInMeter = 0.0 ;
61
+
62
+ void _drawCurrentDepth (float depthInMeter);
63
+ void _drawMaximumDepth (float depthInMeter);
64
+ void _drawSensorData (PressureSensorData sensorData);
65
+ void _refreshMaxDepth (float currentDepthInMeter);
66
+
67
+ void _drawDiveIndicator ();
68
+
69
+ byte _safetyStopState = SAFETY_STOP_NOT_STARTED;
70
+ unsigned long _safetyStopDurationInSeconds;
71
+ void _calculateSafetyStop (float maxDepthInMeter, float depthInMeter, unsigned int intervalDuration);
72
+ void _clearSafetyStopDisplay ();
73
+
74
+ void _clearDecoDisplay ();
75
+ DiveInfo _currentDiveInfo;
76
+ void startDive ();
77
+ void _diveProgress (float temperatureInCelsius, float pressureInMillibar, float depthInMeter, unsigned int durationInSeconds);
78
+ void stopDive ();
79
+
42
80
};
43
81
44
82
#endif
0 commit comments