Mercurial > public > ostc4
diff Discovery/Src/t7.c @ 160:e3ca52b8e7fa
Merge with FlipDisplay
author | heinrichsweikamp |
---|---|
date | Thu, 07 Mar 2019 15:06:43 +0100 |
parents | e1d66bc78f9a |
children | 255eedad4155 |
line wrap: on
line diff
--- a/Discovery/Src/t7.c Sat Oct 06 15:02:11 2018 +0200 +++ b/Discovery/Src/t7.c Thu Mar 07 15:06:43 2019 +0100 @@ -29,7 +29,6 @@ /* Includes ------------------------------------------------------------------*/ #include "t7.h" -//#include "bonexConnect.h" #include "data_exchange_main.h" #include "decom.h" #include "gfx_fonts.h" @@ -53,7 +52,6 @@ void t7_tissues(const SDiveState * pState); void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading); -void t7_scooter(void); void t7_SummaryOfLeftCorner(void); void t7_debug(void); @@ -144,36 +142,6 @@ CVIEW_END }; -const uint8_t customviewsDiveScooter[] = -{ - CVIEW_Scooter, - CVIEW_sensors, - CVIEW_Compass, - CVIEW_Decolist, - CVIEW_Tissues, - CVIEW_Profile, - CVIEW_Gaslist, - CVIEW_sensors_mV, - CVIEW_EADTime, - CVIEW_SummaryOfLeftCorner, - CVIEW_noneOrDebug, - CVIEW_END, - CVIEW_END -}; - -const uint8_t customviewsSurfaceScooter[] = -{ -// CVIEW_CompassDebug, - CVIEW_Scooter, - CVIEW_Hello, - CVIEW_sensors, - CVIEW_Compass, - CVIEW_Tissues, - CVIEW_sensors_mV, - CVIEW_END, - CVIEW_END -}; - const uint8_t *customviewsDive = customviewsDiveStandard; const uint8_t *customviewsSurface = customviewsSurfaceStandard; @@ -187,20 +155,21 @@ #define CUSTOMBOX_LINE_LEFT (250) #define CUSTOMBOX_LINE_RIGHT (549) +#define CUSTOMBOX_LINE_TOP (0) +#define CUSTOMBOX_LINE_MIDDLE (142) +#define CUSTOMBOX_LINE_BOTTOM (318) #define CUSTOMBOX_INSIDE_OFFSET (2) #define CUSTOMBOX_OUTSIDE_OFFSET (2) #define CUSTOMBOX_SPACE_INSIDE (CUSTOMBOX_LINE_RIGHT + 1 - (CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + CUSTOMBOX_INSIDE_OFFSET)) - +#define TOP_LINE_HIGHT (25) /* Exported functions --------------------------------------------------------*/ void t7_init(void) { - if(getLicence() == LICENCEBONEX) - { - customviewsDive = customviewsDiveScooter; - customviewsSurface = customviewsSurfaceScooter; - } + + SSettings* pSettings; + pSettings = settingsGetPointer(); selection_custom_field = 1; selection_customview = customviewsSurface[0]; @@ -215,48 +184,217 @@ t7screenCompass.ImageWidth = 1600; t7screenCompass.LayerIndex = 0; + if(!pSettings->FlipDisplay) + { + t7l1.Image = &t7screen; + t7l1.WindowNumberOfTextLines = 2; + t7l1.WindowLineSpacing = 19; // Abstand von Y0 + t7l1.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster + t7l1.WindowX0 = 0; + t7l1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; + t7l1.WindowY0 = 318; + t7l1.WindowY1 = 479; + + t7l2.Image = &t7screen; + t7l2.WindowNumberOfTextLines = 2; + t7l2.WindowLineSpacing = 22; // Abstand von Y0 + t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster + t7l2.WindowX0 = 0; + t7l2.WindowX1 = t7l1.WindowX1; + t7l2.WindowY0 = 142; + t7l2.WindowY1 = t7l1.WindowY0 - 5; + + t7l3.Image = &t7screen; + t7l3.WindowNumberOfTextLines = 2; + t7l3.WindowLineSpacing = 58; // Abstand von Y0 + t7l3.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster + t7l3.WindowX0 = 0; + t7l3.WindowX1 = t7l1.WindowX1; + t7l3.WindowY0 = 0; + t7l3.WindowY1 = t7l2.WindowY0 - 5; + + t7r1.Image = &t7screen; + t7r1.WindowNumberOfTextLines = 2; + t7r1.WindowLineSpacing = t7l1.WindowLineSpacing; + t7r1.WindowTab = 100; + t7r1.WindowX0 = 550; + t7r1.WindowX1 = 799; + t7r1.WindowY0 = t7l1.WindowY0; + t7r1.WindowY1 = 479; + + t7r2.Image = &t7screen; + t7r2.WindowNumberOfTextLines = 2; + t7r2.WindowLineSpacing = t7l2.WindowLineSpacing; + t7r2.WindowTab = 100; + t7r2.WindowX0 = 550; + t7r2.WindowX1 = 799; + t7r2.WindowY0 = t7l2.WindowY0; + t7r2.WindowY1 = t7l2.WindowY1; + + t7r3.Image = &t7screen; + t7r3.WindowNumberOfTextLines = 2; + t7r3.WindowLineSpacing = 0;//t7l3.WindowLineSpacing; + t7r3.WindowTab = 100; + t7r3.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; + t7r3.WindowX1 = 799; + t7r3.WindowY0 = t7l3.WindowY0; + t7r3.WindowY1 = t7l3.WindowY1; + + t7cC.Image = &t7screen; + t7cC.WindowNumberOfTextLines = 3; + t7cC.WindowLineSpacing = 95; // Abstand von Y0 + t7cC.WindowTab = 100; + t7cC.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; + t7cC.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; + t7cC.WindowY0 = 90; + t7cC.WindowY1 = 434 - 95; + + t7cH.Image = &t7screen; + t7cH.WindowNumberOfTextLines = 1; + t7cH.WindowLineSpacing = 95; // Abstand von Y0 + t7cH.WindowTab = 100; + t7cH.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; + t7cH.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; + t7cH.WindowY0 = 434 - 94; + t7cH.WindowY1 = 434; + + t7cW.Image = &t7screen; + t7cW.WindowNumberOfTextLines = 3; + t7cW.WindowLineSpacing = 95; // Abstand von Y0 + t7cW.WindowTab = 100; + t7cW.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; + t7cW.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; + t7cW.WindowY0 = 90; + t7cW.WindowY1 = 434 - 95; + + + t7surfaceL.Image = &t7screen; + t7surfaceL.WindowNumberOfTextLines = 9; + t7surfaceL.WindowLineSpacing = 53; + t7surfaceL.WindowTab = 100; + t7surfaceL.WindowX0 = 0; + t7surfaceL.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; + t7surfaceL.WindowY0 = 0; + t7surfaceL.WindowY1 = 480; + + t7surfaceR.Image = &t7screen; + t7surfaceR.WindowNumberOfTextLines = 9; + t7surfaceR.WindowLineSpacing = 53; + t7surfaceR.WindowTab = 100; + t7surfaceR.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; + t7surfaceR.WindowX1 = 800; + t7surfaceR.WindowY0 = 0; + t7surfaceR.WindowY1 = 480; + + t7cY0free.Image = &t7screen; + t7cY0free.WindowNumberOfTextLines = 1; + t7cY0free.WindowLineSpacing = 95; + t7cY0free.WindowTab = 100; + t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; + t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; + t7cY0free.WindowY0 = 90; + t7cY0free.WindowY1 = 434 - 95; + + t7batt.Image = &t7screen; + t7batt.WindowNumberOfTextLines = 1; + t7batt.WindowLineSpacing = 10; + t7batt.WindowTab = 100; + t7batt.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; + t7batt.WindowX0 = t7batt.WindowX1 - (52+52); + t7batt.WindowY1 = 479; + t7batt.WindowY0 = t7batt.WindowY1 - 25; + + t7charge.Image = &t7screen; + t7charge.WindowNumberOfTextLines = 1; + t7charge.WindowLineSpacing = 10; + t7charge.WindowTab = 100; + t7charge.WindowX1 = t7batt.WindowX1 - 18; + t7charge.WindowX0 = t7charge.WindowX1 - 14; + t7charge.WindowY1 = 479; + t7charge.WindowY0 = t7batt.WindowY1 - 25; + + t7voltage.Image = &t7screen; + t7voltage.WindowNumberOfTextLines = 1; + t7voltage.WindowLineSpacing = 10; + t7voltage.WindowTab = 100; + t7voltage.WindowX0 = t7charge.WindowX0 - 10; + t7voltage.WindowX1 = t7voltage.WindowX0 + (18*3)+ 9; + t7voltage.WindowY1 = 479; + t7voltage.WindowY0 = t7batt.WindowY1 - 25; + + t7c1.Image = &t7screen; + t7c1.WindowNumberOfTextLines = 1; + t7c1.WindowLineSpacing = 10; + t7c1.WindowTab = 100; + t7c1.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; + t7c1.WindowX1 = t7batt.WindowX0 - 18; + t7c1.WindowY0 = 435; + t7c1.WindowY1 = 479; + + t7c2.Image = &t7screen; + t7c2.WindowNumberOfTextLines = 1; + t7c2.WindowLineSpacing = 0; // Abstand von Y0 + t7c2.WindowTab = 100; + t7c2.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; + t7c2.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; + t7c2.WindowY0 = 0; + t7c2.WindowY1 = 69; + + t7pCompass.Image = &t7screenCompass; + t7pCompass.WindowNumberOfTextLines = 1; + t7pCompass.WindowLineSpacing = 100; // Abstand von Y0 + t7pCompass.WindowTab = 100; + t7pCompass.WindowX0 = 0; + t7pCompass.WindowX1 = 1600-1; + t7pCompass.WindowY0 = 0; + t7pCompass.WindowY1 = 100-1; + } + else + { +/* 6 segments (left / right) used to show data during dive */ + t7l1.Image = &t7screen; t7l1.WindowNumberOfTextLines = 2; t7l1.WindowLineSpacing = 19; // Abstand von Y0 t7l1.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster - t7l1.WindowX0 = 0; - t7l1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; - t7l1.WindowY0 = 318; - t7l1.WindowY1 = 479; + t7l1.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; + t7l1.WindowX1 = 799; + t7l1.WindowY0 = CUSTOMBOX_LINE_TOP; + t7l1.WindowY1 = 150 + TOP_LINE_HIGHT; t7l2.Image = &t7screen; t7l2.WindowNumberOfTextLines = 2; t7l2.WindowLineSpacing = 22; // Abstand von Y0 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster - t7l2.WindowX0 = 0; + t7l2.WindowX0 = t7l1.WindowX0; t7l2.WindowX1 = t7l1.WindowX1; - t7l2.WindowY0 = 142; - t7l2.WindowY1 = t7l1.WindowY0 - 5; + t7l2.WindowY0 = t7l1.WindowY1 + 5; + t7l2.WindowY1 = t7l2.WindowY0 + 146; t7l3.Image = &t7screen; t7l3.WindowNumberOfTextLines = 2; t7l3.WindowLineSpacing = 58; // Abstand von Y0 t7l3.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster - t7l3.WindowX0 = 0; - t7l3.WindowX1 = t7l1.WindowX1; - t7l3.WindowY0 = 0; - t7l3.WindowY1 = t7l2.WindowY0 - 5; + t7l3.WindowX0 = t7l1.WindowX0; + t7l3.WindowX1 = t7l1.WindowX1;; + t7l3.WindowY0 = 479 - 150; + t7l3.WindowY1 = 479; t7r1.Image = &t7screen; t7r1.WindowNumberOfTextLines = 2; t7r1.WindowLineSpacing = t7l1.WindowLineSpacing; t7r1.WindowTab = 100; - t7r1.WindowX0 = 550; - t7r1.WindowX1 = 799; + t7r1.WindowX0 = 0; + t7r1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; t7r1.WindowY0 = t7l1.WindowY0; - t7r1.WindowY1 = 479; + t7r1.WindowY1 = t7l1.WindowY1; t7r2.Image = &t7screen; t7r2.WindowNumberOfTextLines = 2; t7r2.WindowLineSpacing = t7l2.WindowLineSpacing; t7r2.WindowTab = 100; - t7r2.WindowX0 = 550; - t7r2.WindowX1 = 799; + t7r2.WindowX0 = t7r1.WindowX0; + t7r2.WindowX1 = t7r1.WindowX1; t7r2.WindowY0 = t7l2.WindowY0; t7r2.WindowY1 = t7l2.WindowY1; @@ -264,118 +402,132 @@ t7r3.WindowNumberOfTextLines = 2; t7r3.WindowLineSpacing = 0;//t7l3.WindowLineSpacing; t7r3.WindowTab = 100; - t7r3.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; - t7r3.WindowX1 = 799; + t7r3.WindowX0 = t7r1.WindowX0; + t7r3.WindowX1 = t7r1.WindowX1; t7r3.WindowY0 = t7l3.WindowY0; t7r3.WindowY1 = t7l3.WindowY1; +/* screen for CustomText / serial number */ t7cC.Image = &t7screen; t7cC.WindowNumberOfTextLines = 3; t7cC.WindowLineSpacing = 95; // Abstand von Y0 t7cC.WindowTab = 100; t7cC.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; t7cC.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; - t7cC.WindowY0 = 90; - t7cC.WindowY1 = 434 - 95; - + t7cC.WindowY0 = 165; //90; + t7cC.WindowY1 = 415; + + /* used by warning message box */ t7cH.Image = &t7screen; t7cH.WindowNumberOfTextLines = 1; t7cH.WindowLineSpacing = 95; // Abstand von Y0 t7cH.WindowTab = 100; t7cH.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; t7cH.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; - t7cH.WindowY0 = 434 - 94; - t7cH.WindowY1 = 434; - + t7cH.WindowY0 = 46; //480 - 434; + t7cH.WindowY1 = 390 - 46;// - 90; //46 + 390; //480 - (434 - 94); //434; + + /* used by warning custom box */ t7cW.Image = &t7screen; t7cW.WindowNumberOfTextLines = 3; t7cW.WindowLineSpacing = 95; // Abstand von Y0 t7cW.WindowTab = 100; t7cW.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; t7cW.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; - t7cW.WindowY0 = 90; - t7cW.WindowY1 = 434 - 95; - + t7cW.WindowY0 = 480 - (434 - 90); + t7cW.WindowY1 = 480 - 90; //434 - 95; + +/* time and environment */ t7surfaceL.Image = &t7screen; t7surfaceL.WindowNumberOfTextLines = 9; t7surfaceL.WindowLineSpacing = 53; t7surfaceL.WindowTab = 100; - t7surfaceL.WindowX0 = 0; - t7surfaceL.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; + t7surfaceL.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; + t7surfaceL.WindowX1 = 799; t7surfaceL.WindowY0 = 0; - t7surfaceL.WindowY1 = 480; + t7surfaceL.WindowY1 = 479; t7surfaceR.Image = &t7screen; t7surfaceR.WindowNumberOfTextLines = 9; t7surfaceR.WindowLineSpacing = 53; t7surfaceR.WindowTab = 100; - t7surfaceR.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; - t7surfaceR.WindowX1 = 800; + t7surfaceR.WindowX0 = 0; + t7surfaceR.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; t7surfaceR.WindowY0 = 0; - t7surfaceR.WindowY1 = 480; - + t7surfaceR.WindowY1 = 479; + +/* info screen in the middle */ t7cY0free.Image = &t7screen; t7cY0free.WindowNumberOfTextLines = 1; t7cY0free.WindowLineSpacing = 95; t7cY0free.WindowTab = 100; t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; - t7cY0free.WindowY0 = 90; - t7cY0free.WindowY1 = 434 - 95; - + t7cY0free.WindowY0 = 115; + t7cY0free.WindowY1 = 365; + +/* voltage value (V or %) */ + t7voltage.Image = &t7screen; + t7voltage.WindowNumberOfTextLines = 1; + t7voltage.WindowLineSpacing = 10; + t7voltage.WindowTab = 100; + t7voltage.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; + t7voltage.WindowX1 = t7voltage.WindowX0 + (18*3) +9; + t7voltage.WindowY1 = TOP_LINE_HIGHT; + t7voltage.WindowY0 = 0; + +/* battery symbol */ t7batt.Image = &t7screen; t7batt.WindowNumberOfTextLines = 1; t7batt.WindowLineSpacing = 10; t7batt.WindowTab = 100; - t7batt.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; - t7batt.WindowX0 = t7batt.WindowX1 - (52+52); - t7batt.WindowY1 = 479; - t7batt.WindowY0 = t7batt.WindowY1 - 25; - + t7batt.WindowX0 = t7voltage.WindowX1; + t7batt.WindowX1 = t7batt.WindowX0 + (52); + t7batt.WindowY1 = TOP_LINE_HIGHT; + t7batt.WindowY0 = 0; + +/* charger symbol */ t7charge.Image = &t7screen; t7charge.WindowNumberOfTextLines = 1; t7charge.WindowLineSpacing = 10; t7charge.WindowTab = 100; - t7charge.WindowX1 = t7batt.WindowX1 - 18; + t7charge.WindowX1 = t7batt.WindowX0 - 18; t7charge.WindowX0 = t7charge.WindowX1 - 14; - t7charge.WindowY1 = 479; - t7charge.WindowY0 = t7batt.WindowY1 - 25; - - t7voltage.Image = &t7screen; - t7voltage.WindowNumberOfTextLines = 1; - t7voltage.WindowLineSpacing = 10; - t7voltage.WindowTab = 100; - t7voltage.WindowX0 = t7charge.WindowX0 - 10; - t7voltage.WindowX1 = t7voltage.WindowX0 + (18*3)+ 9; - t7voltage.WindowY1 = 479; - t7voltage.WindowY0 = t7batt.WindowY1 - 25; - + + t7charge.WindowY1 = TOP_LINE_HIGHT; + t7charge.WindowY0 = 0; + +/* show dive mode OC / CC */ t7c1.Image = &t7screen; t7c1.WindowNumberOfTextLines = 1; t7c1.WindowLineSpacing = 10; t7c1.WindowTab = 100; - t7c1.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; - t7c1.WindowX1 = t7batt.WindowX0 - 18; - t7c1.WindowY0 = 435; - t7c1.WindowY1 = 479; - + t7c1.WindowX0 = t7batt.WindowX1 + 18; //CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; + t7c1.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; //t7batt.WindowX1 + 18; + t7c1.WindowY0 = 0; + t7c1.WindowY1 = 479 - 435; + +/* Gas warnings and exit Sim*/ t7c2.Image = &t7screen; t7c2.WindowNumberOfTextLines = 1; t7c2.WindowLineSpacing = 0; // Abstand von Y0 t7c2.WindowTab = 100; t7c2.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; t7c2.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; - t7c2.WindowY0 = 0; - t7c2.WindowY1 = 69; - + t7c2.WindowY0 = 480 - 69; + t7c2.WindowY1 = 479; + +/* Rotating compass */ t7pCompass.Image = &t7screenCompass; t7pCompass.WindowNumberOfTextLines = 1; t7pCompass.WindowLineSpacing = 100; // Abstand von Y0 t7pCompass.WindowTab = 100; t7pCompass.WindowX0 = 0; t7pCompass.WindowX1 = 1600-1; - t7pCompass.WindowY0 = 0; - t7pCompass.WindowY1 = 100-1; + t7pCompass.WindowY0 = 479 - 75; + t7pCompass.WindowY1 = 479; + + } init_t7_compass(); } @@ -441,13 +593,6 @@ releaseFrame(22,t7screen.FBStartAdress); return; } - else if(DataEX_scooterFoundAndValidLicence()) // new for t9 hw 160711 - { - settingsGetPointer()->design = 9; - releaseAllFramesExcept(22,t7screen.FBStartAdress); - releaseFrame(22,t7screen.FBStartAdress); - return; - } else { t7_refresh_divemode(); @@ -538,6 +683,10 @@ // uint16_t bottleFirstGas_bar; point_t start, stop;//, other; + SSettings* pSettings; + pSettings = settingsGetPointer(); + + // update in all customview modes if(DataEX_check_RTE_version__needs_update() || font_update_required()) updateNecessary = 1; @@ -548,31 +697,19 @@ text[0] = TXT_2BYTE; text[1] = TXT2BYTE_ButtonLogbook; text[2] = 0; - write_content_simple(&t7screen, 0, 800, 480-24, &FontT24,text,CLUT_ButtonSurfaceScreen); + write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); text[0] = '\001'; text[1] = TXT_2BYTE; text[2] = TXT2BYTE_ButtonView; text[3] = 0; - write_content_simple(&t7screen, 0, 800, 480-24, &FontT24,text,CLUT_ButtonSurfaceScreen); + write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); text[0] = '\002'; text[1] = TXT_2BYTE; text[2] = TXT2BYTE_ButtonMenu; text[3] = 0; - write_content_simple(&t7screen, 0, 800, 480-24, &FontT24,text,CLUT_ButtonSurfaceScreen); - -/* - // scooter connected? - if(bC_getData(0,0,0,0) == BC_CONNECTED) - { - text[0] = '\f'; - text[1] = '\002'; - memcpy(&text[2],&settingsGetPointer()->scooterDeviceName,19); - text[21] = 0; - GFX_write_string_color(&FontT24,&t7r1,text,0,CLUT_NiceGreen); - } -*/ + write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); /* was power on reset */ //..... @@ -775,7 +912,7 @@ /* surface pressure and temperature */ if(stateUsed->sensorErrorsRTE == 0) { - snprintf(text,30,"%01.0f\022\016\016 mbar", stateUsed->lifeData.pressure_surface_bar * 1000.0f); + snprintf(text,30,"%01.0f\022\016\016 %s", stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT); GFX_write_string(&FontT48,&t7surfaceL,text,3); if(settingsGetPointer()->nonMetricalSystem) @@ -786,7 +923,7 @@ } else { - snprintf(text,30,"ERR\022\016\016 mbar"); + snprintf(text,30,"ERR\022\016\016 %s",TEXT_PRESSURE_UNIT); GFX_write_string(&FontT48,&t7surfaceL,text,3); if(settingsGetPointer()->nonMetricalSystem) @@ -865,8 +1002,17 @@ // after gas name :-) if(actualGasID > gasOffset) // security { - start.y = t7surfaceL.WindowY0 + (3 * t7surfaceL.WindowLineSpacing); - start.x = t7surfaceL.WindowX0 + ((stateUsed->lifeData.actualGas.GasIdInSettings - gasOffset - 1) * 35); + if(!pSettings->FlipDisplay) + { + start.y = t7surfaceL.WindowY0 + (3 * t7surfaceL.WindowLineSpacing); + start.x = t7surfaceL.WindowX0 + ((stateUsed->lifeData.actualGas.GasIdInSettings - gasOffset - 1) * 35); + } + else + { + start.y = t7surfaceR.WindowY0 + (3 * t7surfaceR.WindowLineSpacing); + start.x = t7surfaceR.WindowX0 + ((stateUsed->lifeData.actualGas.GasIdInSettings - gasOffset - 1) * 35); + } + stop.x = start.x + 25; stop.y = start.y + 52; GFX_draw_box2(&t7screen, start, stop, CLUT_Font020, 1); @@ -921,7 +1067,7 @@ snprintf(text,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); if(warning_count_high_time) text[0] = '\a'; - GFX_write_string(&FontT24,&t7batt,text,0); + GFX_write_string(&FontT24,&t7voltage,text,0); } else { @@ -936,7 +1082,8 @@ if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) { snprintf(text,16,"\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); - GFX_write_string(&FontT24,&t7batt,text,0); + // GFX_write_string(&FontT24,&t7batt,text,0); + GFX_write_string(&FontT24,&t7voltage,text,0); } else { @@ -1090,7 +1237,7 @@ Gfx_write_label_var(&t7screen, 0,400,255,&FontT48,CLUT_Font020,TextL1); return; } - snprintf(TextL1,TEXTSIZE,"%01.0f mbar",stateUsed->lifeData.pressure_ambient_bar * 1000.0f); + snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_ambient_bar * 1000.0f,TEXT_PRESSURE_UNIT); Gfx_write_label_var(&t7screen, 0,400, 0,&FontT42,CLUT_DiveMainLabel,"Ambient Pressure"); Gfx_write_label_var(&t7screen, 0,400, 45,&FontT48,CLUT_Font020,TextL1); @@ -1102,7 +1249,7 @@ Gfx_write_label_var(&t7screen, 0,400,200,&FontT42,CLUT_DiveMainLabel,"Heading Roll Pitch"); Gfx_write_label_var(&t7screen, 0,400,255,&FontT48,CLUT_Font020,TextL1); - snprintf(TextL1,TEXTSIZE,"%01.0f mbar",stateUsed->lifeData.pressure_surface_bar * 1000.0f); + snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT); Gfx_write_label_var(&t7screen, 0,400,310,&FontT42,CLUT_DiveMainLabel,"Surface Pressure"); Gfx_write_label_var(&t7screen, 0,400,355,&FontT48,CLUT_Font020,TextL1); @@ -1382,11 +1529,6 @@ } } while(cv_disabled); } - - -// if((*pViews == CVIEW_Scooter) && (getLicence() != LICENCEBONEX)) -// pViews++; - selection_customview = *pViews; } @@ -1403,16 +1545,6 @@ void t7_refresh_customview(void) { - if((selection_customview == CVIEW_Scooter) && (getLicence() != LICENCEBONEX)) - t7_change_customview(); - if((selection_customview == CVIEW_Scooter) && (!DataEX_scooterFoundAndValidLicence() && (stateRealGetPointer()->mode == MODE_DIVE))) - t7_change_customview(); - if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) - t7_change_customview(); - if((selection_customview == CVIEW_sensors_mV) &&(stateUsed->diveSettings.ccrOption == 0)) - t7_change_customview(); - if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) - t7_change_customview(); char text[256]; uint16_t textpointer = 0; @@ -1426,6 +1558,16 @@ uint8_t oxygen, helium; // CVIEW_Gaslist float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) + t7_change_customview(); + if((selection_customview == CVIEW_sensors_mV) &&(stateUsed->diveSettings.ccrOption == 0)) + t7_change_customview(); + if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) + t7_change_customview(); + switch(selection_customview) { case CVIEW_noneOrDebug: @@ -1534,12 +1676,6 @@ } break; - case CVIEW_Scooter: - snprintf(text,100,"\032\f\001Scooter"); - GFX_write_string(&FontT42,&t7cH,text,0); - t7_scooter(); - break; - case CVIEW_Gaslist: // a lot of code taken from tMenuGas.c // header @@ -1547,7 +1683,15 @@ GFX_write_string(&FontT42,&t7cH,text,0); // content textpointer = 0; - t7cY0free.WindowY0 = t7cC.WindowY0 - 10; + + if(!pSettings->FlipDisplay) + { + t7cY0free.WindowY0 = t7cC.WindowY0 - 10; + } + else + { + t7cY0free.WindowY1 = 400; + } t7cY0free.WindowLineSpacing = 48+9; t7cY0free.WindowNumberOfTextLines = 5; // NUM_GASES == 5 t7cY0free.WindowTab = 420; @@ -1588,6 +1732,10 @@ textpointer = 0; t7cY0free.WindowY0 = t7cC.WindowY0 - 10; + if(pSettings->FlipDisplay) + { + t7cY0free.WindowY1 = 400; + } t7cY0free.WindowLineSpacing = 48; t7cY0free.WindowNumberOfTextLines = 6; @@ -1716,11 +1864,28 @@ snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE, TXT2BYTE_Compass); GFX_write_string(&FontT42,&t7cH,text,0); t7_compass((uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading); - t7cY0free.WindowY0 = 230; - t7cY0free.WindowX0 += 15; + + if(!pSettings->FlipDisplay) + { + t7cY0free.WindowX0 += 15; + t7cY0free.WindowY0 = 230; + } + else + { + t7cY0free.WindowX0 -= 15; + t7cY0free.WindowY0 = 0; + t7cY0free.WindowY1 = 250; + } snprintf(text,100,"\030\001%03i`",(uint16_t)stateUsed->lifeData.compass_heading); GFX_write_string(&FontT54,&t7cY0free,text,0); - t7cY0free.WindowX0 -= 15; + if(!pSettings->FlipDisplay) + { + t7cY0free.WindowX0 -= 15; + } + else + { + t7cY0free.WindowX0 += 15; + } break; case CVIEW_Decolist: @@ -1765,7 +1930,16 @@ textpointer += snprintf(&text[textpointer],20,"\031\034 %2u\016\016%c%c\017\n\r",depthNext, unit_depth_char1(), unit_depth_char2()); if(textpointer > 200) break; } - t7cY0free.WindowY0 = t7cC.WindowY0 - 10; + if(!pSettings->FlipDisplay) + { + t7cY0free.WindowY0 = t7cC.WindowY0 - 10; + } + else + { + t7cY0free.WindowY0 = t7cC.WindowY0 - 10; + t7cY0free.WindowY1 = 400; + } + t7cY0free.WindowLineSpacing = 48; t7cY0free.WindowNumberOfTextLines = 6; GFX_write_string(&FontT42, &t7cY0free, text, 1); @@ -1803,6 +1977,9 @@ uint8_t customview_warnings = 0; const SDecoinfo * pDecoinfo; + SSettings* pSettings; + pSettings = settingsGetPointer(); + Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; Divetime.Minutes = Divetime.Total / 60; Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); @@ -1898,7 +2075,15 @@ /* ascentrate graph */ if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) { - start.y = t7l1.WindowY0 - 1; + if(!pSettings->FlipDisplay) + { + start.y = t7l1.WindowY0 - 1; + } + else + { + start.y = t7l3.WindowY0 - 25; + } + for(int i = 0; i<4;i++) { start.y += 5*6; @@ -1913,7 +2098,14 @@ // new thick bar design Sept. 2015 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 3 - 5; stop.x = start.x; - start.y = t7l1.WindowY0 - 1; + if(!pSettings->FlipDisplay) + { + start.y = t7l1.WindowY0 - 1; + } + else + { + start.y = t7l3.WindowY0 - 25; + } stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 6); stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 if(stop.y >= 470) @@ -2227,7 +2419,7 @@ snprintf(TextC1,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); if(warning_count_high_time) TextC1[0] = '\a'; - GFX_write_string(&FontT24,&t7batt,TextC1,0); + GFX_write_string(&FontT24,&t7voltage,TextC1,0); } } else @@ -2239,7 +2431,7 @@ { snprintf(TextC1,16,"\020\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); t7_colorscheme_mod(TextC1); - GFX_write_string(&FontT24,&t7batt,TextC1,0); + GFX_write_string(&FontT24,&t7voltage,TextC1,0); // t7batt } } @@ -2484,6 +2676,9 @@ point_t LeftLow, WidthHeight; point_t start, stop; + SSettings* pSettings; + pSettings = settingsGetPointer(); + // plugin box LeftLow.x = CUSTOMBOX_LINE_LEFT; WidthHeight.x = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_LINE_LEFT; @@ -2505,17 +2700,47 @@ // aufteilung links start.x = 0; stop.x = CUSTOMBOX_LINE_LEFT; - stop.y = start.y = t7l1.WindowY0 - 1; + if(!pSettings->FlipDisplay) + { + stop.y = start.y = t7l1.WindowY0 - 1; + } + else + { + stop.y = start.y = 480 - t7l1.WindowY1 - 1; + } + GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); - stop.y = start.y = t7l2.WindowY0 -1; + if(!pSettings->FlipDisplay) + { + stop.y = start.y = t7l2.WindowY0 -1; + } + else + { + stop.y = start.y = 480 - t7l2.WindowY1 -1; + } GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); // aufteilung rechts start.x = CUSTOMBOX_LINE_RIGHT; stop.x = 799; - stop.y = start.y = t7l1.WindowY0 - 1; + if(!pSettings->FlipDisplay) + { + stop.y = start.y = t7l1.WindowY0 - 1; + } + else + { + stop.y = start.y = 480 - t7l1.WindowY1 - 1; + } + GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); - stop.y = start.y = t7l2.WindowY0 - 1; + if(!pSettings->FlipDisplay) + { + stop.y = start.y = t7l2.WindowY0 - 1; + } + else + { + stop.y = start.y = 480 - t7l2.WindowY1 - 1; + } GFX_draw_line(&t7screen, start, stop, colorLinesOnTheSide); } } @@ -2541,7 +2766,7 @@ static point_t r[4][360] = { 0 }; - if(r[0][0].y == 0) + if(r[0][0].y == 0) /* calc table at first call only */ { for(int i=0;i<360;i++) { @@ -2576,10 +2801,21 @@ float partial_pressure_N2; float partial_pressure_He; + SSettings* pSettings; + pSettings = settingsGetPointer(); + /* N2 */ t7cY0free.WindowLineSpacing = 28 + 48 + 14; - t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; + if(!pSettings->FlipDisplay) + { + t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; + } + else + { + t7cY0free.WindowY0 = t7cH.WindowY0 + 15; + t7cY0free.WindowY1 = t7cY0free.WindowY0 + 250; + } t7cY0free.WindowNumberOfTextLines = 3; text[textpointer++] = '\030'; @@ -2597,7 +2833,14 @@ GFX_write_string(&FontT24, &t7cY0free, text, 1); - start.y = t7cH.WindowY0 - 5; + if(!pSettings->FlipDisplay) + { + start.y = t7cH.WindowY0 - 5; + } + else + { + start.y = t7cH.WindowY1 - 5; + } start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; stop.x = start.x + CUSTOMBOX_SPACE_INSIDE; @@ -2694,7 +2937,15 @@ partial_pressure_He = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_He; // Nitrogen vertical bar - start.y = t7cH.WindowY0 + 1 - 5; + if(!pSettings->FlipDisplay) + { + start.y = t7cH.WindowY0 + 1 - 5; + } + else + { + start.y = t7cH.WindowY1 - 5; + } + stop.y = start.y - (3 * 15) - 1; if((percent_N2 > 0) && (partial_pressure_N2 > 0.8f))//(0.8f + 0.5f))) { @@ -2718,7 +2969,15 @@ // Helium vertical bar - start.y = t7cH.WindowY0 + 1 - 5 - 3*16 - 28 - 14; + if(!pSettings->FlipDisplay) + { + start.y = t7cH.WindowY0 + 1 - 5 - 3*16 - 28 - 14; + } + else + { + start.y = t7cH.WindowY1 - 5 - 3*16 - 28 - 14; + } + stop.y = start.y - (3 * 15) - 1; if((percent_He > 0) && (partial_pressure_He > 0.01f)) // 0.5f { @@ -2743,12 +3002,21 @@ GFX_draw_thick_line(2,&t7screen, start, stop, CLUT_EverythingOkayGreen); // Oxygen vertical bar - start.y = t7cH.WindowY0 + 1 - 5 - 6*16 - 2*28 - 2*14; + if(!pSettings->FlipDisplay) + { + start.y = t7cH.WindowY0 + 1 - 5 - 6*16 - 2*28 - 2*14; + } + else + { + start.y = t7cH.WindowY1 - 5 - 6*16 - 2*28 - 2*14; + } + stop.y = start.y - (3 * 15) - 1; start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + cns100pixel; stop.x = start.x; GFX_draw_thick_line(2, &t7screen, start, stop, CLUT_WarningRed); + } @@ -2863,305 +3131,6 @@ } -void t7_scooter(void) -{ - float scooterTemperatureLocal; - uint16_t scooterSpeedLocal; -// uint16_t scooterDrehzhl; - uint8_t scooterResidualCapacity; -// float scooterVoltage; -// uint8_t scooterCurrent; - //uint16_t scooterWattHours; -// uint16_t bkpX0, bkpX1; - uint16_t ageInMilliSeconds; - - uint8_t textSize; - - scooterTemperatureLocal = unit_temperature_float(((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f); - scooterSpeedLocal = unit_speed_integer(stateUsed->lifeData.scooterSpeed); - scooterResidualCapacity = stateUsed_scooterRemainingBattCapacity(); - -// scooterDrehzhl = stateUsed->lifeData.scooterDrehzahl; -// scooterVoltage = stateUsed->lifeData.scooterSpannung; -// scooterCurrent = stateUsed->lifeData.scooterAmpere; -// scooterWattHours = stateUsed->lifeData.scooterWattstunden; - - ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds; - if(!ageInMilliSeconds) - ageInMilliSeconds = 9999; - - char text[256+60]; - uint8_t textpointer = 0; - - t7cY0free.WindowLineSpacing = 28 + 48 + 14; - t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; - t7cY0free.WindowNumberOfTextLines = 3; - - // header -// text[textpointer++] = '\032'; - text[textpointer++] = TXT_2BYTE; - text[textpointer++] = TXT2BYTE_ScooterRestkapazitaet; - text[textpointer++] = '\n'; - text[textpointer++] = '\r'; - text[textpointer++] = TXT_2BYTE; - text[textpointer++] = TXT2BYTE_ScooterTemperature; - text[textpointer++] = '\n'; - text[textpointer++] = '\r'; - text[textpointer++] = TXT_2BYTE; - text[textpointer++] = TXT2BYTE_ScooterSpeed; - text[textpointer++] = 0; - GFX_write_string(&FontT24, &t7cY0free, text, 1); - -/* - snprintf(text,60, - "\032" - "%0u" "\016\016 Wh used\017" - ,stateUsed->lifeData.scooterWattstunden); -*/ - - GFX_write_string(&FontT24, &t7cY0free, text, 1); - -/* - snprintf(text,60, - "\030" - "\n\r" - "\n\r" - "%0u" "\022\016\016 rpm\017\030" - ,stateUsed->lifeData.scooterDrehzahl); - GFX_write_string(&FontT24, &t7cY0free, text, 1); -*/ - // data - t7cY0free.WindowY0 -= 52; - if(settingsGetPointer()->nonMetricalSystem == 0) - { - textSize = snprintf(text,60, - "\030" - "%0u" "\022\016\016 %%\017\030" - "\n\r" - "%0.0f\140" "\022\016\016 C\017\030" - "\n\r" - "%u" "\022\016\016 m/min\017\030" - ,scooterResidualCapacity,scooterTemperatureLocal,scooterSpeedLocal); - } - else - { - textSize = snprintf(text,60, - "\030" - "%0u" "\022\016\016 %%\017\030" - "\n\r" - "%0.0f\140" "\022\016\016 Fht\017\030" - "\n\r" - "%u" "\022\016\016 ft/min\017\030" - ,scooterResidualCapacity,scooterTemperatureLocal,scooterSpeedLocal); - } - // connection active - if(ageInMilliSeconds > 1500) - { - for(int i=0; i < textSize -2; i++) - { - if(text[i] == '\030') - text[i] = '\031'; - } - } - // write data - GFX_write_string(&FontT42, &t7cY0free, text, 1); - - // age stamp - if(ageInMilliSeconds < 9999) - { - t7cY0free.WindowY0 -= 30; - snprintf(text,60, - "\021\001%u" - ,ageInMilliSeconds); - GFX_write_string(&FontT24, &t7cY0free, text, 0); - } -} - - -void t7_scooter_May2016_01(void) -{ - float scooterTemperature; - uint16_t scooterDrehzhl; - uint8_t scooterResidualCapacity; - float scooterSpeed; - float scooterVoltage; - uint8_t scooterCurrent; -// uint16_t scooterWattHours; - uint16_t bkpX0, bkpX1; - - uint16_t ageInMilliSeconds; - uint8_t textSize; -// old scooterStatus = bC_getData(0,&scooterTemperature,&scooterDrehzhl,&scooterResidualCapacity); - - scooterDrehzhl = stateUsed->lifeData.scooterDrehzahl; - scooterTemperature = ((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f; - scooterResidualCapacity = stateUsed_scooterRemainingBattCapacity(); - - scooterVoltage = stateUsed->lifeData.scooterSpannung; - scooterCurrent = stateUsed->lifeData.scooterAmpere; -// scooterWattHours = stateUsed->lifeData.scooterWattstunden; - - ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds; - - scooterSpeed = scooterDrehzhl * 80 / 3300; - - char text[256+60]; - - t7cY0free.WindowLineSpacing = (28 + 48 + 14)/2; - t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 5 * t7cY0free.WindowLineSpacing; - t7cY0free.WindowNumberOfTextLines = 6; - - t7cY0free.WindowY0 -= 7; - - bkpX0 = t7cY0free.WindowX0; - bkpX1 = t7cY0free.WindowX1; - t7cY0free.WindowX0 = 430; - - textSize = snprintf(text,120, - "\022\016\016" - "%%" - "\n\r" - "celsius" - "\n\r" - "rpm" - "\n\r" - "m/min" - "\n\r" - "Ampere" - "\n\r" - "Volt" -// "\n\r" -// "Wh" - ); - GFX_write_string(&FontT42, &t7cY0free, text, 1); - - t7cY0free.WindowX0 = bkpX0; - t7cY0free.WindowX1 = 420; - - textSize = snprintf(text,120, - "\030" - "\002" - "%0u" - "\n\r" - "\002" - "%0.0f" - "\n\r" - "\002" - "%0u" - "\n\r" - "\002" - "%0.0f" - "\n\r" - "\002" - "%0u" - "\n\r" - "\002" - "%0.1f" -// "\n\r" -// "%0u" "\022\016\016 Wh\017\030" - ,scooterResidualCapacity,scooterTemperature,scooterDrehzhl,scooterSpeed - ,scooterCurrent,scooterVoltage);//,scooterWattHours); - - if((ageInMilliSeconds > 1500) || (stateUsed->lifeData.scooterType == 0xFF)) - { - for(int i=0; i < textSize -2; i++) - { - if(text[i] == '\030') - text[i] = '\031'; - } - } - GFX_write_string(&FontT42, &t7cY0free, text, 1); - - t7cY0free.WindowX0 = bkpX0; - t7cY0free.WindowX1 = bkpX1; - - t7cY0free.WindowY0 -= 30; - snprintf(text,60, - "\021\001%u" - ,ageInMilliSeconds); - GFX_write_string(&FontT24, &t7cY0free, text, 0); - -} - -void t7_scooter_alt(void) -{ - float scooterTemperature; - uint16_t scooterDrehzhl; - uint8_t scooterStatus; - uint8_t scooterResidualCapacity; - float scooterSpeed; - uint16_t ageInMilliSeconds; - uint8_t textSize; -// old scooterStatus = bC_getData(0,&scooterTemperature,&scooterDrehzhl,&scooterResidualCapacity); - - scooterStatus = 2;//BC_CONNECTED; - scooterDrehzhl = stateUsed->lifeData.scooterDrehzahl; - scooterTemperature = ((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f; - scooterResidualCapacity = stateUsed_scooterRemainingBattCapacity(); - ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds; - if(!ageInMilliSeconds) - ageInMilliSeconds = 9999; - - scooterSpeed = scooterDrehzhl * 80 / 3300; - - char text[256+60]; - uint8_t textpointer = 0; - - //float percent_N2; - //float percent_He; - //float partial_pressure_N2; - //float partial_pressure_He; - - t7cY0free.WindowLineSpacing = 28 + 48 + 14; - t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; - t7cY0free.WindowNumberOfTextLines = 3; - - text[textpointer++] = '\032'; - text[textpointer++] = TXT_2BYTE; - text[textpointer++] = TXT2BYTE_ScooterRestkapazitaet; - text[textpointer++] = '\n'; - text[textpointer++] = '\r'; - text[textpointer++] = TXT_2BYTE; - text[textpointer++] = TXT2BYTE_ScooterTemperature; - text[textpointer++] = '\n'; - text[textpointer++] = '\r'; - text[textpointer++] = TXT_2BYTE; - text[textpointer++] = TXT2BYTE_ScooterSpeed; - text[textpointer++] = 0; - - GFX_write_string(&FontT24, &t7cY0free, text, 1); - - if(scooterStatus == 2)//BC_CONNECTED) - { - t7cY0free.WindowY0 -= 52; - textSize = snprintf(text,60, - "\030" - "%0u" "\022\016\016 %%\017\030" - "\n\r" - "%0.0f\140" "\022\016\016 celsius\017\030" - "\n\r" - "%0.0f" "\022\016\016 m/min\017\030" - ,scooterResidualCapacity,scooterTemperature,scooterSpeed); - - if(ageInMilliSeconds > 1500) - { - for(int i=0; i < textSize -2; i++) - { - if(text[i] == '\030') - text[i] = '\031'; - } - } -// snprintf(text,60,"\031%0.2f\n\r%0.2f\n\r%u",scooterWatt,scooterTemperature,scooterDrehzhl); - GFX_write_string(&FontT42, &t7cY0free, text, 1); - - t7cY0free.WindowY0 -= 30; - snprintf(text,60, - "\021\001%u" - ,ageInMilliSeconds); - GFX_write_string(&FontT24, &t7cY0free, text, 0); - - } -} /* @@ -3367,6 +3336,7 @@ lastHeading = ActualHeading; */ + uint16_t ActualHeadingRose; uint16_t LeftBorderHeading, LineHeading; uint32_t offsetPicture; point_t start, stop, center; @@ -3378,6 +3348,9 @@ int32_t diffAbs = 0; int32_t diffAbs2 = 0; + SSettings* pSettings; + pSettings = settingsGetPointer(); + newHeading = ActualHeading; diff = newHeading - LastHeading; @@ -3409,6 +3382,7 @@ LastHeading = newHeading; ActualHeading = newHeading; + ActualHeadingRose = ActualHeading; /* if (ActualHeading < 90) ActualHeading += 360; @@ -3425,20 +3399,42 @@ ActualHeading = LastHeading - 1; } */ - if (ActualHeading < 90) - ActualHeading += 360; + if(pSettings->FlipDisplay) + { + ActualHeadingRose = 360 - ActualHeadingRose; + if (ActualHeadingRose < 170) ActualHeadingRose += 360; + } + else + { + if (ActualHeadingRose < 90) ActualHeadingRose += 360; + ActualHeading = ActualHeadingRose; + } // new hw 160822 // if (ActualHeading >= 360 + 90) // ActualHeading = 360; - LeftBorderHeading = 2 * (ActualHeading - (CUSTOMBOX_SPACE_INSIDE/4)); + LeftBorderHeading = 2 * (ActualHeadingRose - (CUSTOMBOX_SPACE_INSIDE/4)); + + if(pSettings->FlipDisplay) /* add offset caused by mirrowed drawing */ + { + LeftBorderHeading += 2 * 80; + } offsetPicture = LeftBorderHeading * t7screenCompass.ImageHeight * 2; +/* the background is used to draw the rotating compass rose */ background.pointer = t7screenCompass.FBStartAdress+offsetPicture; background.x0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; - background.y0 = 65; + if(!pSettings->FlipDisplay) + { + background.y0 = 65; + } + else + { + background.y0 = 480 - t7screenCompass.ImageHeight - 65; + } + background.width = CUSTOMBOX_SPACE_INSIDE; background.height = t7screenCompass.ImageHeight; @@ -3644,10 +3640,21 @@ void t7_miniLiveLogProfile(void) { SWindowGimpStyle wintemp; + SSettings* pSettings; + pSettings = settingsGetPointer(); + wintemp.left = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; wintemp.right = wintemp.left + CUSTOMBOX_SPACE_INSIDE; - wintemp.top = 480 - t7l1.WindowY0; - wintemp.bottom = wintemp. top + 200; + if(!pSettings->FlipDisplay) + { + wintemp.top = 480 - t7l1.WindowY0; + wintemp.bottom = wintemp. top + 200; + } + else + { + wintemp.top = t7l1.WindowY1; + wintemp.bottom = wintemp. top + 200; + } uint16_t max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 10); @@ -3657,8 +3664,19 @@ void t7_logo_OSTC(void) { SWindowGimpStyle windowGimp; + SSettings* pSettings; + pSettings = settingsGetPointer(); + /* OSTC logo */ - windowGimp.left = t7l1.WindowX1 + 32; + if(!pSettings->FlipDisplay) + { + windowGimp.left = t7l1.WindowX1 + 32; + } + else + { + windowGimp.left = t7r1.WindowX1 + 32; + } + windowGimp.top = 40 + 32; GFX_draw_image_monochrome(&t7screen, windowGimp, &ImgOSTC, 0); }