Mercurial > public > ostc4
comparison Discovery/Src/show_logbook.c @ 454:5a633dece17a minor_improvments
Reactivated samples for bottle pressure information:
I previous versions (and also in the upcommings) the bottle pressure informations are not added to the log information. However for alfatesting of a potential pressure measurement the function may now be reactivated by a compile switch
| author | ideenmodellierer |
|---|---|
| date | Tue, 24 Mar 2020 22:08:29 +0100 |
| parents | f11f0bf6ef2d |
| children | 4bd01f48c285 |
comparison
equal
deleted
inserted
replaced
| 453:1c0b911c367f | 454:5a633dece17a |
|---|---|
| 31 #include "gfx_colors.h" | 31 #include "gfx_colors.h" |
| 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 | 37 |
| 37 #include <stdint.h> | 38 #include <stdint.h> |
| 38 #include <stdio.h> | 39 #include <stdio.h> |
| 39 #include <stdlib.h> // for abs() | 40 #include <stdlib.h> // for abs() |
| 40 | 41 |
| 423 logbook_getHeader(StepBackwards ,&logbookHeader); | 424 logbook_getHeader(StepBackwards ,&logbookHeader); |
| 424 | 425 |
| 425 uint16_t depthdata[1000] = { 0 }; | 426 uint16_t depthdata[1000] = { 0 }; |
| 426 uint8_t gasdata[1000] = { 0 }; | 427 uint8_t gasdata[1000] = { 0 }; |
| 427 int16_t tempdata[1000] = { 0 }; | 428 int16_t tempdata[1000] = { 0 }; |
| 429 uint16_t tankdata[1000] = { 0 }; | |
| 430 | |
| 431 #ifdef ENABLE_BOTTLE_SENSOR | |
| 432 uint16_t bottlePressureStart = 0; | |
| 433 uint16_t bottlePressureEnd = 0; | |
| 434 uint16_t loop = 0; | |
| 435 #endif | |
| 428 | 436 |
| 429 uint16_t dataLength = 0; | 437 uint16_t dataLength = 0; |
| 430 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 438 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tankdata); |
| 431 | 439 |
| 432 //Print Date | 440 //Print Date |
| 433 uint8_t year = logbookHeader.dateYear; | 441 uint8_t year = logbookHeader.dateYear; |
| 434 uint8_t month = logbookHeader.dateMonth; | 442 uint8_t month = logbookHeader.dateMonth; |
| 435 uint8_t day = logbookHeader.dateDay; | 443 uint8_t day = logbookHeader.dateDay; |
| 618 // Gfx_write_label_var(hgfx,300,500,750, &FontT42,CLUT_GasSensor1,text); | 626 // Gfx_write_label_var(hgfx,300,500,750, &FontT42,CLUT_GasSensor1,text); |
| 619 // snprintf(text,40,"%i\016\016 mbar\017 (%i\016\016 m\017)",logbookHeader.surfacePressure_mbar, unit_SeaLevelRelation_integer(logbookHeader.surfacePressure_mbar)); | 627 // snprintf(text,40,"%i\016\016 mbar\017 (%i\016\016 m\017)",logbookHeader.surfacePressure_mbar, unit_SeaLevelRelation_integer(logbookHeader.surfacePressure_mbar)); |
| 620 snprintf(text,40,"%i\016\016 hPa\017",logbookHeader.surfacePressure_mbar); | 628 snprintf(text,40,"%i\016\016 hPa\017",logbookHeader.surfacePressure_mbar); |
| 621 Gfx_write_label_var(hgfx,320,600,440, &FontT42,CLUT_GasSensor1,text); | 629 Gfx_write_label_var(hgfx,320,600,440, &FontT42,CLUT_GasSensor1,text); |
| 622 | 630 |
| 623 | 631 /* Show tank info */ |
| 632 #ifdef ENABLE_BOTTLE_SENSOR | |
| 633 for(loop = 0; loop < dataLength; loop++) | |
| 634 { | |
| 635 if((bottlePressureStart == 0) && (tankdata[loop] != 0)) /* find first pressure value */ | |
| 636 { | |
| 637 bottlePressureStart = tankdata[loop]; | |
| 638 } | |
| 639 if((tankdata[loop] != 0)) /* store last pressure value */ | |
| 640 { | |
| 641 bottlePressureEnd = tankdata[loop]; | |
| 642 } | |
| 643 } | |
| 644 if(bottlePressureStart != 0) | |
| 645 { | |
| 646 snprintf(text,40,"%i | %i\016\016 Bar\017",bottlePressureStart,bottlePressureEnd); | |
| 647 Gfx_write_label_var(hgfx,600,800,440, &FontT42,CLUT_GasSensor1,text); | |
| 648 } | |
| 649 #endif | |
| 624 //--- print coordinate system & depth graph with gaschanges --- | 650 //--- print coordinate system & depth graph with gaschanges --- |
| 625 wintemp.left = 330; | 651 wintemp.left = 330; |
| 626 wintemp.top = 160; | 652 wintemp.top = 160; |
| 627 wintemp.bottom -= 40; | 653 wintemp.bottom -= 40; |
| 628 | 654 |
| 649 uint8_t gasdata[1000]; | 675 uint8_t gasdata[1000]; |
| 650 int16_t tempdata[1000]; | 676 int16_t tempdata[1000]; |
| 651 uint16_t decoDepthdata[1000]; | 677 uint16_t decoDepthdata[1000]; |
| 652 uint16_t *pDecoDepthData = 0; | 678 uint16_t *pDecoDepthData = 0; |
| 653 | 679 |
| 654 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, decoDepthdata); | 680 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, decoDepthdata, NULL); |
| 655 | 681 |
| 656 for(int i = 0; i<dataLength; i++) | 682 for(int i = 0; i<dataLength; i++) |
| 657 { | 683 { |
| 658 if(decoDepthdata[i] >= 300) | 684 if(decoDepthdata[i] >= 300) |
| 659 { | 685 { |
| 800 | 826 |
| 801 logbook_getHeader(StepBackwards, &logbookHeader); | 827 logbook_getHeader(StepBackwards, &logbookHeader); |
| 802 uint16_t dataLength = 0; | 828 uint16_t dataLength = 0; |
| 803 uint16_t depthdata[1000]; | 829 uint16_t depthdata[1000]; |
| 804 uint8_t gasdata[1000]; | 830 uint8_t gasdata[1000]; |
| 805 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 831 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 806 | 832 |
| 807 //--- print coordinate system & depth graph with gaschanges --- | 833 //--- print coordinate system & depth graph with gaschanges --- |
| 808 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 1, dataLength, depthdata, gasdata, NULL); | 834 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 1, dataLength, depthdata, gasdata, NULL); |
| 809 | 835 |
| 810 //--- print gas list --- | 836 //--- print gas list --- |
| 858 uint16_t *setpoint = ppO2data; | 884 uint16_t *setpoint = ppO2data; |
| 859 uint16_t *sensor1 = ppO2data; | 885 uint16_t *sensor1 = ppO2data; |
| 860 | 886 |
| 861 | 887 |
| 862 if(logbookHeader.diveMode != DIVEMODE_CCR) | 888 if(logbookHeader.diveMode != DIVEMODE_CCR) |
| 863 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 889 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, ppO2data, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 864 else | 890 else |
| 865 { | 891 { |
| 866 if(logbookHeader.CCRmode == CCRMODE_FixedSetpoint) | 892 if(logbookHeader.CCRmode == CCRMODE_FixedSetpoint) |
| 867 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, setpoint, NULL, NULL, NULL, NULL, NULL, NULL); | 893 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, setpoint, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 868 else | 894 else |
| 869 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, NULL, sensor1, sensor2, sensor3, NULL, NULL, NULL); | 895 dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata, gasdata, NULL, NULL, NULL, sensor1, sensor2, sensor3, NULL, NULL, NULL, NULL); |
| 870 } | 896 } |
| 871 | 897 |
| 872 | 898 |
| 873 //--- print coordinate system & depth graph with bailout--- | 899 //--- print coordinate system & depth graph with bailout--- |
| 874 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 0, dataLength, depthdata, gasdata, NULL); | 900 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 0, dataLength, depthdata, gasdata, NULL); |
