diff Discovery/Src/show_logbook.c @ 596:16e369eae6e5

Added functionality to select a dive to be shown in the T3 profile view: The new T3 Profile provides the option to display the profile of a previous dive which is stored in the log. This may be done by using the <enter> (middle) button. In case the dive is selected for the replay function a '>' will be shown in the lower right corner.
author Ideenmodellierer
date Mon, 04 Jan 2021 21:35:38 +0100
parents 3860b8fa4b29
children ae7f8333c900
line wrap: on
line diff
--- a/Discovery/Src/show_logbook.c	Mon Jan 04 21:32:39 2021 +0100
+++ b/Discovery/Src/show_logbook.c	Mon Jan 04 21:35:38 2021 +0100
@@ -34,6 +34,7 @@
 #include "show_logbook.h"
 #include "unit.h"
 #include "configuration.h"
+#include "logbook_miniLive.h"
 
 #include <stdint.h>
 #include <stdio.h>
@@ -50,6 +51,9 @@
 static void print_gas_name(char* output,uint8_t lengh,uint8_t oxygen,uint8_t helium);
 static int16_t get_colour(int16_t color);
 
+static uint8_t active_log_page = 1;
+static uint8_t active_log_offset = 0;
+
 /* Overview */
 static void show_logbook_logbook_show_log_page1(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
 /* Temperature */
@@ -670,6 +674,19 @@
     snprintf(text,40,"%i\016\016 hPa\017",logbookHeader.surfacePressure_mbar);
     Gfx_write_label_var(hgfx,320,600,440, &FontT42,CLUT_GasSensor1,text);
 
+
+/* show symbol in case log entry is marked for usage in profile custom view */
+	snprintf(text,10,"\002>");
+	if(0xFFFF != getReplayOffset())
+	{
+		 Gfx_write_label_var(hgfx,750,799,440, &FontT42,CLUT_GasSensor1,text);
+	}
+	else
+	{
+		 Gfx_write_label_var(hgfx,750,799,440, &FontT42,CLUT_MenuTopBackground,text);
+    }
+
+
 /* Show tank info */
 #ifdef ENABLE_BOTTLE_SENSOR
     for(loop = 0; loop < dataLength; loop++)
@@ -841,19 +858,21 @@
 
 void show_logbook_test(_Bool firstPage, uint8_t StepBackwards)
 {
-    static uint8_t page = 1;
     if(firstPage)
     {
-            page = 1;
+    	active_log_page = 1;
+    	active_log_offset = StepBackwards;
     }
     else
     {
-            page++;
-            if(page > 4)
-                    page = 1;
+    	active_log_page++;
+        if(active_log_page > 4)
+        {
+           	active_log_page = 1;
+        }
     }
 
-    build_logbook_test(page,StepBackwards);
+    build_logbook_test(active_log_page,StepBackwards);
 //	GFX_ResetLayer(TOP_LAYER);
 //	GFX_ResetLayer(BACKGRD_LAYER);
 
@@ -1111,3 +1130,14 @@
 {
      return CLUT_GasSensor1 + color;
 }
+
+uint8_t getActiveLogPage()
+{
+	return active_log_page;
+}
+
+void updateReplayIncdicator(GFX_DrawCfgScreen *hgfx)
+{
+    build_logbook_test(1,active_log_offset);
+    GFX_SetFramesTopBottom(tLOGscreen.FBStartAdress, tLOGbackground.FBStartAdress,480);
+}