diff Discovery/Src/t6_apnea.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 2bb1db22b5f5
line wrap: on
line diff
--- a/Discovery/Src/t6_apnea.c	Sat Mar 16 19:58:52 2019 +0000
+++ b/Discovery/Src/t6_apnea.c	Sun Mar 17 19:16:59 2019 +0100
@@ -74,8 +74,6 @@
 void t6_refresh_customview(float depth);
 
 uint8_t t6_test_customview_warnings(void);
-void t6_show_customview_warnings(void);
-void t6_compass(uint16_t ActualHeading, uint16_t UserSetHeading);
 
 /* Exported functions --------------------------------------------------------*/
 
@@ -331,398 +329,3 @@
     count = 0;
     return count;
 }
-
-/*
-
-    char text[512];
-    uint16_t textpointer = 0;
-
-
-    // CVIEW_T3_Temperature
-    float temperatureThisCall;
-    float temperature;
-
-
-    // CVIEW_T3_StopWatch
-    SDivetime Stopwatch = {0,0,0,0};
-    float fAverageDepth, fAverageDepthAbsolute;
-    uint16_t tempWinX0;
-    uint16_t tempWinY0;
-
-    switch(t6_selection_customview)
-    {
-        case CVIEW_T3_ApnoeTimes:
-        break;
-
-        case CVIEW_T3_StopWatch:
-            Stopwatch.Total = timer_Stopwatch_GetTime();
-            Stopwatch.Minutes = Stopwatch.Total / 60;
-            Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 );
-            fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter();
-            fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter;
-
-            snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth);
-            GFX_write_string(&FontT42,&t6c1,text,0);
-            snprintf(text,TEXTSIZE,"\030\003\016%01.1f",fAverageDepthAbsolute);
-            GFX_write_string(&FontT105,&t6c1,text,0);
-
-            tempWinX0 = t6c1.WindowX0;
-            tempWinY0 = t6c1.WindowY0;
-            t6c1.WindowX0 = 480;
-//			snprintf(text,TEXTSIZE,"\032\f%c%c - %c",TXT_2BYTE, TXT2BYTE_Clock, TXT_AvgDepth);
-            snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch);
-            GFX_write_string(&FontT42,&t6c1,text,0);
-            snprintf(text,TEXTSIZE,"\030\016%01.1f",fAverageDepth);
-            GFX_write_string(&FontT105,&t6c1,text,0);
-            t6c1.WindowY0 = 100;
-            snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds);
-            GFX_write_string(&FontT105,&t6c1,text,0);
-            t6c1.WindowX0 = tempWinX0;
-            t6c1.WindowY0 = tempWinY0;
-        break;
-
-        case CVIEW_T3_Temperature:
-            snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature);
-            GFX_write_string(&FontT42,&t6c1,text,0);
-            // mean value
-            temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius);
-            temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f;
-            idTemperatureLastCall++;
-            if(idTemperatureLastCall >= 3)
-                idTemperatureLastCall = 0;
-            temperatureLastCall[idTemperatureLastCall] = temperatureThisCall;
-            textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F
-            if(settingsGetPointer()->nonMetricalSystem == 0)
-                text[textpointer++] = 'C';
-            else
-                text[textpointer++] = 'F';
-            text[textpointer++] = 0;
-            GFX_write_string(&FontT105,&t6c1,text,0);
-        break;
-
-        case CVIEW_Compass:
-            snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass);
-            GFX_write_string(&FontT42,&t6c1,text,0);
-            snprintf(text,100,"\030\003%03i`",(uint16_t)stateUsed->lifeData.compass_heading);
-            GFX_write_string(&FontT105,&t6c1,text,0);
-            t6_compass((uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading);
-        break;
-
-        case CVIEW_T3_MaxDepth:
-        default:
-            snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
-            GFX_write_string(&FontT42,&t6c1,text,0);
-            snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter));
-            t3_basics_colorscheme_mod(text);
-            GFX_write_string(&FontT105,&t6c1,text,1);
-            break;
-    }
-}
-
-
-void t6_show_customview_warnings(void)
-{
-    char text[256], textMain[256];
-    uint8_t textpointer, textpointerMain, lineFree, more;
-
-    snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning);
-    GFX_write_string(&FontT42,&t6c1,text,0);
-
-    lineFree = 1;
-    more = 0;
-
-    textpointerMain = 0;
-    textMain[textpointerMain++] = '\025';
-    textMain[textpointerMain++] = '\003';
-
-    textpointer = 0;
-
-    text[textpointer++] = '\021';
-    text[textpointer++] = TXT_2BYTE;
-    text[textpointer++] = TXT2BYTE_WarnDecoMissed;
-    if(stateUsed->warnings.decoMissed)
-    {
-        text[textpointer - 3] =  '\025';
-        if(lineFree)
-        {
-            textMain[textpointerMain++] = TXT_2BYTE;
-            textMain[textpointerMain++] = text[textpointer - 1];
-            textMain[textpointerMain] = 0;
-            lineFree--;
-        }
-        else
-        {
-            more++;
-        }
-    }
-
-    text[textpointer++] = '\t';
-    text[textpointer++] = '\021';
-    text[textpointer++] = TXT_2BYTE;
-    text[textpointer++] = TXT2BYTE_WarnPPO2Low;
-    if(stateUsed->warnings.ppO2Low)
-    {
-        text[textpointer - 3] =  '\025';
-        if(lineFree)
-        {
-            textMain[textpointerMain++] = TXT_2BYTE;
-            textMain[textpointerMain++] = text[textpointer - 1];
-            textMain[textpointerMain] = 0;
-            lineFree--;
-        }
-        else
-        {
-            more++;
-        }
-    }
-
-    text[textpointer++] = '\n';
-    text[textpointer++] = '\r';
-    text[textpointer++] = '\021';
-    text[textpointer++] = TXT_2BYTE;
-    text[textpointer++] = TXT2BYTE_WarnPPO2High;
-    if(stateUsed->warnings.ppO2High)
-    {
-        text[textpointer - 3] =  '\025';
-        if(lineFree)
-        {
-            textMain[textpointerMain++] = TXT_2BYTE;
-            textMain[textpointerMain++] = text[textpointer - 1];
-            textMain[textpointerMain] = 0;
-            lineFree--;
-        }
-        else
-        {
-            more++;
-        }
-    }
-
-    text[textpointer++] = '\t';
-    text[textpointer++] = '\021';
-    text[textpointer++] = TXT_2BYTE;
-    text[textpointer++] = TXT2BYTE_WarnFallback;
-    if(stateUsed->warnings.fallback)
-    {
-        text[textpointer - 3] =  '\025';
-        if(lineFree)
-        {
-            textMain[textpointerMain++] = TXT_2BYTE;
-            textMain[textpointerMain++] = text[textpointer - 1];
-            textMain[textpointerMain] = 0;
-            lineFree--;
-        }
-        else
-        {
-            more++;
-        }
-    }
-
-    text[textpointer++] = '\n';
-    text[textpointer++] = '\r';
-    text[textpointer++] = '\021';
-    text[textpointer++] = TXT_2BYTE;
-    text[textpointer++] = TXT2BYTE_WarnSensorLinkLost;
-    if(stateUsed->warnings.sensorLinkLost)
-    {
-        text[textpointer - 3] =  '\025';
-        if(lineFree)
-        {
-            textMain[textpointerMain++] = TXT_2BYTE;
-            textMain[textpointerMain++] = text[textpointer - 1];
-            textMain[textpointerMain] = 0;
-            lineFree--;
-        }
-        else
-        {
-            more++;
-        }
-    }
-
-    text[textpointer] = 0;
-    GFX_write_string(&FontT48,&t6c1,textMain,1);
-    if(more)
-    {
-        GFX_write_string(&FontT48,&t6c2,text,1);
-    }
-}
-
-
-void t6_change_customview(void)
-{
-    const uint8_t *pViews;
-    pViews = t6_customviews;
-
-    while((*pViews != CVIEW_T3_END) && (*pViews != t6_selection_customview))
-        {pViews++;}
-
-    if(*pViews < CVIEW_T3_END)
-        pViews++;
-
-    if(*pViews == CVIEW_T3_END)
-    {
-        t6_selection_customview = t6_customviews[0];
-    }
-    else
-        t6_selection_customview = *pViews;
-}
-
-
-void t3_basics_colorscheme_mod(char *text)
-{
-    if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard())
-    {
-        text[0] = '\027';
-    }
-}
-
-point_t t6_compass_circle(uint8_t id, uint16_t degree)
-{
-    float fCos, fSin;
-    const float piMult =  ((2 * 3.14159) / 360);
-//	const int radius[4] = {95,105,115,60};
-    const int radius[4] = {85,95,105,90};
-    const point_t offset = {.x = 600, .y = 116};
-
-    static point_t r[4][360] = { 0 };
-
-    if(r[0][0].y == 0)
-    {
-        for(int i=0;i<360;i++)
-        {
-            fCos = cos(i * piMult);
-            fSin = sin(i * piMult);
-            for(int j=0;j<4;j++)
-            {
-                r[j][i].x = offset.x + (int)(fSin * radius[j]);
-                r[j][i].y = offset.y + (int)(fCos * radius[j]);
-            }
-        }
-    }
-    if(id > 3) id = 0;
-    if(degree > 359) degree = 0;
-    return r[id][degree];
-}
-
-
-void t6_compass(uint16_t ActualHeading, uint16_t UserSetHeading)
-{
-    uint16_t LineHeading;
-    point_t center;
-    static int32_t LastHeading = 0;
-    int32_t newHeading = 0;
-    int32_t diff = 0;
-    int32_t diff2 = 0;
-
-    int32_t diffAbs = 0;
-    int32_t diffAbs2 = 0;
-
-    newHeading = ActualHeading;
-
-    diff = newHeading - LastHeading;
-
-    if(newHeading < LastHeading)
-        diff2 = newHeading + 360 - LastHeading;
-    else
-        diff2 = newHeading - 360 - LastHeading;
-
-    diffAbs = diff;
-    if(diffAbs < 0)
-        diffAbs *= -1;
-
-    diffAbs2 = diff2;
-    if(diffAbs2 < 0)
-        diffAbs2 *= -1;
-
-
-    if(diffAbs <= diffAbs2)
-        newHeading = LastHeading + (diff / 2);
-    else
-        newHeading = LastHeading + (diff2 / 2);
-
-    if(newHeading < 0)
-        newHeading += 360;
-    else
-    if(newHeading >= 360)
-        newHeading -= 360;
-
-    LastHeading = newHeading;
-    ActualHeading = newHeading;
-
-    if (ActualHeading < 90)
-        ActualHeading += 360;
-
-    while(ActualHeading > 359) ActualHeading -= 360;
-
-    LineHeading = 360 - ActualHeading;
-    GFX_draw_thick_line(9,&t6screen, t6_compass_circle(0,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font030); // North
-    LineHeading += 90;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(9,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031); // Maintick
-    LineHeading += 90;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(9,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-    LineHeading += 90;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(9,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-
-    LineHeading = 360 - ActualHeading;
-    LineHeading += 45;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(5,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
-    LineHeading += 90;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(5,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-    LineHeading += 90;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(5,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-    LineHeading += 90;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(5,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-
-    LineHeading = 360 - ActualHeading;
-    LineHeading += 22;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
-    LineHeading += 45;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-    LineHeading += 45;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-    LineHeading += 45;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-    LineHeading += 45;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
-    LineHeading += 45;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-    LineHeading += 45;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-    LineHeading += 45;
-    if(LineHeading > 359) LineHeading -= 360;
-    GFX_draw_thick_line(3,&t6screen, t6_compass_circle(1,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_Font031);
-
-    if(UserSetHeading)
-    {
-        LineHeading = UserSetHeading + 360 - ActualHeading;
-        if(LineHeading > 359) LineHeading -= 360;
-        GFX_draw_thick_line(9,&t6screen, t6_compass_circle(3,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick);
-
-        // R�ckpeilung, User Back Heading
-        LineHeading = UserSetHeading + 360 + 180 - ActualHeading;
-        if(LineHeading > 359) LineHeading -= 360;
-        if(LineHeading > 359) LineHeading -= 360;
-        GFX_draw_thick_line(9,&t6screen, t6_compass_circle(3,LineHeading),  t6_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick);
-    }
-
-    center.x = 600;
-    center.y = 116;
-    GFX_draw_circle(&t6screen, center, 106, CLUT_Font030);
-    GFX_draw_circle(&t6screen, center, 107, CLUT_Font030);
-    GFX_draw_circle(&t6screen, center, 108, CLUT_Font030);
-}
-*/
-