Skip to content

Commit 64c3e15

Browse files
2.0.8 Replay mode on the Dive Screen
1 parent 841ce43 commit 64c3e15

File tree

8 files changed

+547
-154
lines changed

8 files changed

+547
-154
lines changed

.vscode/launch.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
8+
{
9+
"type": "node",
10+
"request": "launch",
11+
"name": "Launch Program",
12+
"skipFiles": [
13+
"<node_internals>/**"
14+
],
15+
"program": "${workspaceFolder}\\Tools\\DiveInoSimulator\\replay.js"
16+
}
17+
]
18+
}

DiveIno/include/images/jpgs.h

+92-104
Large diffs are not rendered by default.

DiveIno/include/screens/DiveScreen.h

+41-3
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,24 @@
66
#include "ezTime.h"
77

88
#include "screens/DiveInoScreen.h"
9+
#include "deco/Buhlmann.h"
910

1011
#define SAFE_MODE 510
1112
#define SAFETY_STOP_MODE 520
1213
#define DECO_MODE 530
1314
#define TILT_MODE 540
1415

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+
1521
class DiveScreen : public DiveInoScreen {
1622

1723
public:
18-
void init(DiveInoSettings diveInoSettings, PressureSensorData sensorData);
24+
DiveScreen(Buhlmann* buhlmann);
25+
26+
void init(DiveInoSettings diveInoSettings, PressureSensorData sensorData, bool replayEnabled, bool emulatorEnabled);
1927

2028
void display(PressureSensorData sensorData);
2129

@@ -31,14 +39,44 @@ class DiveScreen : public DiveInoScreen {
3139

3240
void handleButtonPress(String buttonName);
3341

34-
private:
42+
private:
43+
Buhlmann* _buhlmann;
44+
DiveInoSettings _diveInoSettings;
3545
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();
3653

3754
bool _isStopWatchRunning = false;
3855
unsigned long _stopwatchStartTimestamp;
3956
unsigned long _stopwatchElapsedTime = 0;
4057

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+
4280
};
4381

4482
#endif

DiveIno/src/main.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "deco/Buhlmann.h"
2626

27-
const String VERSION_NUMBER = "2.0.7";
27+
const String VERSION_NUMBER = "2.0.8";
2828

2929
struct PressureSensorData _sensorData;
3030

@@ -58,7 +58,7 @@ int16_t _lastPickedMainMenuIndex = 1;
5858
bool _backToMenu = false;
5959

6060
HomeScreen homeScreen = HomeScreen(timeUtils);
61-
DiveScreen diveScreen = DiveScreen();
61+
DiveScreen diveScreen = DiveScreen(&buhlmann);
6262
GaugeScreen gaugeScreen = GaugeScreen(&buhlmann);
6363
LogbookScreen logbookScreen = LogbookScreen();
6464
SurfaceScreen surfaceScreen = SurfaceScreen();
@@ -128,7 +128,8 @@ void loop()
128128
case 1:
129129
_backToMenu = false;
130130
_currentScreen = SCREEN_DIVE;
131-
diveScreen.init(settingsUtils.getDiveInoSettings(), _sensorData);
131+
diveScreen.init(settingsUtils.getDiveInoSettings(), _sensorData, serialApi.isReplayEnabled(), serialApi.isEmulatorEnabled());
132+
serialApi.reset();
132133
break;
133134
case 2:
134135
_backToMenu = false;

0 commit comments

Comments
 (0)