Mercurial > public > ostc4
changeset 110:cc8e24374b83 FlipDisplay
Added option to handled mirrored display to existing functions
author | Ideenmodellierer |
---|---|
date | Tue, 01 Jan 2019 21:02:17 +0100 |
parents | 65a6e352ce08 |
children | 38785aa95837 |
files | Discovery/Src/gfx_engine.c Discovery/Src/show_logbook.c Discovery/Src/t3.c Discovery/Src/t7.c Discovery/Src/tInfoLog.c Discovery/Src/tMenu.c Discovery/Src/tMenuEdit.c Discovery/Src/tMenuEditHardware.c Discovery/Src/tMenuHardware.c |
diffstat | 9 files changed, 1679 insertions(+), 643 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Src/gfx_engine.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/gfx_engine.c Tue Jan 01 21:02:17 2019 +0100 @@ -904,18 +904,31 @@ static inline void gfx_brush(uint8_t thickness, GFX_DrawCfgScreen *hgfx, uint16_t x0, uint16_t y0, uint8_t color) { - uint32_t pDestination; + uint16_t* pDestination; uint8_t offset = thickness/2; - - pDestination = hgfx->FBStartAdress + 2*(x0 - offset)*hgfx->ImageHeight + 2*(y0-offset); + int16_t stepdir; + + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if(pSettings->FlipDisplay) + { + pDestination = hgfx->FBStartAdress + (2*hgfx->ImageHeight * (hgfx->ImageWidth - x0 + offset)) + 2*(480 - y0+offset); + stepdir = -1; + } + else + { + pDestination = hgfx->FBStartAdress + 2*(x0 - offset)*hgfx->ImageHeight + 2*(y0-offset); + stepdir = 1; + } for(int x=thickness;x>0;x--) { for(int y=thickness;y>0;y--) { *(__IO uint16_t*)pDestination = 0xFF00 + color; - pDestination +=2; + pDestination += stepdir; } - pDestination += 2*(hgfx->ImageHeight - thickness); + pDestination += stepdir * (hgfx->ImageHeight - thickness); } } @@ -968,35 +981,63 @@ void GFX_draw_line(GFX_DrawCfgScreen *hgfx, point_t start, point_t stop, uint8_t color) { - uint32_t pDestination; + uint16_t* pDestination; uint32_t j; - + int16_t stepdir; + SSettings* pSettings; + pSettings = settingsGetPointer(); + + + /* horizontal line */ if(start.x == stop.x) { if(start.y > stop.y) gfx_flip(&start,&stop); + pDestination = (uint32_t)hgfx->FBStartAdress; - pDestination += start.x * hgfx->ImageHeight * 2; - pDestination += start.y * 2; + if(pSettings->FlipDisplay) + { + pDestination += (800 - start.x) * hgfx->ImageHeight; + pDestination += (480 - start.y); + stepdir = -1; + } + else + { + pDestination += start.x * hgfx->ImageHeight; + pDestination += start.y; + stepdir = 1; + } for (j = stop.y - start.y; j > 0; j--) { - *(__IO uint16_t*)pDestination = 0xFF00 + color; - pDestination += 2; + *(__IO uint16_t*)pDestination = 0xFF00 + color; + pDestination += stepdir; } } - else + else /* vertical line ? */ if(start.y == stop.y) { if(start.x > stop.x) gfx_flip(&start,&stop); pDestination = (uint32_t)hgfx->FBStartAdress; - pDestination += start.x * hgfx->ImageHeight * 2; - pDestination += start.y * 2; + + if(pSettings->FlipDisplay) + { + pDestination += (800 - start.x) * hgfx->ImageHeight; + pDestination += (480 - start.y); + stepdir = -1; + } + else + { + pDestination += start.x * hgfx->ImageHeight; + pDestination += start.y; + stepdir = 1; + } + for (j = stop.x - start.x; j > 0; j--) { *(__IO uint16_t*)pDestination = 0xFF00 + color; - pDestination += hgfx->ImageHeight * 2; + pDestination += stepdir * hgfx->ImageHeight; } } - else // diagonal + else /* diagonal */ { int x0 = start.x; int y0 = start.y; @@ -1008,8 +1049,17 @@ for(;;) { - pDestination = (uint32_t)hgfx->FBStartAdress; - pDestination += ((x0 * hgfx->ImageHeight) + y0) * 2; + pDestination = (uint16_t*)hgfx->FBStartAdress; + + if(pSettings->FlipDisplay) + { + pDestination += (((800 - x0) * hgfx->ImageHeight) + (480 - y0)); + } + else + { + pDestination += ((x0 * hgfx->ImageHeight) + y0); + } + *(__IO uint16_t*)pDestination = 0xFF00 + color; if (x0==x1 && y0==y1) break; e2 = err; @@ -1022,7 +1072,53 @@ void GFX_draw_image_monochrome(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image, uint8_t color) { - uint32_t pDestination; + uint16_t* pDestination; + uint32_t j; + point_t start, stop; + + SSettings* pSettings; + pSettings = settingsGetPointer(); + + start.x = window.left; + start.y = (hgfx->ImageHeight - image->height - window.top); + stop.y = start.y + image->height; + stop.x = start.x + image->width; + j = 0; + + if(pSettings->FlipDisplay) + { + for(int xx = start.x; xx < stop.x; xx++) + { + pDestination = hgfx->FBStartAdress; + pDestination += (hgfx->ImageHeight - start.y) + (stop.x * hgfx->ImageHeight) ; + pDestination -= (xx - start.x) * hgfx->ImageHeight; + + for(int yy = start.y; yy < stop.y; yy++) + { + *(__IO uint16_t*)pDestination-- = image->data[j++] << 8 + color; + } + } + } + else + { + for(int xx = start.x; xx < stop.x; xx++) + { + pDestination = (uint32_t)hgfx->FBStartAdress; + pDestination += xx * hgfx->ImageHeight; + pDestination += start.y; + for(int yy = start.y; yy < stop.y; yy++) + { + *(__IO uint16_t*)pDestination++ = image->data[j++] << 8 + color; + } + } + } +} + + +void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image) +{ + uint16_t* pDestination; + uint32_t j; point_t start, stop; @@ -1032,47 +1128,37 @@ stop.x = start.x + image->width; j = 0; - for(int xx = start.x; xx < stop.x; xx++) + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if(pSettings->FlipDisplay) { - pDestination = (uint32_t)hgfx->FBStartAdress; - pDestination += xx * hgfx->ImageHeight * 2; - pDestination += start.y * 2; - for(int yy = start.y; yy < stop.y; yy++) + for(int xx = start.x; xx < stop.x; xx++) { - *(__IO uint8_t*)pDestination = color; - pDestination += 1; - *(__IO uint8_t*)pDestination = image->data[j++]; - pDestination += 1; + pDestination = (uint16_t*)hgfx->FBStartAdress; + pDestination += (hgfx->ImageHeight - start.y) + (stop.x * hgfx->ImageHeight); + pDestination -= (xx - start.x) * hgfx->ImageHeight; + + for(int yy = start.y; yy < stop.y; yy++) + { + // *(__IO uint16_t*)pDestination-- = image->data[j++] << 8 | 0xFF; + *(__IO uint16_t*)pDestination-- = 0xFF << 8 | image->data[j++]; + } } - } -} - - -void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image) -{ - uint32_t pDestination; - uint32_t j; - point_t start, stop; - - start.x = window.left; - start.y = (hgfx->ImageHeight - image->height - window.top); - stop.y = start.y + image->height; - stop.x = start.x + image->width; - j = 0; - - for(int xx = start.x; xx < stop.x; xx++) + } + else { - pDestination = (uint32_t)hgfx->FBStartAdress; - pDestination += xx * hgfx->ImageHeight * 2; - pDestination += start.y * 2; - for(int yy = start.y; yy < stop.y; yy++) + for(int xx = start.x; xx < stop.x; xx++) { - *(__IO uint8_t*)pDestination = image->data[j++]; - pDestination += 1; - *(__IO uint8_t*)pDestination = 0xFF; - pDestination += 1; + pDestination = (uint32_t)hgfx->FBStartAdress; + pDestination += xx * hgfx->ImageHeight; + pDestination += start.y; + for(int yy = start.y; yy < stop.y; yy++) + { + *(__IO uint16_t*)pDestination++ = 0xFF << 8 | image->data[j++]; + } } - } + } } @@ -1120,15 +1206,23 @@ /* this is NOT fast nor optimized */ void GFX_draw_pixel(GFX_DrawCfgScreen *hgfx, int16_t x, int16_t y, uint8_t color) { - uint32_t pDestination; - - pDestination = (uint32_t)hgfx->FBStartAdress; - pDestination += x * hgfx->ImageHeight * 2; - pDestination += y * 2; - - *(__IO uint8_t*)pDestination = color; - pDestination += 1; - *(__IO uint8_t*)pDestination = 0xFF; + uint16_t* pDestination; + + SSettings* pSettings; + pSettings = settingsGetPointer(); + + pDestination = (uint16_t*)hgfx->FBStartAdress; + if(pSettings->FlipDisplay) + { + pDestination += (800 - x) * hgfx->ImageHeight; + pDestination += (480 - y); + } + else + { + pDestination += x * hgfx->ImageHeight; + pDestination += y; + } + *(__IO uint16_t*)pDestination = 0xFF << 8 | color; } @@ -1271,7 +1365,8 @@ { p1.x = window.left + (int)(i * deltaline + 0.5f); p2.x = p1.x ; - GFX_draw_colorline(hgfx, p1,p2, color ); + //GFX_draw_colorline(hgfx, p1,p2, color ); + GFX_draw_line(hgfx, p1,p2, color ); } } if(vdeltaline > 0) @@ -1282,7 +1377,8 @@ { p1.x = window.left + (int)(i * vdeltaline + 0.5f); p2.x = p1.x ; - GFX_draw_colorline(hgfx, p1,p2, color ); + // GFX_draw_colorline(hgfx, p1,p2, color ); + GFX_draw_line(hgfx, p1,p2, color ); } } if(hlines > 0) @@ -1294,7 +1390,8 @@ { p1.y = 479 - window.top - (int)(i * deltaline + 0.5f); p2.y = p1.y; - GFX_draw_colorline(hgfx, p1,p2, color ); + // GFX_draw_colorline(hgfx, p1,p2, color ); + GFX_draw_line(hgfx, p1,p2, color ); } } } @@ -1406,10 +1503,14 @@ // =============================================================================== -void GFX_graph_print(GFX_DrawCfgScreen *hgfx, const SWindowGimpStyle *window, int16_t drawVeilUntil, uint8_t Xdivide, uint16_t dataMin, uint16_t dataMax, uint16_t *data, uint16_t datalength, uint8_t color, uint8_t *colour_data) +void GFX_graph_print(GFX_DrawCfgScreen *hgfx, const SWindowGimpStyle *window, const int16_t drawVeilUntil, uint8_t Xdivide, uint16_t dataMin, uint16_t dataMax, uint16_t *data, uint16_t datalength, uint8_t color, uint8_t *colour_data) { - //uint32_t pDestination,pDestination_old, - uint32_t pDestination_tmp,pDestination_end, pDestination_start, pDestination_zero_veil; + uint16_t* pDestination_tmp; + uint16_t* pDestination_start; + uint16_t* pDestination_end; + uint16_t* pDestination_zero_veil; + + SSettings* pSettings; uint32_t max = 0; int windowheight = -1; @@ -1429,6 +1530,9 @@ uint8_t colorDataTemp; uint8_t colormask = 0; + pSettings = settingsGetPointer(); + pDestination_zero_veil = 0; + if(dataMin > dataMax) { uint16_t dataFlip; @@ -1441,7 +1545,8 @@ invert = 0; colormask = color; - + + pSettings = settingsGetPointer(); if(window->bottom > 479) return; @@ -1522,15 +1627,32 @@ if(h_ulong > (window->bottom - window->top)) h_ulong = (window->bottom - window->top); - if(drawVeilUntil > 0) + if(!pSettings->FlipDisplay) { - pDestination_zero_veil = hgfx->FBStartAdress + 2 * ( (479 - (drawVeilUntil - 2) ) + ( (w1 + window->left) * hgfx->ImageHeight) ); + if(drawVeilUntil > 0) + { + pDestination_zero_veil = (uint16_t*)hgfx->FBStartAdress; + pDestination_zero_veil += ((479 - (drawVeilUntil - 2) ) + ((w1 + window->left) * hgfx->ImageHeight) ); + } + else if(drawVeilUntil < 0 ) + { + pDestination_zero_veil = hgfx->FBStartAdress; + pDestination_zero_veil += ((479 + (drawVeilUntil)) + ((w1 + window->left) * hgfx->ImageHeight) ); + } } - else if(drawVeilUntil < 0 ) + else { - pDestination_zero_veil = hgfx->FBStartAdress + 2 * ( (479 + (drawVeilUntil) ) + ( (w1 + window->left) * hgfx->ImageHeight) ); + if(drawVeilUntil > 0) + { + pDestination_zero_veil = hgfx->FBStartAdress; + pDestination_zero_veil += (((drawVeilUntil) ) + ( (window->right - w1) * hgfx->ImageHeight) ); + } + else if(drawVeilUntil < 0 ) + { + pDestination_zero_veil = hgfx->FBStartAdress; + pDestination_zero_veil += 479 - drawVeilUntil + ( (window->right - w1 -1) * hgfx->ImageHeight); + } } - if(h_ulong + window->top > max) { max = h_ulong + window->top; @@ -1543,29 +1665,65 @@ //output_mask[pointer] = true; if(w1 > 0) { - pDestination_start = hgfx->FBStartAdress + (2 * ((479 - (window->top)) + ((w1 + window->left) * hgfx->ImageHeight))); - pDestination_end = pDestination_start; - if(h_ulong >= h_ulong_old) + pDestination_start = hgfx->FBStartAdress; + if(!pSettings->FlipDisplay) { - pDestination_start -= 2 * h_ulong_old; - pDestination_end -= 2 * h_ulong; + pDestination_start += (((479 - (window->top)) + ((w1 + window->left) * hgfx->ImageHeight))); } else { - pDestination_start -= 2 * h_ulong; - pDestination_end -= 2 * h_ulong_old; + pDestination_start += (((window->top) + ((window->right - w1) * hgfx->ImageHeight))); } + pDestination_end = pDestination_start; + + if(!pSettings->FlipDisplay) + { + if(h_ulong >= h_ulong_old) + { + pDestination_start -= h_ulong_old; + pDestination_end -= h_ulong; + } + else + { + pDestination_start -= h_ulong; + pDestination_end -= h_ulong_old; + } + } + else + { + if(h_ulong < h_ulong_old) + { + pDestination_start += h_ulong_old; + pDestination_end += h_ulong; + } + else + { + pDestination_start += h_ulong; + pDestination_end += h_ulong_old; + } + } + // deco stops if(drawVeilUntil < 0) { - pDestination_tmp = pDestination_end; - while(pDestination_tmp <= pDestination_zero_veil) + if(!pSettings->FlipDisplay) { - *(__IO uint8_t*)pDestination_tmp = colormask; - pDestination_tmp -= 1; - *(__IO uint8_t*)pDestination_tmp = 0x80; - pDestination_tmp += 3; + pDestination_tmp = pDestination_end; + while(pDestination_tmp <= pDestination_zero_veil) + { + *(__IO uint16_t*)pDestination_tmp = (0x80 << 8) | colormask; + pDestination_tmp++; + } + } + else + { + pDestination_tmp = pDestination_zero_veil; + while(pDestination_tmp <= pDestination_end) + { + *(__IO uint16_t*)pDestination_tmp = (0x80 << 8) | colormask; + pDestination_tmp++; + } } } else @@ -1573,20 +1731,31 @@ // regular graph with veil underneath if requested // von oben nach unten // von grossen pDestination Werten zu kleinen pDestination Werten - pDestination_tmp = pDestination_start; - while(pDestination_tmp >= pDestination_end) + { + pDestination_tmp = pDestination_start; + while(pDestination_tmp >= pDestination_end) + { + *(__IO uint16_t*)pDestination_tmp = (0xFF << 8) | colormask ; + pDestination_tmp--; + } + } + + if(!pSettings->FlipDisplay) { - *(__IO uint8_t*)pDestination_tmp = colormask; - pDestination_tmp += 1; - *(__IO uint8_t*)pDestination_tmp = 0xFF; - pDestination_tmp -= 3; + while((drawVeilUntil > 0) && (pDestination_tmp >= pDestination_zero_veil)) + { + *(__IO uint16_t*)pDestination_tmp = (0x20 << 8) | colormask ; + pDestination_tmp--; + } } - while((drawVeilUntil > 0) && (pDestination_tmp >= pDestination_zero_veil)) + else { - *(__IO uint8_t*)pDestination_tmp = colormask; - pDestination_tmp += 1; - *(__IO uint8_t*)pDestination_tmp = 0x20; - pDestination_tmp -= 3; + pDestination_tmp = pDestination_start; + while((drawVeilUntil > 0) && (pDestination_tmp <= pDestination_zero_veil)) + { + *(__IO uint16_t*)pDestination_tmp = (0x20 << 8) | colormask ; + pDestination_tmp++; + } } } } @@ -1671,11 +1840,13 @@ void GFX_draw_box(GFX_DrawCfgScreen *hgfx, point_t LeftLow, point_t WidthHeight, uint8_t Style, uint8_t color) { - uint32_t pDestination, pStart; + uint16_t* pDestination; + uint16_t* pStart; uint32_t j; uint32_t lineWidth, lineHeight; int x, y; uint8_t intensity; + int stepdir; typedef struct { int x; @@ -1701,66 +1872,86 @@ {4,3,110} }; + SSettings* pSettings; + pSettings = settingsGetPointer(); + lineWidth = WidthHeight.x; lineHeight = WidthHeight.y; - pStart = (uint32_t)hgfx->FBStartAdress; - pStart += LeftLow.x * hgfx->ImageHeight * 2; - pStart += LeftLow.y * 2; + + if(!pSettings->FlipDisplay) + { + pStart += LeftLow.x * hgfx->ImageHeight; + pStart += LeftLow.y; + stepdir = 1; + } + else + { + pStart += (800 - LeftLow.x - 1) * hgfx->ImageHeight; + pStart += (480 - LeftLow.y); + stepdir = -1; + } + pStart = pStart; // Untere Linie pDestination = pStart; if(Style) { - pDestination += 2 * 10 * hgfx->ImageHeight; + pDestination += stepdir * 10 * hgfx->ImageHeight; lineWidth -= 18; } for (j = lineWidth; j > 0; j--) { + *(__IO uint16_t*)pDestination = 0xFF00 + color; - pDestination += hgfx->ImageHeight * 2; + pDestination += stepdir * hgfx->ImageHeight; } // Obere Linie - pDestination = pStart + 2 * WidthHeight.y; + + pDestination = pStart + stepdir * WidthHeight.y; if(Style) { - pDestination += 2 * 10 * hgfx->ImageHeight; + pDestination += stepdir * 10 * hgfx->ImageHeight; } for (j = lineWidth; j > 0; j--) { *(__IO uint16_t*)pDestination = 0xFF00 + color; - pDestination += hgfx->ImageHeight * 2; + pDestination += stepdir * hgfx->ImageHeight; } // Linke Linie pDestination = pStart; + if(Style) { - pDestination += 2 * 10; + pDestination += stepdir * 10; lineHeight -= 18; } for (j = lineHeight; j > 0; j--) { *(__IO uint16_t*)pDestination = 0xFF00 + color; - pDestination += 2; + pDestination += stepdir; } + // Rechte Linie - pDestination = pStart + 2 * WidthHeight.x * hgfx->ImageHeight; + + pDestination = pStart + stepdir * WidthHeight.x * hgfx->ImageHeight; if(Style) { - pDestination += 2 * 10; + pDestination += stepdir * 10; } for (j = lineHeight; j > 0; j--) { *(__IO uint16_t*)pDestination = 0xFF00 + color; - pDestination += 2; + pDestination += stepdir; } + // Ecken wenn notwendig == Style if(Style) { @@ -1769,60 +1960,61 @@ x = corner[0].x; y = corner[0].y; intensity = corner[0].intensity; - *(__IO uint16_t*)(pDestination + 2 * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; + + *(__IO uint16_t*)(pDestination + stepdir * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; for(j = 15; j > 0; j--) { x = corner[j].x; y = corner[j].y; intensity = corner[j].intensity; - *(__IO uint16_t*)(pDestination + 2 * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; - *(__IO uint16_t*)(pDestination + 2 * (x + (y * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * (x + (y * hgfx->ImageHeight))) = (intensity << 8) + color; } // links oben - pDestination = pStart + 2 * WidthHeight.y; + pDestination = pStart + stepdir * WidthHeight.y; x = corner[0].x; y = corner[0].y; intensity = corner[0].intensity; - *(__IO uint16_t*)(pDestination + 2 * (-y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * (-y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; for(j = 15; j > 0; j--) { x = corner[j].x; y = corner[j].y; intensity = corner[j].intensity; - *(__IO uint16_t*)(pDestination + 2 * (-y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; - *(__IO uint16_t*)(pDestination + 2 * (-x + (y * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * (-y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * (-x + (y * hgfx->ImageHeight))) = (intensity << 8) + color; } // rechts unten - pDestination = pStart + 2 * WidthHeight.x * hgfx->ImageHeight; + pDestination = pStart + stepdir * WidthHeight.x * hgfx->ImageHeight; x = corner[0].x; y = corner[0].y; intensity = corner[0].intensity; - *(__IO uint16_t*)(pDestination + 2 * (y - (x * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * (y - (x * hgfx->ImageHeight))) = (intensity << 8) + color; for(j = 15; j > 0; j--) { x = corner[j].x; y = corner[j].y; intensity = corner[j].intensity; - *(__IO uint16_t*)(pDestination + 2 * (y - (x * hgfx->ImageHeight))) = (intensity << 8) + color; - *(__IO uint16_t*)(pDestination + 2 * (x - (y * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * (y - (x * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * (x - (y * hgfx->ImageHeight))) = (intensity << 8) + color; } // rechts oben - pDestination = pStart + 2 * WidthHeight.y + 2 * WidthHeight.x * hgfx->ImageHeight; + pDestination = pStart + stepdir * WidthHeight.y + stepdir * WidthHeight.x * hgfx->ImageHeight; x = corner[0].x; y = corner[0].y; intensity = corner[0].intensity; - *(__IO uint16_t*)(pDestination - 2 * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * -1 * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; for(j = 15; j > 0; j--) { x = corner[j].x; y = corner[j].y; intensity = corner[j].intensity; - *(__IO uint16_t*)(pDestination - 2 * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; - *(__IO uint16_t*)(pDestination - 2 * (x + (y * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * -1 * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color; + *(__IO uint16_t*)(pDestination + stepdir * -1 * (x + (y * hgfx->ImageHeight))) = (intensity << 8) + color; } } } @@ -1871,6 +2063,11 @@ GFX_DrawCfgWindow hgfx; + + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if(XrightGimpStyle > 799) XrightGimpStyle = 799; if(XleftGimpStyle >= XrightGimpStyle) @@ -1881,14 +2078,27 @@ hgfx.WindowNumberOfTextLines = 1; hgfx.WindowLineSpacing = 0; hgfx.WindowTab = 0; - hgfx.WindowX0 = XleftGimpStyle; - hgfx.WindowX1 = XrightGimpStyle; - hgfx.WindowY1 = 479 - YtopGimpStyle; - if(hgfx.WindowY1 < Font->height) - hgfx.WindowY0 = 0; + + if(!pSettings->FlipDisplay) + { + hgfx.WindowX0 = XleftGimpStyle; + hgfx.WindowX1 = XrightGimpStyle; + hgfx.WindowY1 = 479 - YtopGimpStyle; + if(hgfx.WindowY1 < Font->height) + hgfx.WindowY0 = 0; + else + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } else - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + { + hgfx.WindowX0 = 800 - XrightGimpStyle; + hgfx.WindowX1 = 800 - XleftGimpStyle; + hgfx.WindowY0 = YtopGimpStyle; + if(hgfx.WindowY0 + Font->height > 480) + hgfx.WindowY1 = 480; + else + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_write_label(Font, &hgfx, text, color); } @@ -2374,7 +2584,7 @@ uint32_t i, j; uint32_t width, height; uint32_t found; - uint32_t pDestination; + uint16_t* pDestination; uint32_t pDestinationColor; uint32_t pSource; uint32_t OffsetDestination; @@ -2385,7 +2595,20 @@ uint8_t fill; uint32_t widthFont, heightFont; uint32_t nextLine; - + int32_t stepdir; + + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if(pSettings->FlipDisplay) + { + stepdir = -1; /* decrement address while putting pixels */ + } + else + { + stepdir = 1; + } + if(hgfx->Image->ImageWidth <= (hgfx->WindowX0 + cfg->Xdelta)) return 0x0000FFFF; @@ -2411,16 +2634,25 @@ height = heightFont*2; width = widthFont*2; - - OffsetDestination = 2 * (hgfx->Image->ImageHeight - height); - - pDestination += (hgfx->WindowX0 + cfg->Xdelta) * hgfx->Image->ImageHeight * 2; - pDestination += (hgfx->WindowY0 + cfg->Ydelta) * 2; - nextLine = hgfx->Image->ImageHeight * 2; + + + if(pSettings->FlipDisplay) + { + pDestination += (uint32_t)(hgfx->WindowX1 - cfg->Xdelta) * hgfx->Image->ImageHeight; /* set pointer to delta row */ + pDestination += (hgfx->WindowY1 - cfg->Ydelta); /* set pointer to delta colum */ + } + else + { + pDestination += (uint32_t)(hgfx->WindowX0 + cfg->Xdelta) * hgfx->Image->ImageHeight; /* set pointer to delta row */ + pDestination += (hgfx->WindowY0 + cfg->Ydelta); /* set pointer to delta colum */ + } + OffsetDestination = (hgfx->Image->ImageHeight - height); + nextLine = hgfx->Image->ImageHeight; // ----------------------------- char_truncated_WidthFlag = 0; width_left = hgfx->Image->ImageWidth - (hgfx->WindowX0 + cfg->Xdelta); + if(width_left < width) { char_truncated_WidthFlag = 1; @@ -2428,6 +2660,7 @@ widthFont = width/2; } // ----------------------------- + char_truncated_Height = 0; height_left = hgfx->Image->ImageHeight - (hgfx->WindowY0 + cfg->Ydelta); if(height_left < height) @@ -2441,26 +2674,12 @@ height = height_left; heightFont = height/2; } - OffsetDestination += 2 * char_truncated_Height; + + OffsetDestination += char_truncated_Height; // ----------------------------- if(height == 0) return 0x0000FFFF; // ----------------------------- - - if((cfg->color > 0) ) - { - pDestinationColor = pDestination - 1; - - for(i = width; i > 0; i--) - { - for (j = height; j > 0; j--) - { - *(__IO uint32_t*)pDestinationColor = cfg->color; - pDestinationColor += 2; - } - pDestinationColor += OffsetDestination; - } - } if(cfg->singleSpaceWithSizeOfNextChar) { @@ -2476,12 +2695,12 @@ { for (j = height; j > 0; j--) { - *(__IO uint8_t*)pDestination = fill; - pDestination += 2; - *(__IO uint8_t*)pDestination = fill; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | fill; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | fill; + pDestination += stepdir; } - pDestination += OffsetDestination; + pDestination += stepdir * OffsetDestination; } } else @@ -2496,37 +2715,37 @@ { for (j = heightFont; j > 0; j--) { - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; pSource++; - pDestination += 2; - - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; + + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; pSource++; - pDestination += 2; - - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; + + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; pSource++; - pDestination += 2; - - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; + + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; pSource++; - pDestination += 2; } pSource += char_truncated_Height; } @@ -2535,33 +2754,33 @@ pSource++; for (j = height; j > 0; j--) { - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 |0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 |0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; } } - pDestination += OffsetDestination + nextLine; + pDestination += (OffsetDestination + nextLine) * stepdir; } } else @@ -2573,21 +2792,21 @@ { for (j = heightFont; j > 0; j--) { - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; pSource++; - pDestination += 2; - - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF - *(uint8_t*)pSource; + + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); + pDestination += stepdir; pSource++; - pDestination += 2; } pSource += char_truncated_Height; } @@ -2596,24 +2815,24 @@ pSource++; for (j = heightFont; j > 0; j--) { - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - *(__IO uint8_t*)(pDestination + nextLine) = 0xFF; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; + pDestination += stepdir; } } - pDestination += OffsetDestination + nextLine; + pDestination += (OffsetDestination + nextLine) * stepdir; } } - } + } /* inverted */ else { if((heightFont & 3) == 0) /* unroll for perfomance, by 4 if possible, by 2 (16bit) otherwise */ @@ -2625,46 +2844,46 @@ { for (j = heightFont; j > 0; j--) { - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; pSource++; - pDestination += 2; - - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; + + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; pSource++; - pDestination += 2; - - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; + + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; pSource++; - pDestination += 2; - - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; + + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; pSource++; - pDestination += 2; } pSource += char_truncated_Height; } else { pSource++; - pDestination += 2 * height; + pDestination += stepdir * height; } - pDestination += OffsetDestination + nextLine; + pDestination += stepdir * (OffsetDestination + nextLine); } } else @@ -2676,30 +2895,30 @@ { for (j = heightFont; j > 0; j--) { - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; pSource++; - pDestination += 2; - - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - *(__IO uint8_t*)(pDestination + nextLine) = *(uint8_t*)pSource; + + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; + *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; + pDestination += stepdir; pSource++; - pDestination += 2; } pSource += char_truncated_Height; } else { pSource++; - pDestination += 2 * height; + pDestination += stepdir * height; } - pDestination += OffsetDestination + nextLine; + pDestination += stepdir * (OffsetDestination + nextLine); } } } @@ -2747,7 +2966,7 @@ uint32_t i, j; uint32_t width, height; uint32_t found; - uint32_t pDestination; + uint16_t* pDestination; uint32_t pDestinationColor; uint32_t pSource; uint32_t OffsetDestination; @@ -2756,6 +2975,19 @@ uint32_t char_truncated_WidthFlag; uint32_t char_truncated_Height; uint8_t fill; + int16_t stepdir; + + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if(pSettings->FlipDisplay) + { + stepdir = -1; /* decrement address while putting pixels */ + } + else + { + stepdir = 1; + } if(hgfx->Image->ImageWidth <= (hgfx->WindowX0 + cfg->Xdelta)) return 0x0000FFFF; @@ -2784,16 +3016,28 @@ pSource = ((uint32_t)Font->chars[i].image->data); - pDestination = 1 + (uint32_t)hgfx->Image->FBStartAdress; + pDestination = (uint32_t)hgfx->Image->FBStartAdress + 1; height = Font->chars[i].image->height; width = Font->chars[i].image->width; - OffsetDestination = 2 * (hgfx->Image->ImageHeight - height); - - pDestination += (hgfx->WindowX0 + cfg->Xdelta) * hgfx->Image->ImageHeight * 2; - pDestination += (hgfx->WindowY0 + cfg->Ydelta) * 2; - + OffsetDestination = hgfx->Image->ImageHeight - height; + + + /* Xyyyyy y= height */ + /* Xyyyyy x= width */ + /* Xyyyyy */ + + if(pSettings->FlipDisplay) + { + pDestination += (hgfx->WindowX1 - cfg->Xdelta) * hgfx->Image->ImageHeight; /* set pointer to delta row */ + pDestination += (hgfx->WindowY1 - cfg->Ydelta); /* set pointer to delta colum */ + } + else + { + pDestination += (hgfx->WindowX0 + cfg->Xdelta) * hgfx->Image->ImageHeight; /* set pointer to delta row */ + pDestination += (hgfx->WindowY0 + cfg->Ydelta); /* set pointer to delta colum */ + } // ----------------------------- @@ -2817,27 +3061,12 @@ } height = height_left; } - OffsetDestination += 2 * char_truncated_Height; + OffsetDestination += char_truncated_Height; // ----------------------------- if(height == 0) return 0x0000FFFF; // ----------------------------- - if((cfg->color > 0) )//&& (cfg->color < 6)) - { - pDestinationColor = pDestination - 1; - - for(i = width; i > 0; i--) - { - for (j = height; j > 0; j--) - { - *(__IO uint32_t*)pDestinationColor = cfg->color;//ColorLUT[cfg->color - 1]; - pDestinationColor += 2; - } - pDestinationColor += OffsetDestination; - } - } - if(cfg->singleSpaceWithSizeOfNextChar) { cfg->singleSpaceWithSizeOfNextChar = 0; @@ -2852,12 +3081,12 @@ { for (j = height; j > 0; j--) { - *(__IO uint8_t*)pDestination = fill; - pDestination += 2; - *(__IO uint8_t*)pDestination = fill; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | fill; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | fill; + pDestination += stepdir; } - pDestination += OffsetDestination; + pDestination += stepdir * OffsetDestination; } } else @@ -2870,39 +3099,36 @@ { if(*(uint8_t*)pSource != 0x01) { + for (j = height; j > 0; j--) { - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - pSource++; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - pSource++; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - pSource++; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - pSource++; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); + pDestination += stepdir; } pSource += char_truncated_Height; } - else + else /* empty line => fast fill */ { pSource++; for (j = height; j > 0; j--) { - *(__IO uint8_t*)pDestination = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + pDestination += stepdir; } } - pDestination += OffsetDestination; + pDestination += stepdir * OffsetDestination; } } else @@ -2914,12 +3140,10 @@ { for (j = height; j > 0; j--) { - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - pSource++; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF - *(uint8_t*)pSource; - pSource++; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); + pDestination += stepdir; } pSource += char_truncated_Height; } @@ -2928,50 +3152,49 @@ pSource++; for (j = height; j > 0; j--) { - *(__IO uint8_t*)pDestination = 0xFF; - pDestination += 2; - *(__IO uint8_t*)pDestination = 0xFF; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; + pDestination += stepdir; } } - pDestination += OffsetDestination; + pDestination += stepdir * OffsetDestination; } } } - else + else /* not inverted */ { if((height & 3) == 0) /* unroll for perfomance, by 4 if possible, by 2 (16bit) otherwise */ { + height /= 4; + for(i = width; i > 0; i--) { if(*(uint8_t*)pSource != 0x01) { for (j = height; j > 0; j--) { - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - pSource++; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - pSource++; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - pSource++; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - pSource++; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; + pDestination += stepdir; } pSource += char_truncated_Height; } else { pSource++; - pDestination += 2 * height * 4; + pDestination += stepdir * height * 4; } - pDestination += OffsetDestination; + pDestination += stepdir * OffsetDestination; } } + else { height /= 2; @@ -2981,21 +3204,19 @@ { for (j = height; j > 0; j--) { - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - pSource++; - pDestination += 2; - *(__IO uint8_t*)pDestination = *(uint8_t*)pSource; - pSource++; - pDestination += 2; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; + pDestination += stepdir; + *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; + pDestination += stepdir; } pSource += char_truncated_Height; } else { pSource++; - pDestination += 2 * height * 2; + pDestination += stepdir * height * 2; } - pDestination += OffsetDestination; + pDestination += stepdir * OffsetDestination; } } } @@ -3831,24 +4052,43 @@ { GFX_DrawCfgWindow hgfx; - if(XrightGimpStyle > 799) - XrightGimpStyle = 799; - if(XleftGimpStyle >= XrightGimpStyle) - XleftGimpStyle = 0; - if(YtopGimpStyle > 479) - YtopGimpStyle = 479; + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if(!pSettings->FlipDisplay) + { + if(XrightGimpStyle > 799) + XrightGimpStyle = 799; + if(XleftGimpStyle >= XrightGimpStyle) + XleftGimpStyle = 0; + if(YtopGimpStyle > 479) + YtopGimpStyle = 479; + } hgfx.Image = tMscreen; hgfx.WindowNumberOfTextLines = 1; hgfx.WindowLineSpacing = 0; hgfx.WindowTab = 0; - hgfx.WindowX0 = XleftGimpStyle; - hgfx.WindowX1 = XrightGimpStyle; - hgfx.WindowY1 = 479 - YtopGimpStyle; - if(hgfx.WindowY1 < Font->height) - hgfx.WindowY0 = 0; + + if(!pSettings->FlipDisplay) + { + hgfx.WindowX0 = XleftGimpStyle; + hgfx.WindowX1 = XrightGimpStyle; + hgfx.WindowY1 = 479 - YtopGimpStyle; + if(hgfx.WindowY1 < Font->height) + hgfx.WindowY0 = 0; + else + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } else - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + { + hgfx.WindowX0 = 800 - XrightGimpStyle; + hgfx.WindowX1 = 800 - XleftGimpStyle; + hgfx.WindowY0 = YtopGimpStyle; + if(hgfx.WindowY0 + Font->height >= 479) + hgfx.WindowY1 = 479; + else + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_write_string_color(Font, &hgfx, text, 0, color); } @@ -3861,14 +4101,25 @@ hgfx.Image = tMscreen; hgfx.WindowNumberOfTextLines = 1; hgfx.WindowLineSpacing = 0; + + SSettings* pSettings; + pSettings = settingsGetPointer(); + hgfx.WindowTab = 0; hgfx.WindowX0 = 20; hgfx.WindowX1 = 779; - hgfx.WindowY1 = 479; - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + + if(!pSettings->FlipDisplay) + { + hgfx.WindowY1 = 479; + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } + else + { + hgfx.WindowY0 = 0; + hgfx.WindowY1 = Font->height; + } GFX_write_label(Font, &hgfx, text, color); - } @@ -3878,16 +4129,29 @@ const tFont *Font = &FontT48; char text[7]; uint8_t i, secondDigitPage, secondDigitTotal; - + + SSettings* pSettings; + pSettings = settingsGetPointer(); + hgfx.Image = tMscreen; hgfx.WindowNumberOfTextLines = 1; hgfx.WindowLineSpacing = 0; hgfx.WindowTab = 0; - hgfx.WindowX1 = 779; - hgfx.WindowX0 = hgfx.WindowX1 - (25*5); - hgfx.WindowY1 = 479; - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + + if(!pSettings->FlipDisplay) + { + hgfx.WindowX1 = 779; + hgfx.WindowX0 = hgfx.WindowX1 - (25*5); + hgfx.WindowY1 = 479; + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } + else + { + hgfx.WindowX1 = 25*5; + hgfx.WindowX0 = 0; + hgfx.WindowY1 = Font->height;; + hgfx.WindowY0 = 0; + } if(page > 99) page = 99; if(total > 99)
--- a/Discovery/Src/show_logbook.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/show_logbook.c Tue Jan 01 21:02:17 2019 +0100 @@ -149,18 +149,19 @@ winsmal.right = wintemp.left -1; winsmal.bottom = winsmal.top + 16; - write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor1,"[m]"); - winsmal.left = wintemp.left - 48; + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"[m]"); + + // winsmal.left = wintemp.left - 48; char msg[3]; float deltaline = ((float)(wintemp.bottom - wintemp.top))/5; for(int i = 1; i<=5; i++) { - winsmal.top = wintemp.top + deltaline * i - 14; winsmal.bottom = winsmal.top + 16; - winsmal.right = wintemp.left - 2; + + // winsmal.right = wintemp.left - 2; snprintf(msg,5,"%i",i * vstep); - write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor1,msg); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg); } //vertical (Time) ******************************************************************* @@ -188,18 +189,17 @@ winsmal.right = winsmal.left + 60; winsmal.bottom = winsmal.top + 16; - + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"min"); for(int i = 1; i<=lines; i++) { winsmal.left= wintemp.left + vdeltaline * i - 15; winsmal.right = winsmal.left + 30; snprintf(msg,5,"%3i",i * timestep); - write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor1,msg); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg); } winsmal.left = wintemp.left;// - 9; winsmal.top = wintemp.top - 40; winsmal.right = winsmal.left + 60; - write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor1,"min");; //--- print depth graph --- //adapt window @@ -238,21 +238,35 @@ GFX_graph_print(hgfx,&wintemp,saveTop,1,0,datamax, decostopdata,dataLength, CLUT_NiceGreen, NULL); } + if(settingsGetPointer()->FlipDisplay) + { + winsmal.right = 800 - wintemp.left; + winsmal.left = 800 - wintemp.right; + winsmal.bottom = wintemp.bottom; + winsmal.top = wintemp.top; + } + else + { + winsmal.right = wintemp.right; + winsmal.left = wintemp.left; + winsmal.bottom = wintemp.bottom; + winsmal.top = wintemp.top; + } + switch(mode) { case 0: - GFX_graph_print(hgfx,&wintemp,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); + GFX_graph_print(hgfx,&winsmal,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); break; case 1: - GFX_graph_print(hgfx,&wintemp,saveBottom,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); + GFX_graph_print(hgfx,&winsmal,saveBottom,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); break; case 2: if(*colordata) - GFX_graph_print(hgfx,&wintemp,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); + GFX_graph_print(hgfx,&winsmal,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); else - GFX_graph_print(hgfx,&wintemp,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); + GFX_graph_print(hgfx,&winsmal,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); } - } @@ -452,7 +466,9 @@ uint8_t day = logbookHeader.dateDay; char text[40]; snprintf(text, 20, "20%02i-%02i-%02i", year, month, day); - Gfx_write_label_var(hgfx, 30, 150,10, &FontT42,CLUT_GasSensor1,text); + + Gfx_write_label_var(hgfx, 30, 250,10, &FontT42,CLUT_GasSensor1,text); + // Print logbook number with offset if(settingsGetPointer()->logbookOffset) @@ -535,7 +551,7 @@ winsmal.left = 30; winsmal.top = top -3; winsmal.bottom = winsmal.top + FontT42.height; - winsmal.right = winsmal.left + 50; + if(maxdepth < 10) { winsmal.left = 137; @@ -548,7 +564,9 @@ { winsmal.left = 147; } - write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor4,"max"); + winsmal.right = winsmal.left + 50; + + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,top, &FontT24,CLUT_GasSensor4,"max"); snprintf(text,3,"%c%c" , unit_depth_char1() , unit_depth_char2() @@ -570,10 +588,12 @@ snprintf(text,20,"%i.%i",avrdepth,avrdepth_dcm); } Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); + winsmal.left = 30; winsmal.top = top -3; winsmal.bottom = winsmal.top + FontT42.height; - winsmal.right = winsmal.left + 50; + +/* put avg behind previous string */ if(avrdepth < 10) { winsmal.left = 137 ; @@ -586,7 +606,9 @@ { winsmal.left = 147; } - write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor4,"avg"); + winsmal.right = winsmal.left + 50; + + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor4,"avg"); snprintf(text,3,"%c%c" , unit_depth_char1() , unit_depth_char2() @@ -634,6 +656,7 @@ wintemp.left = 330; wintemp.top = 160; wintemp.bottom -= 40; + show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 1, dataLength, depthdata, gasdata, NULL); } @@ -682,8 +705,7 @@ winsmal.right = wintemp.right + 30; winsmal.bottom = winsmal.top + 16; - write_label_(hgfx, winsmal,&FontT24,CLUT_LogbookTemperature,"[C]"); - + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,"[C]"); int16_t minVal = 0; int16_t maxVal = 0; @@ -715,7 +737,7 @@ snprintf(msg,2,"%1i",tmp); else snprintf(msg,3,"%2i",tmp); - write_label_(hgfx, winsmal,&FontT24,CLUT_LogbookTemperature,msg); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,msg); } @@ -1017,7 +1039,7 @@ print_gas_name(gas_name,15,logbookHeader.gasordil[i].oxygen_percentage,logbookHeader.gasordil[i].helium_percentage); snprintf(msg,15,"G%i: %s",i + 1, gas_name); //msg[10] = 0; - write_label_(hgfx, winsmal,&FontT24,color,msg); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg); } } @@ -1089,7 +1111,7 @@ winsmal.right = winsmal.left + 55; color = CLUT_GasSensor1;//LOGBOOK_GRAPH_DEPTH; - write_label_(hgfx, winsmal,&FontT24,color,"depth"); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"depth"); } winsmal.left = 799 - 67;//wintemp.right -67; @@ -1097,12 +1119,12 @@ color = CLUT_LogbookTemperature;//LOGBOOK_GRAPH_DEPTH; if(logbookHeader.diveMode != DIVEMODE_CCR) - write_label_(hgfx, winsmal,&FontT24,color,"\002PP O2"); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002PP O2"); else if(logbookHeader.CCRmode != CCRMODE_Sensors) - write_label_(hgfx, winsmal,&FontT24,color,"\002SETPOINT"); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SETPOINT"); else - write_label_(hgfx, winsmal,&FontT24,color,"\002SENSORS"); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SENSORS"); //*** PP O2 **************************************************** //calc lines and labels @@ -1142,7 +1164,7 @@ //winsmal.font = ft_tiny + ft_SLIM; color = CLUT_LogbookTemperature;// = LOGBOOK_GRAPH_TEMP; - write_label_(hgfx, winsmal,&FontT24,color,"bar"); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"bar"); int deltaline = (wintemp.bottom - wintemp.top)/5; char msg[4]; @@ -1155,7 +1177,7 @@ winsmal.top = wintemp.top + deltaline * i - 8; winsmal.bottom = winsmal.top + 16; snprintf(msg,4,"%1.1f",oxy); - write_label_(hgfx, winsmal,&FontT24,color,msg); + Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg); //oled_write(OVERLAY, &winsmal,msg,false,true); }
--- a/Discovery/Src/t3.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/t3.c Tue Jan 01 21:02:17 2019 +0100 @@ -103,6 +103,9 @@ void t3_init(void) { + SSettings* pSettings; + pSettings = settingsGetPointer(); + if(getLicence() == LICENCEBONEX) { t3_customviews = t3_customviewsScooter; @@ -119,17 +122,37 @@ t3l1.WindowNumberOfTextLines = 2; t3l1.WindowLineSpacing = 19; // Abstand von Y0 t3l1.WindowTab = 100; - t3l1.WindowX0 = 0; - t3l1.WindowX1 = BigFontSeperationLeftRight - 5; - t3l1.WindowY0 = BigFontSeperationTopBottom + 5; - t3l1.WindowY1 = 479; + + if(!pSettings->FlipDisplay) + { + t3l1.WindowX0 = 0; + t3l1.WindowX1 = BigFontSeperationLeftRight - 5; + t3l1.WindowY0 = BigFontSeperationTopBottom + 5; + t3l1.WindowY1 = 479; + } + else + { + t3l1.WindowX0 = 800 - BigFontSeperationLeftRight + 5; + t3l1.WindowX1 = 799; + t3l1.WindowY0 = 0; + t3l1.WindowY1 = 479 - BigFontSeperationTopBottom + 5 ; + } t3r1.Image = &t3screen; t3r1.WindowNumberOfTextLines = t3l1.WindowNumberOfTextLines; t3r1.WindowLineSpacing = t3l1.WindowLineSpacing; t3r1.WindowTab = t3l1.WindowTab; - t3r1.WindowX0 = BigFontSeperationLeftRight + 5; - t3r1.WindowX1 = 799; + if(!pSettings->FlipDisplay) + { + t3r1.WindowX0 = BigFontSeperationLeftRight + 5; + t3r1.WindowX1 = 799; + } + else + { + t3r1.WindowX0 = 0; + t3r1.WindowX1 = BigFontSeperationLeftRight - 5; + } + t3r1.WindowY0 = t3l1.WindowY0; t3r1.WindowY1 = t3l1.WindowY1; @@ -138,16 +161,24 @@ t3c1.WindowLineSpacing = t3l1.WindowLineSpacing; t3c1.WindowX0 = 0; t3c1.WindowX1 = 799; - t3c1.WindowY0 = 0; - t3c1.WindowY1 = BigFontSeperationTopBottom - 5; + if(!pSettings->FlipDisplay) + { + t3c1.WindowY0 = 0; + t3c1.WindowY1 = BigFontSeperationTopBottom - 5; + } + else + { + t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5; + t3c1.WindowY1 = 479; + } t3c2.Image = &t3screen; t3c2.WindowNumberOfTextLines = 3; t3c2.WindowLineSpacing = 58; t3c2.WindowX0 = 370; t3c2.WindowX1 = 799; - t3c2.WindowY0 = 0; - t3c2.WindowY1 = BigFontSeperationTopBottom - 5; + t3c2.WindowY0 = t3c1.WindowY0; + t3c2.WindowY1 = t3c1.WindowY1; t3c2.WindowTab = 600; } @@ -183,6 +214,9 @@ uint8_t depthChangeAscent; point_t start, stop, startZeroLine; + SSettings* pSettings; + pSettings = settingsGetPointer(); + start.x = 0; stop.x = 799; stop.y = start.y = BigFontSeperationTopBottom; @@ -190,6 +224,7 @@ start.y = BigFontSeperationTopBottom; stop.y = 479; + stop.x = start.x = BigFontSeperationLeftRight; GFX_draw_line(tXscreen, start, stop, CLUT_Font020); @@ -322,19 +357,50 @@ /* ascentrate graph -standard mode */ if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) { - start.y = tXl1->WindowY0 - 1; + if(!pSettings->FlipDisplay) + { + start.y = tXl1->WindowY0 - 1; + } + else + { + start.y = tXl1->WindowY1 + 1; + } + for(int i = 0; i<4;i++) { start.y += 5*8; stop.y = start.y; - start.x = tXl1->WindowX1 - 1; + if(!pSettings->FlipDisplay) + { + start.x = tXl1->WindowX1 - 1; + } + else + { + start.x = tXr1->WindowX1 - 1; + } stop.x = start.x - 17; GFX_draw_line(tXscreen, start, stop, 0); } // new thick bar design Sept. 2015 - start.x = tXl1->WindowX1 - 3 - 5; + if(!pSettings->FlipDisplay) + { + start.x = tXl1->WindowX1 - 3 - 5; + } + else + { + start.x = tXr1->WindowX1 - 3 - 5; + } + stop.x = start.x; - start.y = tXl1->WindowY0 - 1; + if(!pSettings->FlipDisplay) + { + start.y = tXl1->WindowY0 - 1; + } + else + { + start.y = tXl1->WindowY1 + 1; + } + stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8); stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 if(stop.y >= 470) @@ -600,6 +666,9 @@ char text[512]; uint16_t textpointer = 0; + SSettings* pSettings; + pSettings = settingsGetPointer(); + // CVIEW_T3_Decostop and CVIEW_T3_TTS const SDecoinfo * pDecoinfo; if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) @@ -632,7 +701,9 @@ uint16_t tempWinX0; + uint16_t tempWinX1; uint16_t tempWinY0; + uint16_t tempWinY1; uint16_t tempWinC2X0; uint16_t tempWinC2Tab; @@ -676,6 +747,12 @@ break; case CVIEW_T3_StopWatch: + + tempWinX0 = tXc1->WindowX0; + tempWinY0 = tXc1->WindowY0; + tempWinX1 = tXc1->WindowX1; + tempWinY1 = tXc1->WindowY1; + Stopwatch.Total = timer_Stopwatch_GetTime(); Stopwatch.Minutes = Stopwatch.Total / 60; Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); @@ -687,19 +764,39 @@ snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); GFX_write_string(&FontT105,tXc1,text,0); - tempWinX0 = tXc1->WindowX0; - tempWinY0 = tXc1->WindowY0; - tXc1->WindowX0 = 480; + + + if(!pSettings->FlipDisplay) + { + tXc1->WindowX0 = 480; + } + else + { + tXc1->WindowX1 = 320; + tXc1->WindowY0 = t3c1.WindowY0; /* select customer window */ + } // 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,tXc1,text,0); snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth)); GFX_write_string(&FontT105,tXc1,text,0); - tXc1->WindowY0 = 100; + if(!pSettings->FlipDisplay) + { + tXc1->WindowY0 = 100; + } + else + { + tXc1->WindowY1 -= 100; /* jump to upper of two lines */ + } + snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); GFX_write_string(&FontT105,tXc1,text,0); + tXc1->WindowX0 = tempWinX0; tXc1->WindowY0 = tempWinY0; + tXc1->WindowX1 = tempWinX1; + tXc1->WindowY1 = tempWinY1; break; case CVIEW_T3_GasList:
--- a/Discovery/Src/t7.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/t7.c Tue Jan 01 21:02:17 2019 +0100 @@ -187,15 +187,23 @@ #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) { + + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if(getLicence() == LICENCEBONEX) { customviewsDive = customviewsDiveScooter; @@ -215,48 +223,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 - 30; //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 +441,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(); } @@ -538,6 +729,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,19 +743,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); + write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); /* // scooter connected? @@ -865,8 +1060,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 +1125,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 +1140,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 { @@ -1403,16 +1608,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 +1621,21 @@ 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_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(); + switch(selection_customview) { case CVIEW_noneOrDebug: @@ -1547,7 +1757,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 +1806,10 @@ textpointer = 0; t7cY0free.WindowY0 = t7cC.WindowY0 - 10; + if(pSettings->FlipDisplay) + { + t7cY0free.WindowY1 = 400; + } t7cY0free.WindowLineSpacing = 48; t7cY0free.WindowNumberOfTextLines = 6; @@ -1716,11 +1938,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 +2004,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 +2051,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 +2149,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 +2172,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 +2493,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 +2505,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 +2750,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 +2774,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 +2840,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 +2875,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 +2907,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 +3011,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 +3043,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 +3076,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); + } @@ -3367,17 +3709,22 @@ lastHeading = ActualHeading; */ + uint16_t ActualHeadingRose; uint16_t LeftBorderHeading, LineHeading; uint32_t offsetPicture; point_t start, stop, center; static int32_t LastHeading = 0; int32_t newHeading = 0; + int32_t FlipHeading = 0; int32_t diff = 0; int32_t diff2 = 0; int32_t diffAbs = 0; int32_t diffAbs2 = 0; + SSettings* pSettings; + pSettings = settingsGetPointer(); + newHeading = ActualHeading; diff = newHeading - LastHeading; @@ -3409,6 +3756,7 @@ LastHeading = newHeading; ActualHeading = newHeading; + ActualHeadingRose = ActualHeading; /* if (ActualHeading < 90) ActualHeading += 360; @@ -3425,20 +3773,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 +4014,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 +4038,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); }
--- a/Discovery/Src/tInfoLog.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/tInfoLog.c Tue Jan 01 21:02:17 2019 +0100 @@ -80,8 +80,16 @@ INFOLOGwindow.WindowTab = 400; INFOLOGwindow.WindowX0 = 20; INFOLOGwindow.WindowX1 = 779; - INFOLOGwindow.WindowY0 = 4 + 25; - INFOLOGwindow.WindowY1 = 390 + 25; + if(!settingsGetPointer()->FlipDisplay) + { + INFOLOGwindow.WindowY0 = 4 + 25; + INFOLOGwindow.WindowY1 = 390 + 25; + } + else + { + INFOLOGwindow.WindowY0 = 479 - 390; + INFOLOGwindow.WindowY1 = 479 - 25; + } } @@ -209,7 +217,16 @@ { infolog.line = 0; infolog.modeFlipPages = 1; - GFX_SetFrameBottom(pMenuCursorDesignSolo->FBStartAdress, 0, 25, 800, 390); + + if(!settingsGetPointer()->FlipDisplay) + { + GFX_SetFrameBottom(pMenuCursorDesignSolo->FBStartAdress, 0, 25, 800, 390); + } + else + { + GFX_SetFrameBottom(pMenuCursorDesignSolo->FBStartAdress, 0, 65, 800, 390); + } + } else exitLog(); @@ -367,7 +384,14 @@ infolog.modeFlipPages = 0; - GFX_SetFrameBottom((pMenuCursor->FBStartAdress) + 65*2*(infolog.line - 1), 0, 25, 800, 390); + if(!settingsGetPointer()->FlipDisplay) + { + GFX_SetFrameBottom((pMenuCursor->FBStartAdress) + 65*2*(infolog.line - 1), 0, 25, 800, 390); + } + else + { + GFX_SetFrameBottom((pMenuCursor->FBStartAdress)+ (390 - 65 *(infolog.line)) *2, 0, 480-390-25, 800, 390); + } }
--- a/Discovery/Src/tMenu.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/tMenu.c Tue Jan 01 21:02:17 2019 +0100 @@ -49,7 +49,12 @@ #include "tMenuXtra.h" /* Private types -------------------------------------------------------------*/ -#define MAXPAGES 10 +#define MAXPAGES 10 +#define CURSOR_HIGH 25 +#define TAB_HEADER_HIGH 25 +#define TAB_BAR_HIGH 5 +#define MENU_WDW_HIGH 390 +#define KEY_LABEL_HIGH 25 /* Height of the label used for the the user keys */ typedef struct { @@ -123,6 +128,9 @@ { uint8_t i; + SSettings* pSettings; + pSettings = settingsGetPointer(); + tMdesignCursor.FBStartAdress = getFrame(3); tMdesignCursor.ImageHeight = 390; tMdesignCursor.ImageWidth = 800; @@ -155,9 +163,17 @@ tMwindow.WindowTab = 400; tMwindow.WindowX0 = 20; tMwindow.WindowX1 = 779; - tMwindow.WindowY0 = 4 + 25; - tMwindow.WindowY1 = 390 + 25; + if(!pSettings->FlipDisplay) + { + tMwindow.WindowY0 = 4 + KEY_LABEL_HIGH; + tMwindow.WindowY1 = 390 + KEY_LABEL_HIGH; + } + else + { + tMwindow.WindowY0 = 480 - MENU_WDW_HIGH - TAB_HEADER_HIGH;// - TAB_BAR_HIGH; + tMwindow.WindowY1 = 480 - TAB_HEADER_HIGH - TAB_BAR_HIGH; + } actual_menu_content = MENU_UNDEFINED; } @@ -196,8 +212,7 @@ tM_rebuild_pages(); } -# - void tM_check_content(void) +void tM_check_content(void) { uint8_t mode = 0; @@ -272,19 +287,19 @@ localtext[0] = TXT_2BYTE; localtext[1] = TXT2BYTE_ButtonBack; localtext[2] = 0; - write_content_simple(&tMscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); localtext[0] = '\001'; localtext[1] = TXT_2BYTE; localtext[2] = TXT2BYTE_ButtonEnter; localtext[3] = 0; - write_content_simple(&tMscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); localtext[0] = '\002'; localtext[1] = TXT_2BYTE; localtext[2] = TXT2BYTE_ButtonNext; localtext[3] = 0; - write_content_simple(&tMscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); // gfx_write_page_number(&tMscreen ,menu.pageCountNumber[page],menu.pageCountTotal,0); @@ -388,19 +403,19 @@ localtext[0] = TXT_2BYTE; localtext[1] = TXT2BYTE_ButtonBack; localtext[2] = 0; - write_content_simple(&tMscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); localtext[0] = '\001'; localtext[1] = TXT_2BYTE; localtext[2] = TXT2BYTE_ButtonEnter; localtext[3] = 0; - write_content_simple(&tMscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); localtext[0] = '\002'; localtext[1] = TXT_2BYTE; localtext[2] = TXT2BYTE_ButtonNext; localtext[3] = 0; - write_content_simple(&tMscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); } /* @@ -782,6 +797,8 @@ void openMenu(uint8_t freshWithFlipPages) { uint8_t page, line; + SSettings* pSettings; + pSettings = settingsGetPointer(); callerID = get_globalState(); @@ -818,10 +835,24 @@ GFX_SetFrameTop(menu.StartAddressForPage[page]); /* new test for 3button design */ - if(freshWithFlipPages) - GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); + + if(!pSettings->FlipDisplay) + { + if(freshWithFlipPages) + GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); + else + GFX_SetFrameBottom((tMdesignCursor.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); + } else - GFX_SetFrameBottom((tMdesignCursor.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); + { + if(freshWithFlipPages) + { + GFX_SetFrameBottom((tMdesignSolo.FBStartAdress), 0, 480-390-KEY_LABEL_HIGH, 800, 390); //- (25 * 2 * 800), 0, 25, 800, 390); + } + else + GFX_SetFrameBottom((tMdesignCursor.FBStartAdress + (390 - 65 *(line)) *2), 0,480-390-KEY_LABEL_HIGH, 800, 390); //480-390-KEY_LABEL_HIGH + 65*2*(line - 1) + } + } void block_diluent_handler(_Bool Unblock) @@ -857,6 +888,9 @@ { uint8_t page, line; + SSettings* pSettings; + pSettings = settingsGetPointer(); + menu.pageMemoryForNavigation += 1; findValidPosition(&page, &line); @@ -873,14 +907,23 @@ GFX_SetFrameTop(menu.StartAddressForPage[page]); /* new test for 3button design */ - //GFX_SetFrameBottom((tMdesignCursor.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); - GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); + //GFX_SetFrameBottom((.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); + if(!pSettings->FlipDisplay) + { + GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); + } + else + { + GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); + } } void nextLine(void) { uint8_t page, line; + SSettings* pSettings; + pSettings = settingsGetPointer(); page = menu.pageMemoryForNavigation; menu.lineMemoryForNavigationForPage[page] += 1; @@ -890,8 +933,14 @@ /* new test for 3button design */ menu.modeFlipPages = 0; - - GFX_SetFrameBottom((tMdesignCursor.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); + if(!pSettings->FlipDisplay) + { + GFX_SetFrameBottom((tMdesignCursor.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); + } + else + { + GFX_SetFrameBottom((tMdesignCursor.FBStartAdress)+ (390 - 65 *(line)) *2, 0, 480-390-KEY_LABEL_HIGH, 800, 390); + } } @@ -901,10 +950,19 @@ { menu.lineMemoryForNavigationForPage[menu.pageMemoryForNavigation] = 0; menu.modeFlipPages = 1; - GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); + if(!settingsGetPointer()->FlipDisplay) + { + GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); + } + else + { + GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 480-390-KEY_LABEL_HIGH, 800, 390); + } } else + { exitMenu(); + } } @@ -1023,6 +1081,8 @@ uint16_t al88; }; + uint16_t* prunning = *ppDestination; + union al88_u color_seperator; union al88_u color_unselected; int i; @@ -1033,21 +1093,18 @@ color_seperator.al8[1] = 0xFF; color_unselected.al8[1] = 0xFF; - *(__IO uint16_t*)*ppDestination = color_seperator.al88; - *ppDestination += 2; - *(__IO uint16_t*)*ppDestination = color_seperator.al88; - *ppDestination += 2; + *(__IO uint16_t*)prunning++ = color_seperator.al88; + *(__IO uint16_t*)prunning++ = color_seperator.al88; for(i = 61; i > 0; i--) { - *(__IO uint16_t*)*ppDestination = color_unselected.al88; - *ppDestination += 2; + *(__IO uint16_t*)prunning++ = color_unselected.al88; } - *(__IO uint16_t*)*ppDestination = color_seperator.al88; - *ppDestination += 2; - *(__IO uint16_t*)*ppDestination = color_seperator.al88; - *ppDestination += 2; + *(__IO uint16_t*)prunning++ = color_seperator.al88; + *(__IO uint16_t*)prunning++ = color_seperator.al88; + + *ppDestination = prunning; } @@ -1129,6 +1186,7 @@ draw_tMdesignSubSelected(&pDestination); } +/* Draw menu background boxes which are visible if nothing is selected */ pDestination = tMdesignSolo.FBStartAdress; for(j = 801; j > 0; j--) @@ -1151,7 +1209,7 @@ union al88_u color_top; int i,j, k, k4text; uint32_t pBackup; - uint32_t pDestination; + uint16_t* pDestination; uint8_t colorText; uint16_t positionText; uint8_t pageText; @@ -1230,35 +1288,67 @@ if((text8max[k][0] == 0) && (menu.pageCountNumber[k-1] == 0)) write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k-1],colorText); */ - pDestination += 2 * 5 * 480; +/* Draw color bars */ + if(!settingsGetPointer()->FlipDisplay) + { + pDestination += 5 * 480; - for(j = 60; j > 0; j--) - { - pDestination += (390 + 26)* 2; + for(j = 60; j > 0; j--) + { + pDestination += (390 + 26); -// for(i = 64; i > 0; i--) - for(i = 16; i > 0; i--) - { - *(__IO uint16_t*)pDestination = color_top.al88; - pDestination += 2; - } - pDestination += 2 * 48; - } + for(i = 16; i > 0; i--) + { + *(__IO uint16_t*)pDestination++ = color_top.al88; + } + pDestination += 48; + } + + pDestination += 5 * 480; + positionText += 70; + + if((k == 4) || ((k == 6) && (menu.pageCountNumber[5] == 0))) + { + pDestination += 70 * 480; + positionText += 70; + } - pDestination += 2 * 5 * 480; - positionText += 70; + if(spacing[k]) + { + pDestination += 35 * 480; + positionText += 35; + } + } + else + { + pDestination += (800 - 5)* 480; + + for(j = 60; j > 0; j--) + { + pDestination -= (390 + 26); - if((k == 4) || ((k == 6) && (menu.pageCountNumber[5] == 0))) - { - pDestination += 2 * 70 * 480; - positionText += 70; - } + for(i = 16; i > 0; i--) + { + *(__IO uint16_t*)pDestination-- = color_top.al88; + } + pDestination -= 48; + } + + pDestination -= (800) * 480; + positionText += 70; - if(spacing[k]) - { - pDestination += 35 * 2 * 480; - positionText += 35; - } + if((k == 4) || ((k == 6) && (menu.pageCountNumber[5] == 0))) + { + pDestination -= 70 * 480; + positionText += 70; + } + + if(spacing[k]) + { + pDestination -= 35 * 480; + positionText += 35; + } + } } } tMscreen.FBStartAdress = pBackup;
--- a/Discovery/Src/tMenuEdit.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/tMenuEdit.c Tue Jan 01 21:02:17 2019 +0100 @@ -186,7 +186,14 @@ uint8_t line = 1; // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, (tMEcursorNew.FBStartAdress) + 65*2*(line - 1),390); GFX_SetFrameTop(tMEscreen.FBStartAdress); - GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); + if(!settingsGetPointer()->FlipDisplay) + { + GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); + } + else + { + GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(line)) *2, 0, 480-390-25, 800, 390); + } } @@ -1592,15 +1599,29 @@ int16_t y0; uint8_t lineMinusOne; - y0 = (int16_t)ident[forThisIdentID].coord[2]; - + if(!settingsGetPointer()->FlipDisplay) + { + y0 = (int16_t)ident[forThisIdentID].coord[2]; + } + else + { + y0 = 390 - (int16_t)ident[forThisIdentID].coord[2]; + } y0 -= ME_Y_LINE1; y0 /= ME_Y_LINE_STEP; if((y0 >= 0) && (y0 <=5)) lineMinusOne = y0; else lineMinusOne = 0; - GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(lineMinusOne), 0, 25, 800, 390); + + if(!settingsGetPointer()->FlipDisplay) + { + GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(lineMinusOne), 0, 25, 800, 390); + } + else + { + GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(5-lineMinusOne-1)) *2, 0, 480-390-25, 800, 390); + } } @@ -1615,16 +1636,34 @@ hgfx.WindowTab = 0; hgfx.WindowX0 = 20; hgfx.WindowX1 = 779; - hgfx.WindowY1 = 479; - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + if(!settingsGetPointer()->FlipDisplay) + { + hgfx.WindowY1 = 479; + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } + else + { + hgfx.WindowY0 = 0; + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_write_label(Font, &hgfx, text, menuColor); } void write_buttonTextline( uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode) { - GFX_clean_area(&tMEscreen, 0, 800, 480-24,480); + + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if(!pSettings->FlipDisplay) + { + GFX_clean_area(&tMEscreen, 0, 800, 480-24,480); + } + else + { + GFX_clean_area(&tMEscreen, 0, 800, 0, 24); + } char localtext[32]; @@ -1633,7 +1672,14 @@ localtext[0] = TXT_2BYTE; localtext[1] = left2ByteCode; localtext[2] = 0; - write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + if(!pSettings->FlipDisplay) + { + write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } + else + { + write_content_simple(&tMEscreen, 0, 800, 0, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } } if(middle2ByteCode) @@ -1642,7 +1688,14 @@ localtext[1] = TXT_2BYTE; localtext[2] = middle2ByteCode; localtext[3] = 0; - write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + if(!pSettings->FlipDisplay) + { + write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } + else + { + write_content_simple(&tMEscreen, 0, 800, 0, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } } if(right2ByteCode) @@ -1651,7 +1704,14 @@ localtext[1] = TXT_2BYTE; localtext[2] = right2ByteCode; localtext[3] = 0; - write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + if(!pSettings->FlipDisplay) + { + write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } + else + { + write_content_simple(&tMEscreen, 0, 800, 0, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } } } @@ -1671,14 +1731,26 @@ hgfx.WindowNumberOfTextLines = 1; hgfx.WindowLineSpacing = 0; hgfx.WindowTab = 0; - hgfx.WindowX0 = XleftGimpStyle; - hgfx.WindowX1 = XrightGimpStyle; - hgfx.WindowY1 = 479 - YtopGimpStyle; - if(hgfx.WindowY1 < Font->height) - hgfx.WindowY0 = 0; + if(!settingsGetPointer()->FlipDisplay) + { + hgfx.WindowX0 = XleftGimpStyle; + hgfx.WindowX1 = XrightGimpStyle; + hgfx.WindowY1 = 479 - YtopGimpStyle; + if(hgfx.WindowY1 < Font->height) + hgfx.WindowY0 = 0; + else + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } else - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + { + hgfx.WindowX0 = 800 - XrightGimpStyle; + hgfx.WindowX1 = 800 - XleftGimpStyle; + hgfx.WindowY0 = YtopGimpStyle; + if(hgfx.WindowY0 < Font->height) + hgfx.WindowY1 = 0; + else + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_write_label(Font, &hgfx, text, 0);/*menuColor);*/ } @@ -1697,14 +1769,27 @@ hgfx.WindowNumberOfTextLines = 1; hgfx.WindowLineSpacing = 0; hgfx.WindowTab = 0; - hgfx.WindowX0 = XleftGimpStyle; - hgfx.WindowX1 = XrightGimpStyle; - hgfx.WindowY1 = 479 - YtopGimpStyle; - if(hgfx.WindowY1 < Font->height) - hgfx.WindowY0 = 0; + + if(!settingsGetPointer()->FlipDisplay) + { + hgfx.WindowX0 = XleftGimpStyle; + hgfx.WindowX1 = XrightGimpStyle; + hgfx.WindowY1 = 479 - YtopGimpStyle; + if(hgfx.WindowY1 < Font->height) + hgfx.WindowY0 = 0; + else + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } else - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + { + hgfx.WindowX0 = 800 - XrightGimpStyle; + hgfx.WindowX1 = 800 - XleftGimpStyle; + hgfx.WindowY0 = YtopGimpStyle; + if(hgfx.WindowY0 < Font->height) + hgfx.WindowY1 = 0; + else + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_write_label(Font, &hgfx, text, color); } @@ -1731,6 +1816,8 @@ if(YtopGimpStyle > 479) YtopGimpStyle = 479; hgfx.Image = &tMEscreen; + if(!settingsGetPointer()->FlipDisplay) + { hgfx.WindowX0 = XleftGimpStyle; hgfx.WindowX1 = XrightGimpStyle; hgfx.WindowY1 = 479 - YtopGimpStyle; @@ -1738,7 +1825,17 @@ hgfx.WindowY0 = 0; else hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + } + else + { + hgfx.WindowX0 = 800 - XrightGimpStyle; + hgfx.WindowX1 = 800 - XleftGimpStyle; + hgfx.WindowY0 = YtopGimpStyle; + if(hgfx.WindowY0 < Font->height) + hgfx.WindowY1 = 0; + else + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_clear_window_immediately(&hgfx); }
--- a/Discovery/Src/tMenuEditHardware.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/tMenuEditHardware.c Tue Jan 01 21:02:17 2019 +0100 @@ -44,6 +44,7 @@ //void openEdit_Luftintegration(void); void openEdit_ButtonSens(void); void openEdit_ScooterControl(void); +void openEdit_FlipDisplay(void); /* Announced function prototypes -----------------------------------------------*/ uint8_t OnAction_Compass (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); @@ -88,7 +89,14 @@ openEdit_ButtonSens(); break; case 6: - openEdit_ScooterControl(); + if(getLicence() == LICENCEBONEX) + { + openEdit_ScooterControl(); + } + else + { + openEdit_FlipDisplay(); + } break; } } @@ -113,6 +121,32 @@ exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); } +void openEdit_FlipDisplay(void) +{ +/* does not work like this resetEnterPressedToStateBeforeButtonAction(); */ + + SSettings *pSettings = settingsGetPointer(); + + if(pSettings->FlipDisplay == 0) + { + pSettings->FlipDisplay = 1; + } + else + { + pSettings->FlipDisplay = 0; + } + /* reinit all views */ + tHome_init(); + tI_init(); + tM_init(); + tMenuEdit_init(); + tInfoLog_init(); + tM_build_pages(); + + + exitEditWithUpdate(); + exitMenuEdit_to_Home(); +} /* void refresh_ScooterControl(void) { @@ -469,7 +503,7 @@ void refresh_O2Sensors(void) { - char text[10]; + char text[16]; uint16_t y_line; text[0] = '\001';
--- a/Discovery/Src/tMenuHardware.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/tMenuHardware.c Tue Jan 01 21:02:17 2019 +0100 @@ -162,16 +162,32 @@ } nextline(text,&textPointer); - if((getLicence() == LICENCEBONEX) &&((line == 0) || (line == 6))) + if((line == 0) || (line == 6)) { - text[textPointer++] = TXT_2BYTE; - text[textPointer++] = TXT2BYTE_ScooterSetup; - text[textPointer++] = '\t'; + if(getLicence() == LICENCEBONEX) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_ScooterSetup; + text[textPointer++] = '\t'; -// textPointer += snprintf(&text[textPointer],25,"D%i L%i ",settingsGetPointer()->scooterDrag, settingsGetPointer()->scooterLoad); - textPointer += snprintf(&text[textPointer],25,"D%i L%i %i\016\016 Wh\017",settingsGetPointer()->scooterDrag, settingsGetPointer()->scooterLoad, settingsGetPointer()->scooterBattSize); -// textPointer += bo4GetBatteryName(&text[textPointer], settingsGetPointer()->scooterBattType); - nextline(text,&textPointer); + // textPointer += snprintf(&text[textPointer],25,"D%i L%i ",settingsGetPointer()->scooterDrag, settingsGetPointer()->scooterLoad); + textPointer += snprintf(&text[textPointer],25,"D%i L%i %i\016\016 Wh\017",settingsGetPointer()->scooterDrag, settingsGetPointer()->scooterLoad, settingsGetPointer()->scooterBattSize); + // textPointer += bo4GetBatteryName(&text[textPointer], settingsGetPointer()->scooterBattType); + nextline(text,&textPointer); + } + else + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_FLIPDISPLAY; + text[textPointer++] = '\t'; + if(settingsGetPointer()->FlipDisplay) + text[textPointer++] = '\005'; + else + text[textPointer++] = '\006'; + text[textPointer] = 0; + nextline(text,&textPointer); + } } + return StMHARD; }