Mercurial > public > ostc4
comparison Discovery/Src/show_logbook.c @ 941:6d8ae8fbccf5 Evo_2_23
Added gnss to logbook data:
The gnss position is now available in the logbook. It is stored as event (7:2) at the start of the dive. The position will be shown in the logbook page 1 in the top middle position.
| author | Ideenmodellierer |
|---|---|
| date | Mon, 16 Dec 2024 19:06:37 +0100 |
| parents | aa6006975e76 |
| children | d9290c76b840 |
comparison
equal
deleted
inserted
replaced
| 940:4a406e873a95 | 941:6d8ae8fbccf5 |
|---|---|
| 442 uint16_t depthdata[1000] = { 0 }; | 442 uint16_t depthdata[1000] = { 0 }; |
| 443 uint8_t gasdata[1000] = { 0 }; | 443 uint8_t gasdata[1000] = { 0 }; |
| 444 int16_t tempdata[1000] = { 0 }; | 444 int16_t tempdata[1000] = { 0 }; |
| 445 uint16_t tankdata[1000] = { 0 }; | 445 uint16_t tankdata[1000] = { 0 }; |
| 446 | 446 |
| 447 SGnssCoord posCoord; | |
| 448 posCoord.fLat = 0.0; | |
| 449 posCoord.fLon = 0.0; | |
| 450 | |
| 447 #ifdef ENABLE_BOTTLE_SENSOR | 451 #ifdef ENABLE_BOTTLE_SENSOR |
| 448 uint16_t bottlePressureStart = 0; | 452 uint16_t bottlePressureStart = 0; |
| 449 uint16_t bottlePressureEnd = 0; | 453 uint16_t bottlePressureEnd = 0; |
| 450 uint16_t loop = 0; | 454 uint16_t loop = 0; |
| 451 #endif | 455 #endif |
| 452 | 456 |
| 453 uint16_t dataLength = 0; | 457 uint16_t dataLength = 0; |
| 454 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tankdata,NULL); | 458 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tankdata, &posCoord, NULL); |
| 455 | 459 |
| 456 //Print Date | 460 //Print Date |
| 457 uint8_t year = logbookHeader.dateYear; | 461 uint8_t year = logbookHeader.dateYear; |
| 458 uint8_t month = logbookHeader.dateMonth; | 462 uint8_t month = logbookHeader.dateMonth; |
| 459 uint8_t day = logbookHeader.dateDay; | 463 uint8_t day = logbookHeader.dateDay; |
| 460 char text[40]; | 464 char text[40]; |
| 461 snprintf(text, 20, "20%02i-%02i-%02i", year, month, day); | 465 snprintf(text, 20, "20%02i-%02i-%02i", year, month, day); |
| 462 | 466 |
| 463 Gfx_write_label_var(hgfx, 30, 250,10, &FontT42,CLUT_GasSensor1,text); | 467 Gfx_write_label_var(hgfx, 30, 250,10, &FontT42,CLUT_GasSensor1,text); |
| 468 | |
| 469 #if defined ENABLE_GNSS_SUPPORT || defined ENABLE_GPIO_V2 | |
| 470 if((posCoord.fLat != 0.0) || (posCoord.fLon != 0.0)) | |
| 471 { | |
| 472 snprintf(text, 20, "%2.4f - %2.4f", posCoord.fLat, posCoord.fLon ); | |
| 473 Gfx_write_label_var(hgfx, 300, 500,10, &FontT42,CLUT_GasSensor1,text); | |
| 474 } | |
| 475 #endif | |
| 464 | 476 |
| 465 | 477 |
| 466 // Print logbook number with offset | 478 // Print logbook number with offset |
| 467 if(settingsGetPointer()->logbookOffset) | 479 if(settingsGetPointer()->logbookOffset) |
| 468 { | 480 { |
| 738 uint8_t gasdata[1000]; | 750 uint8_t gasdata[1000]; |
| 739 int16_t tempdata[1000]; | 751 int16_t tempdata[1000]; |
| 740 uint16_t decoDepthdata[1000]; | 752 uint16_t decoDepthdata[1000]; |
| 741 uint16_t *pDecoDepthData = 0; | 753 uint16_t *pDecoDepthData = 0; |
| 742 | 754 |
| 743 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, decoDepthdata, NULL, NULL); | 755 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, decoDepthdata, NULL, NULL, NULL); |
| 744 | 756 |
| 745 for(int i = 0; i<dataLength; i++) | 757 for(int i = 0; i<dataLength; i++) |
| 746 { | 758 { |
| 747 if(decoDepthdata[i] >= 300) | 759 if(decoDepthdata[i] >= 300) |
| 748 { | 760 { |
| 903 | 915 |
| 904 logbook_getHeader(StepBackwards, &logbookHeader); | 916 logbook_getHeader(StepBackwards, &logbookHeader); |
| 905 uint16_t dataLength = 0; | 917 uint16_t dataLength = 0; |
| 906 uint16_t depthdata[1000]; | 918 uint16_t depthdata[1000]; |
| 907 uint8_t gasdata[1000]; | 919 uint8_t gasdata[1000]; |
| 908 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 920 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 909 | 921 |
| 910 char msg[15]; | 922 char msg[15]; |
| 911 char gas_name[15]; | 923 char gas_name[15]; |
| 912 int j = 0; | 924 int j = 0; |
| 913 | 925 |
| 1033 uint16_t *sensor1 = ppO2data; | 1045 uint16_t *sensor1 = ppO2data; |
| 1034 uint8_t sensorDataAvailable[] = {0,0,0}; | 1046 uint8_t sensorDataAvailable[] = {0,0,0}; |
| 1035 | 1047 |
| 1036 | 1048 |
| 1037 if(!isLoopMode(logbookHeader.diveMode)) | 1049 if(!isLoopMode(logbookHeader.diveMode)) |
| 1038 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 1050 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 1039 else | 1051 else |
| 1040 { | 1052 { |
| 1041 switch(logbookHeader.CCRmode) | 1053 switch(logbookHeader.CCRmode) |
| 1042 { | 1054 { |
| 1043 case CCRMODE_FixedSetpoint: | 1055 case CCRMODE_FixedSetpoint: |
| 1044 default: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, setpoint, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 1056 default: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, setpoint, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 1045 break; | 1057 break; |
| 1046 case CCRMODE_Sensors: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, NULL, sensor1, sensor2, sensor3, NULL, NULL, NULL, NULL, NULL); | 1058 case CCRMODE_Sensors: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, NULL, sensor1, sensor2, sensor3, NULL, NULL, NULL, NULL, NULL, NULL); |
| 1047 if(!check_data_array_empty(sensor1)) | 1059 if(!check_data_array_empty(sensor1)) |
| 1048 { | 1060 { |
| 1049 sensorDataAvailable[0] = 1; | 1061 sensorDataAvailable[0] = 1; |
| 1050 } | 1062 } |
| 1051 if(!check_data_array_empty(sensor2)) | 1063 if(!check_data_array_empty(sensor2)) |
| 1058 } | 1070 } |
| 1059 if((logbookHeader.diveMode == DIVEMODE_PSCR) && (sensorDataAvailable[0] + sensorDataAvailable[1] + sensorDataAvailable[2] != 3)) /*insert sim data if not all three sensors are in use*/ | 1071 if((logbookHeader.diveMode == DIVEMODE_PSCR) && (sensorDataAvailable[0] + sensorDataAvailable[1] + sensorDataAvailable[2] != 3)) /*insert sim data if not all three sensors are in use*/ |
| 1060 { | 1072 { |
| 1061 if(sensorDataAvailable[0] == 0) | 1073 if(sensorDataAvailable[0] == 0) |
| 1062 { | 1074 { |
| 1063 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 1075 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 1064 sensorDataAvailable[0] = 1; | 1076 sensorDataAvailable[0] = 1; |
| 1065 } | 1077 } |
| 1066 else if(sensorDataAvailable[1] == 0) | 1078 else if(sensorDataAvailable[1] == 0) |
| 1067 { | 1079 { |
| 1068 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 1080 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 1069 sensorDataAvailable[1] = 1; | 1081 sensorDataAvailable[1] = 1; |
| 1070 } | 1082 } |
| 1071 else if(sensorDataAvailable[2] == 0) | 1083 else if(sensorDataAvailable[2] == 0) |
| 1072 { | 1084 { |
| 1073 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 1085 logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, sensor3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 1074 sensorDataAvailable[2] = 1; | 1086 sensorDataAvailable[2] = 1; |
| 1075 } | 1087 } |
| 1076 } | 1088 } |
| 1077 break; | 1089 break; |
| 1078 case CCRMODE_Simulation: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 1090 case CCRMODE_Simulation: dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 1079 break; | 1091 break; |
| 1080 } | 1092 } |
| 1081 } | 1093 } |
| 1082 | 1094 |
| 1083 | 1095 |
