mirror of https://github.com/arendst/Tasmota.git
fix rotate
This commit is contained in:
parent
f3c1da6a55
commit
01ec66b7b6
|
@ -903,8 +903,13 @@ void uDisplay::drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) {
|
|||
SPI_END_TRANSACTION
|
||||
}
|
||||
|
||||
//#define CD_XS gxs
|
||||
//#define CD_YS gys
|
||||
#define CD_XS width()
|
||||
#define CD_YS height()
|
||||
|
||||
void uDisplay::fillScreen(uint16_t color) {
|
||||
fillRect(0, 0, gxs, gys, color);
|
||||
fillRect(0, 0, CD_XS, CD_YS, color);
|
||||
}
|
||||
|
||||
// fill a rectangle
|
||||
|
@ -921,9 +926,9 @@ void uDisplay::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t col
|
|||
return;
|
||||
}
|
||||
|
||||
if((x >= gxs) || (y >= gys)) return;
|
||||
if((x + w - 1) >= gxs) w = gxs - x;
|
||||
if((y + h - 1) >= gys) h = gys - y;
|
||||
if((x >= CD_XS) || (y >= CD_YS)) return;
|
||||
if((x + w - 1) >= CD_XS) w = CD_XS - x;
|
||||
if((y + h - 1) >= CD_YS) h = CD_YS - y;
|
||||
|
||||
|
||||
SPI_BEGIN_TRANSACTION
|
||||
|
@ -1424,14 +1429,24 @@ void uDisplay::dim8(uint8_t dim, uint8_t dim_gamma) { // dimmer with 8
|
|||
void uDisplay::TS_RotConvert(int16_t *x, int16_t *y) {
|
||||
int16_t temp;
|
||||
|
||||
if (rot_t[cur_rot] & 0x80) {
|
||||
temp = *y;
|
||||
*y = *x;
|
||||
*x = temp;
|
||||
}
|
||||
|
||||
if (rotmap_xmin >= 0) {
|
||||
*y = map(*y, rotmap_ymin, rotmap_ymax, 0, gys);
|
||||
*x = map(*x, rotmap_xmin, rotmap_xmax, 0, gxs);
|
||||
*x = constrain(*x, 0, gxs);
|
||||
*y = constrain(*y, 0, gys);
|
||||
}
|
||||
*x = constrain(*x, 0, gxs);
|
||||
*y = constrain(*y, 0, gys);
|
||||
// *x = constrain(*x, 0, gxs);
|
||||
// *y = constrain(*y, 0, gys);
|
||||
|
||||
switch (rot_t[cur_rot]) {
|
||||
//Serial.printf("rot 1 %d - %d\n",*x,*y );
|
||||
|
||||
switch (rot_t[cur_rot] & 0xf) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
|
@ -1448,7 +1463,15 @@ void uDisplay::TS_RotConvert(int16_t *x, int16_t *y) {
|
|||
*y = *x;
|
||||
*x = width() - temp;
|
||||
break;
|
||||
case 4:
|
||||
*x = width() - *x;
|
||||
break;
|
||||
case 5:
|
||||
*y = height() - *y;
|
||||
break;
|
||||
}
|
||||
|
||||
//Serial.printf("rot 2 %d - %d\n",*x,*y );
|
||||
}
|
||||
|
||||
uint8_t uDisplay::strlen_ln(char *str) {
|
||||
|
|
|
@ -20,12 +20,12 @@ F7,4,A9,51,2C,82
|
|||
:O,29
|
||||
:A,2A,2B,2C,16
|
||||
:R,36
|
||||
;:0,48,00,00,00
|
||||
:0,28,00,00,01
|
||||
:1,28,00,00,00
|
||||
:2,E8,00,00,03
|
||||
:3,88,00,00,02
|
||||
:0,28,00,00,85
|
||||
:1,88,00,00,02
|
||||
:2,E8,00,00,84
|
||||
:3,48,00,00,00
|
||||
:P,18
|
||||
:i,20,21
|
||||
:TI1,38,*,*
|
||||
:B,20,0
|
||||
#
|
||||
|
|
|
@ -30,9 +30,9 @@ E1,0F,00,0E,14,03,11,07,31,C1,48,08,0F,0C,31,36,0F
|
|||
:A,2A,2B,2C,16
|
||||
:R,36
|
||||
:0,08,00,00,00
|
||||
:1,A8,00,00,01
|
||||
:1,A8,00,00,84
|
||||
:2,C8,00,00,02
|
||||
:3,68,00,00,03
|
||||
:3,68,00,00,85
|
||||
:i,21,20
|
||||
:TI2,38,22,21
|
||||
#
|
||||
|
|
|
@ -294,14 +294,20 @@ uDisplay *udisp;
|
|||
}
|
||||
#endif
|
||||
|
||||
uint8_t inirot = Settings->display_rotate;
|
||||
|
||||
cp = strstr(ddesc, ":r,");
|
||||
if (cp) {
|
||||
cp+=3;
|
||||
inirot = strtol(cp, &cp, 10);
|
||||
}
|
||||
|
||||
// release desc buffer
|
||||
if (fbuff) free(fbuff);
|
||||
|
||||
renderer = udisp->Init();
|
||||
if (!renderer) return 0;
|
||||
|
||||
Settings->display_width = renderer->width();
|
||||
Settings->display_height = renderer->height();
|
||||
fg_color = renderer->fgcol();
|
||||
bg_color = renderer->bgcol();
|
||||
color_type = renderer->color_type();
|
||||
|
@ -311,7 +317,11 @@ uDisplay *udisp;
|
|||
renderer->SetDimCB(Core2DisplayDim);
|
||||
#endif
|
||||
|
||||
renderer->DisplayInit(DISPLAY_INIT_MODE, Settings->display_size, Settings->display_rotate, Settings->display_font);
|
||||
renderer->DisplayInit(DISPLAY_INIT_MODE, Settings->display_size, inirot, Settings->display_font);
|
||||
|
||||
Settings->display_width = renderer->width();
|
||||
Settings->display_height = renderer->height();
|
||||
|
||||
ApplyDisplayDimmer();
|
||||
|
||||
#ifdef SHOW_SPLASH
|
||||
|
|
Loading…
Reference in New Issue