changeset 603:c56ed16dbd39

T3 profile view: Added visualization of deco data
author Ideenmodellierer
date Wed, 06 Jan 2021 19:41:43 +0100
parents 2cb0a97a07ad
children fb5bb04ad914
files Discovery/Inc/logbook_miniLive.h Discovery/Src/logbook_miniLive.c Discovery/Src/t3.c
diffstat 3 files changed, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/logbook_miniLive.h	Tue Jan 05 20:35:01 2021 +0100
+++ b/Discovery/Inc/logbook_miniLive.h	Wed Jan 06 19:41:43 2021 +0100
@@ -34,9 +34,10 @@
 /* Exported functions --------------------------------------------------------*/
 
 void updateMiniLiveLogbook( _Bool checkOncePerSecond);
-uint16_t *getMiniLiveLogbookPointerToData(void);
+uint16_t* getMiniLiveLogbookPointerToData(void);
 uint16_t getMiniLiveLogbookActualDataLength(void);
-uint16_t *getMiniLiveReplayPointerToData(void);
+uint16_t* getMiniLiveReplayPointerToData(void);
+uint16_t* getMiniLiveDecoPointerToData(void);
 uint16_t getMiniLiveReplayLength(void);
 uint8_t prepareReplayLog(uint8_t StepBackwards);
 uint8_t getReplayInfo(uint16_t** pReplayData, uint16_t* DataLength, uint16_t* MaxDepth, uint16_t* diveMinutes);
--- a/Discovery/Src/logbook_miniLive.c	Tue Jan 05 20:35:01 2021 +0100
+++ b/Discovery/Src/logbook_miniLive.c	Wed Jan 06 19:41:43 2021 +0100
@@ -24,6 +24,7 @@
 #include "logbook_miniLive.h"
 #include "data_exchange.h"
 #include "logbook.h"
+#include "tHome.h"
 
  /*
   ******************************************************************************
@@ -44,6 +45,7 @@
 #define DEPTH_DATA_LENGTH	(1800u)				/* Resolution: 1 hours dive, sampling every 2 seconds */
 uint16_t ReplayDepthData[DEPTH_DATA_LENGTH];
 uint16_t liveDepthData[DEPTH_DATA_LENGTH];
+uint16_t liveDecoData[DEPTH_DATA_LENGTH];
 static uint16_t lifeDataIndex = 0;
 
 static uint8_t	ReplayDataResolution = 2;		/* Time represented by one sample (second) */
@@ -86,6 +88,10 @@
 	static uint8_t secondsCount = 0;
 	static uint8_t lifesecondsCount = 0;
 
+	const SDecoinfo* pDecoinfo;
+	uint8_t stopDepth = 0;
+	uint16_t stopTime = 0;
+
 	if(checkOncePerSecond)
 	{
 		uint32_t now =  current_second();
@@ -110,6 +116,7 @@
 			for(lifeDataIndex = 0; lifeDataIndex < DEPTH_DATA_LENGTH; lifeDataIndex++)
 			{
 				liveDepthData[lifeDataIndex] = 0xFFFF;
+				liveDecoData[lifeDataIndex] = 0xFFFF;
 			}
 			lifesecondsCount = 0;
 			lifeDataIndex = 0;
@@ -146,7 +153,25 @@
 				compressBuffer_uint16(ReplayDepthData,DEPTH_DATA_LENGTH);		/* also compress Replay data to siplify mapping between live and replay data */
 				lifeDataIndex = DEPTH_DATA_LENGTH / 2;
 			}
-			liveDepthData[lifeDataIndex++] = (int)(stateUsed->lifeData.depth_meter * 100);
+			liveDepthData[lifeDataIndex] = (int)(stateUsed->lifeData.depth_meter * 100);
+			if(stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE)
+			{
+				pDecoinfo = &stateUsed->decolistVPM;
+			}
+			else
+			{
+				pDecoinfo = &stateUsed->decolistBuehlmann;
+			}
+			tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &stopDepth, &stopTime);
+			if(stopDepth)
+			{
+				liveDecoData[lifeDataIndex] = stopDepth * 100;
+			}
+			else
+			{
+				liveDecoData[lifeDataIndex] = 0xFFFF;
+			}
+			lifeDataIndex++;
 		}
 	}
 	else if(bDiveMode == 3)
@@ -221,6 +246,10 @@
 {
 	return liveDepthData;
 }
+uint16_t *getMiniLiveDecoPointerToData(void)
+{
+	return liveDecoData;
+}
 uint16_t getMiniLiveReplayLength(void)
 {
 	return lifeDataIndex;
--- a/Discovery/Src/t3.c	Tue Jan 05 20:35:01 2021 +0100
+++ b/Discovery/Src/t3.c	Wed Jan 06 19:41:43 2021 +0100
@@ -246,6 +246,7 @@
 
     if(liveDataLength > 3)
     {
+    	GFX_graph_print(&t3screen,&wintemp,wintemp.top * -1,1,0,max_depth, getMiniLiveDecoPointerToData(),drawDataLength, CLUT_NiceGreen, NULL);
     	GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, getMiniLiveReplayPointerToData(), drawDataLength, CLUT_Font030, NULL);
     }
 }