comparison Discovery/Src/t7.c @ 202:d328abe2e44e

Merged heinrichsweikamp/ostc4 into default
author Thorsten <ideenmodellierer@o2mail.de>
date Sun, 17 Mar 2019 19:16:59 +0100
parents 8b8074080d7b
children 255326edf00b
comparison
equal deleted inserted replaced
201:4073b8091224 202:d328abe2e44e
72 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); 72 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium);
73 73
74 /* Exported variables --------------------------------------------------------*/ 74 /* Exported variables --------------------------------------------------------*/
75 75
76 /* Private variables ---------------------------------------------------------*/ 76 /* Private variables ---------------------------------------------------------*/
77 float depthLastCall[9] = { 0,0,0,0,0,0,0,0,0};
78 uint8_t idDepthLastCall = 0;
79 float temperatureLastCall[3] = { 0,0,0};
80 uint8_t idTemperatureLastCall = 0;
81 77
82 GFX_DrawCfgScreen t7screen; 78 GFX_DrawCfgScreen t7screen;
83 GFX_DrawCfgScreen t7screenCompass; 79 GFX_DrawCfgScreen t7screenCompass;
84 80
85 /* left 3 fields 81 /* left 3 fields
661 657
662 if(state > 400) 658 if(state > 400)
663 ytop = 800 - state; 659 ytop = 800 - state;
664 else 660 else
665 ytop = 0 + state; 661 ytop = 0 + state;
666 Gfx_write_label_var(&t7screen, 300,800, ytop,&FontT48,CLUT_Font020,"SLEEP SLEEP SLEEP"); 662 Gfx_write_label_var(&t7screen, 300,800, ytop,&FontT48,CLUT_Font020,"Shutting down...");
667 } 663 }
668 664
669 void t7_refresh_surface(void) 665 void t7_refresh_surface(void)
670 { 666 {
671 char text[256]; 667 char text[256];
2051 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); 2047 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter));
2052 2048
2053 t7_colorscheme_mod(TextL2); 2049 t7_colorscheme_mod(TextL2);
2054 GFX_write_string(&FontT105,&t7l2,TextL2,1); 2050 GFX_write_string(&FontT105,&t7l2,TextL2,1);
2055 2051
2056 /* ascentrate graph */ 2052 /* ascent rate graph */
2057 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) 2053 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0)
2058 { 2054 {
2059 if(!pSettings->FlipDisplay) 2055 if(!pSettings->FlipDisplay)
2060 { 2056 {
2061 start.y = t7l1.WindowY0 - 1; 2057 start.y = t7l1.WindowY0 - 1;
2472 SDivetime Stopwatch = {0,0,0,0}; 2468 SDivetime Stopwatch = {0,0,0,0};
2473 float fAverageDepth, fAverageDepthAbsolute; 2469 float fAverageDepth, fAverageDepthAbsolute;
2474 const SDecoinfo * pDecoinfoStandard; 2470 const SDecoinfo * pDecoinfoStandard;
2475 const SDecoinfo * pDecoinfoFuture; 2471 const SDecoinfo * pDecoinfoFuture;
2476 float fCNS; 2472 float fCNS;
2477
2478 float temperatureThisCall;
2479 float temperature; 2473 float temperature;
2480 2474
2481 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) 2475 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
2482 { 2476 {
2483 pDecoinfoStandard = &stateUsed->decolistBuehlmann; 2477 pDecoinfoStandard = &stateUsed->decolistBuehlmann;
2501 switch(selection_custom_field) 2495 switch(selection_custom_field)
2502 { 2496 {
2503 /* Temperature */ 2497 /* Temperature */
2504 case 1: 2498 case 1:
2505 default: 2499 default:
2506 // mean value 2500 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius);
2507 temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius);
2508 temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f;
2509 idTemperatureLastCall++;
2510 if(idTemperatureLastCall >= 3)
2511 idTemperatureLastCall = 0;
2512 temperatureLastCall[idTemperatureLastCall] = temperatureThisCall;
2513 // output
2514 headerText[2] = TXT_Temperature; 2501 headerText[2] = TXT_Temperature;
2515 textpointer = snprintf(text,TEXTSIZE,"\020\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F 2502 textpointer = snprintf(text,TEXTSIZE,"\020\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F
2516 if(settingsGetPointer()->nonMetricalSystem == 0) 2503 if(settingsGetPointer()->nonMetricalSystem == 0)
2517 text[textpointer++] = 'C'; 2504 text[textpointer++] = 'C';
2518 else 2505 else