mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 04:36:31 +00:00
commit
d3874e9834
@ -32,14 +32,14 @@ typedef struct LVGL_PARAMS {
|
|||||||
union {
|
union {
|
||||||
uint8_t data;
|
uint8_t data;
|
||||||
struct {
|
struct {
|
||||||
|
uint8_t use_dma : 1;
|
||||||
|
uint8_t swap_color : 1;
|
||||||
uint8_t resvd_0 : 1;
|
uint8_t resvd_0 : 1;
|
||||||
uint8_t resvd_1 : 1;
|
uint8_t resvd_1 : 1;
|
||||||
uint8_t resvd_2 : 1;
|
uint8_t resvd_2 : 1;
|
||||||
uint8_t resvd_3 : 1;
|
uint8_t resvd_3 : 1;
|
||||||
uint8_t resvd_4 : 1;
|
uint8_t resvd_4 : 1;
|
||||||
uint8_t resvd_5 : 1;
|
uint8_t resvd_5 : 1;
|
||||||
uint8_t resvd_6 : 1;
|
|
||||||
uint8_t use_dma : 1;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}LVGL_PARAMS;
|
}LVGL_PARAMS;
|
||||||
|
@ -289,7 +289,7 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
|
|||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
lvgl_param.fluslines = next_val(&lp1);
|
lvgl_param.fluslines = next_val(&lp1);
|
||||||
lvgl_param.use_dma = next_val(&lp1);
|
lvgl_param.data = next_val(&lp1);
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
rotmap_xmin = next_val(&lp1);
|
rotmap_xmin = next_val(&lp1);
|
||||||
@ -1083,7 +1083,11 @@ static inline void lvgl_color_swap(uint16_t *data, uint16_t len) { for (uint32_t
|
|||||||
void uDisplay::pushColors(uint16_t *data, uint16_t len, boolean not_swapped) {
|
void uDisplay::pushColors(uint16_t *data, uint16_t len, boolean not_swapped) {
|
||||||
uint16_t color;
|
uint16_t color;
|
||||||
|
|
||||||
//Serial.printf("push %x - %d\n", (uint32_t)data, len);
|
if (lvgl_param.swap_color) {
|
||||||
|
not_swapped = !not_swapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Serial.printf("push %x - %d - %d - %d\n", (uint32_t)data, len, not_swapped,lvgl_param.data);
|
||||||
if (not_swapped == false) {
|
if (not_swapped == false) {
|
||||||
// called from LVGL bytes are swapped
|
// called from LVGL bytes are swapped
|
||||||
if (bpp != 16) {
|
if (bpp != 16) {
|
||||||
@ -1409,7 +1413,6 @@ void uDisplay::TS_RotConvert(int16_t *x, int16_t *y) {
|
|||||||
*x = width() - temp;
|
*x = width() - temp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t uDisplay::strlen_ln(char *str) {
|
uint8_t uDisplay::strlen_ln(char *str) {
|
||||||
|
@ -2616,13 +2616,21 @@ chknext:
|
|||||||
len = 0;
|
len = 0;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (!strncmp(vname, "iw(", 3)) {
|
if (!strncmp(vname, "iw", 2)) {
|
||||||
lp = GetNumericArgument(lp + 3, OPER_EQU, &fvar, gv);
|
uint8_t bytes = 1;
|
||||||
|
lp += 2;
|
||||||
|
if (*lp != '(') {
|
||||||
|
bytes = *lp & 0xf;
|
||||||
|
if (bytes < 1) bytes = 1;
|
||||||
|
if (bytes > 4) bytes = 4;
|
||||||
|
lp++;
|
||||||
|
}
|
||||||
|
lp = GetNumericArgument(lp + 1, OPER_EQU, &fvar, gv);
|
||||||
SCRIPT_SKIP_SPACES
|
SCRIPT_SKIP_SPACES
|
||||||
// arg2
|
// arg2
|
||||||
float fvar2;
|
float fvar2;
|
||||||
lp = GetNumericArgument(lp, OPER_EQU, &fvar2, gv);
|
lp = GetNumericArgument(lp, OPER_EQU, &fvar2, gv);
|
||||||
fvar = script_i2c(1, fvar, fvar2);
|
fvar = script_i2c(9 + bytes, fvar, fvar2);
|
||||||
lp++;
|
lp++;
|
||||||
len = 0;
|
len = 0;
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -7830,7 +7838,10 @@ void cpy2lf(char *dst, uint32_t dstlen, char *src) {
|
|||||||
#ifdef USE_SCRIPT_I2C
|
#ifdef USE_SCRIPT_I2C
|
||||||
uint8_t script_i2c_addr;
|
uint8_t script_i2c_addr;
|
||||||
TwoWire *script_i2c_wire;
|
TwoWire *script_i2c_wire;
|
||||||
uint32_t script_i2c(uint8_t sel, uint8_t val, uint8_t val1) {
|
uint32_t script_i2c(uint8_t sel, uint32_t val, uint32_t val1) {
|
||||||
|
uint32_t rval = 0;
|
||||||
|
uint8_t bytes = 1;
|
||||||
|
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case 0:
|
case 0:
|
||||||
script_i2c_addr = val;
|
script_i2c_addr = val;
|
||||||
@ -7843,26 +7854,36 @@ uint32_t script_i2c(uint8_t sel, uint8_t val, uint8_t val1) {
|
|||||||
script_i2c_wire->beginTransmission(script_i2c_addr);
|
script_i2c_wire->beginTransmission(script_i2c_addr);
|
||||||
return (0 == script_i2c_wire->endTransmission());
|
return (0 == script_i2c_wire->endTransmission());
|
||||||
break;
|
break;
|
||||||
case 1:
|
|
||||||
script_i2c_wire->beginTransmission(script_i2c_addr);
|
|
||||||
script_i2c_wire->write(val);
|
|
||||||
script_i2c_wire->write(val1);
|
|
||||||
script_i2c_wire->endTransmission();
|
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
|
// read 1..4 bytes
|
||||||
script_i2c_wire->beginTransmission(script_i2c_addr);
|
script_i2c_wire->beginTransmission(script_i2c_addr);
|
||||||
script_i2c_wire->write(val);
|
script_i2c_wire->write(val);
|
||||||
script_i2c_wire->endTransmission();
|
script_i2c_wire->endTransmission();
|
||||||
script_i2c_wire->requestFrom((int)script_i2c_addr, (int)val1);
|
script_i2c_wire->requestFrom((int)script_i2c_addr, (int)val1);
|
||||||
uint32_t rval = 0;
|
|
||||||
for (uint8_t cnt = 0; cnt < val1; cnt++) {
|
for (uint8_t cnt = 0; cnt < val1; cnt++) {
|
||||||
rval <<= 8;
|
rval <<= 8;
|
||||||
rval |= script_i2c_wire->read();
|
rval |= script_i2c_wire->read();
|
||||||
}
|
}
|
||||||
return rval;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
case 12:
|
||||||
|
case 13:
|
||||||
|
// write 1 .. 4 bytes
|
||||||
|
bytes = sel - 9;
|
||||||
|
script_i2c_wire->beginTransmission(script_i2c_addr);
|
||||||
|
script_i2c_wire->write(val);
|
||||||
|
for (uint8_t cnt = 0; cnt < bytes; cnt++) {
|
||||||
|
script_i2c_wire->write(val1);
|
||||||
|
val1 >>= 8;
|
||||||
}
|
}
|
||||||
return 0;
|
script_i2c_wire->endTransmission();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
}
|
}
|
||||||
#endif // USE_SCRIPT_I2C
|
#endif // USE_SCRIPT_I2C
|
||||||
|
|
||||||
@ -8365,6 +8386,11 @@ bool Xdrv10(uint8_t function)
|
|||||||
case FUNC_EVERY_100_MSECOND:
|
case FUNC_EVERY_100_MSECOND:
|
||||||
ScripterEvery100ms();
|
ScripterEvery100ms();
|
||||||
break;
|
break;
|
||||||
|
#ifdef USE_LVGL
|
||||||
|
case FUNC_EVERY_50_MSECOND:
|
||||||
|
lv_task_handler();
|
||||||
|
break;
|
||||||
|
#endif // USE_LVGL
|
||||||
|
|
||||||
case FUNC_EVERY_SECOND:
|
case FUNC_EVERY_SECOND:
|
||||||
ScriptEverySecond();
|
ScriptEverySecond();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user