mirror of https://github.com/arendst/Tasmota.git
rework of mapping
This commit is contained in:
parent
de506edd8e
commit
1c1495d52d
|
@ -1384,7 +1384,12 @@ void uDisplay::dim(uint8_t dim) {
|
|||
void uDisplay::TS_RotConvert(int16_t *x, int16_t *y) {
|
||||
int16_t temp;
|
||||
|
||||
// Serial.printf("RAW X: %d, Y: %d, width: %d, height: %d\n", *x, *y, width(), height());
|
||||
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);
|
||||
|
||||
switch (rot_t[cur_rot]) {
|
||||
case 0:
|
||||
|
@ -1403,50 +1408,8 @@ void uDisplay::TS_RotConvert(int16_t *x, int16_t *y) {
|
|||
*y = *x;
|
||||
*x = width() - temp;
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
// Serial.printf("Case 1 before, X: %d, Y: %d\n", *x, *y);
|
||||
temp = *y;
|
||||
*y = rotmap_xmax - *x;
|
||||
*x = temp;
|
||||
// Serial.printf("Case 1 after, X: %d, Y: %d\n", *x, *y);
|
||||
break;
|
||||
case 6:
|
||||
// Serial.printf("Case 2 before, X: %d, Y: %d\n", *x, *y);
|
||||
*x = rotmap_xmax - *x;
|
||||
*y = rotmap_ymax - *y;
|
||||
// Serial.printf("Case 2 after, X: %d, Y: %d\n", *x, *y);
|
||||
break;
|
||||
case 7:
|
||||
// Serial.printf("Case 3 before, X: %d, Y: %d\n", *x, *y);
|
||||
temp = *y;
|
||||
*y = *x;
|
||||
*x = rotmap_xmax - temp;
|
||||
// Serial.printf("Case 3 after, X: %d, Y: %d\n", *x, *y);
|
||||
break;
|
||||
}
|
||||
|
||||
// Serial.printf("MAP rot: %d, case: %d, X: %d, Y: %d\n",cur_rot , rot_t[cur_rot], *x, *y);
|
||||
|
||||
if (rotmap_xmin >= 0) {
|
||||
*y = map(*y, rotmap_ymin, rotmap_ymax, 0, height());
|
||||
*x = map(*x, rotmap_xmin, rotmap_xmax, 0, width());
|
||||
}
|
||||
|
||||
if (*x < 0) {
|
||||
*x = 0;
|
||||
} else if (*x > width()) {
|
||||
*x = width();
|
||||
}
|
||||
if (*y < 0) {
|
||||
*y = 0;
|
||||
} else if (*y > height()) {
|
||||
*y = height();
|
||||
}
|
||||
|
||||
// Serial.printf("ROT X: %d, Y: %d\n", *x, *y);
|
||||
|
||||
}
|
||||
|
||||
uint8_t uDisplay::strlen_ln(char *str) {
|
||||
|
|
|
@ -20,10 +20,10 @@ F7,4,A9,51,2C,82
|
|||
:O,29
|
||||
:A,2A,2B,2C,16
|
||||
:R,36
|
||||
:0,28,00,00,06
|
||||
:1,48,00,00,05
|
||||
:2,E8,00,00,04
|
||||
:3,88,00,00,07
|
||||
:0,28,00,00,02
|
||||
:1,48,00,00,01
|
||||
:2,E8,00,00,00
|
||||
:3,88,00,00,03
|
||||
:P,18
|
||||
:i,20,21
|
||||
:TS,16
|
||||
|
|
Loading…
Reference in New Issue