comparison 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
comparison
equal deleted inserted replaced
595:fd0b60dee6f3 596:16e369eae6e5
32 #include "gfx_engine.h" 32 #include "gfx_engine.h"
33 #include "gfx_fonts.h" 33 #include "gfx_fonts.h"
34 #include "show_logbook.h" 34 #include "show_logbook.h"
35 #include "unit.h" 35 #include "unit.h"
36 #include "configuration.h" 36 #include "configuration.h"
37 #include "logbook_miniLive.h"
37 38
38 #include <stdint.h> 39 #include <stdint.h>
39 #include <stdio.h> 40 #include <stdio.h>
40 #include <stdlib.h> // for abs() 41 #include <stdlib.h> // for abs()
41 42
47 static GFX_DrawCfgScreen tLOGbackground; 48 static GFX_DrawCfgScreen tLOGbackground;
48 49
49 50
50 static void print_gas_name(char* output,uint8_t lengh,uint8_t oxygen,uint8_t helium); 51 static void print_gas_name(char* output,uint8_t lengh,uint8_t oxygen,uint8_t helium);
51 static int16_t get_colour(int16_t color); 52 static int16_t get_colour(int16_t color);
53
54 static uint8_t active_log_page = 1;
55 static uint8_t active_log_offset = 0;
52 56
53 /* Overview */ 57 /* Overview */
54 static void show_logbook_logbook_show_log_page1(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards); 58 static void show_logbook_logbook_show_log_page1(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
55 /* Temperature */ 59 /* Temperature */
56 static void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards); 60 static void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
668 // Gfx_write_label_var(hgfx,300,500,750, &FontT42,CLUT_GasSensor1,text); 672 // Gfx_write_label_var(hgfx,300,500,750, &FontT42,CLUT_GasSensor1,text);
669 // snprintf(text,40,"%i\016\016 mbar\017 (%i\016\016 m\017)",logbookHeader.surfacePressure_mbar, unit_SeaLevelRelation_integer(logbookHeader.surfacePressure_mbar)); 673 // snprintf(text,40,"%i\016\016 mbar\017 (%i\016\016 m\017)",logbookHeader.surfacePressure_mbar, unit_SeaLevelRelation_integer(logbookHeader.surfacePressure_mbar));
670 snprintf(text,40,"%i\016\016 hPa\017",logbookHeader.surfacePressure_mbar); 674 snprintf(text,40,"%i\016\016 hPa\017",logbookHeader.surfacePressure_mbar);
671 Gfx_write_label_var(hgfx,320,600,440, &FontT42,CLUT_GasSensor1,text); 675 Gfx_write_label_var(hgfx,320,600,440, &FontT42,CLUT_GasSensor1,text);
672 676
677
678 /* show symbol in case log entry is marked for usage in profile custom view */
679 snprintf(text,10,"\002>");
680 if(0xFFFF != getReplayOffset())
681 {
682 Gfx_write_label_var(hgfx,750,799,440, &FontT42,CLUT_GasSensor1,text);
683 }
684 else
685 {
686 Gfx_write_label_var(hgfx,750,799,440, &FontT42,CLUT_MenuTopBackground,text);
687 }
688
689
673 /* Show tank info */ 690 /* Show tank info */
674 #ifdef ENABLE_BOTTLE_SENSOR 691 #ifdef ENABLE_BOTTLE_SENSOR
675 for(loop = 0; loop < dataLength; loop++) 692 for(loop = 0; loop < dataLength; loop++)
676 { 693 {
677 if((bottlePressureStart == 0) && (tankdata[loop] != 0)) /* find first pressure value */ 694 if((bottlePressureStart == 0) && (tankdata[loop] != 0)) /* find first pressure value */
839 } 856 }
840 857
841 858
842 void show_logbook_test(_Bool firstPage, uint8_t StepBackwards) 859 void show_logbook_test(_Bool firstPage, uint8_t StepBackwards)
843 { 860 {
844 static uint8_t page = 1;
845 if(firstPage) 861 if(firstPage)
846 { 862 {
847 page = 1; 863 active_log_page = 1;
848 } 864 active_log_offset = StepBackwards;
849 else 865 }
850 { 866 else
851 page++; 867 {
852 if(page > 4) 868 active_log_page++;
853 page = 1; 869 if(active_log_page > 4)
854 } 870 {
855 871 active_log_page = 1;
856 build_logbook_test(page,StepBackwards); 872 }
873 }
874
875 build_logbook_test(active_log_page,StepBackwards);
857 // GFX_ResetLayer(TOP_LAYER); 876 // GFX_ResetLayer(TOP_LAYER);
858 // GFX_ResetLayer(BACKGRD_LAYER); 877 // GFX_ResetLayer(BACKGRD_LAYER);
859 878
860 set_globalState(StILOGSHOW); 879 set_globalState(StILOGSHOW);
861 GFX_SetFramesTopBottom(tLOGscreen.FBStartAdress, tLOGbackground.FBStartAdress,480); 880 GFX_SetFramesTopBottom(tLOGscreen.FBStartAdress, tLOGbackground.FBStartAdress,480);
1109 1128
1110 static int16_t get_colour(int16_t color) 1129 static int16_t get_colour(int16_t color)
1111 { 1130 {
1112 return CLUT_GasSensor1 + color; 1131 return CLUT_GasSensor1 + color;
1113 } 1132 }
1133
1134 uint8_t getActiveLogPage()
1135 {
1136 return active_log_page;
1137 }
1138
1139 void updateReplayIncdicator(GFX_DrawCfgScreen *hgfx)
1140 {
1141 build_logbook_test(1,active_log_offset);
1142 GFX_SetFramesTopBottom(tLOGscreen.FBStartAdress, tLOGbackground.FBStartAdress,480);
1143 }