mirror of https://github.com/arendst/Tasmota.git
parent
465ccc2f61
commit
b32a440532
|
@ -71,7 +71,7 @@ enum XdspFunctions { FUNC_DISPLAY_INIT_DRIVER, FUNC_DISPLAY_INIT, FUNC_DISPLAY_E
|
|||
FUNC_DISPLAY_DRAW_HLINE, FUNC_DISPLAY_DRAW_VLINE, FUNC_DISPLAY_DRAW_LINE,
|
||||
FUNC_DISPLAY_DRAW_CIRCLE, FUNC_DISPLAY_FILL_CIRCLE,
|
||||
FUNC_DISPLAY_DRAW_RECTANGLE, FUNC_DISPLAY_FILL_RECTANGLE,
|
||||
FUNC_DISPLAY_TEXT_SIZE, FUNC_DISPLAY_FONT_SIZE, FUNC_DISPLAY_ROTATION, FUNC_DISPLAY_DRAW_STRING, FUNC_DISPLAY_ONOFF };
|
||||
FUNC_DISPLAY_TEXT_SIZE, FUNC_DISPLAY_FONT_SIZE, FUNC_DISPLAY_ROTATION, FUNC_DISPLAY_DRAW_STRING };
|
||||
|
||||
enum DisplayInitModes { DISPLAY_INIT_MODE, DISPLAY_INIT_PARTIAL, DISPLAY_INIT_FULL };
|
||||
|
||||
|
@ -241,8 +241,7 @@ void DisplayDrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint
|
|||
|
||||
void DisplayOnOff(uint8_t on)
|
||||
{
|
||||
dsp_on = on;
|
||||
XdspCall(FUNC_DISPLAY_ONOFF);
|
||||
ExecuteCommandPower(disp_device, on, SRC_DISPLAY);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
|
@ -435,18 +434,10 @@ void DisplayText(void)
|
|||
DisplayInit(DISPLAY_INIT_FULL);
|
||||
break;
|
||||
case 'o':
|
||||
if (!renderer) {
|
||||
DisplayOnOff(0);
|
||||
} else {
|
||||
renderer->DisplayOnff(0);
|
||||
}
|
||||
DisplayOnOff(0);
|
||||
break;
|
||||
case 'O':
|
||||
if (!renderer) {
|
||||
DisplayOnOff(1);
|
||||
} else {
|
||||
renderer->DisplayOnff(1);
|
||||
}
|
||||
DisplayOnOff(1);
|
||||
break;
|
||||
case 'x':
|
||||
// set disp_xpos
|
||||
|
@ -1268,8 +1259,11 @@ void DisplayInitDriver(void)
|
|||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Display model %d"), Settings.display_model);
|
||||
|
||||
if (Settings.display_model) {
|
||||
if (!light_type) {
|
||||
devices_present++; // If no PWM channel for backlight then use "normal" power control
|
||||
devices_present++;
|
||||
if (!PinUsed(GPIO_BACKLIGHT)) {
|
||||
if (light_type && (4 == Settings.display_model)) {
|
||||
devices_present--; // Assume PWM channel is used for backlight
|
||||
}
|
||||
}
|
||||
disp_device = devices_present;
|
||||
|
||||
|
|
|
@ -93,9 +93,9 @@ void LcdDrawStringAt(void)
|
|||
lcd->print(dsp_str);
|
||||
}
|
||||
|
||||
void LcdDisplayOnOff(uint8_t on)
|
||||
void LcdDisplayOnOff()
|
||||
{
|
||||
if (on) {
|
||||
if (disp_power) {
|
||||
lcd->backlight();
|
||||
} else {
|
||||
lcd->noBacklight();
|
||||
|
@ -212,7 +212,7 @@ bool Xdsp01(uint8_t function)
|
|||
LcdInit(dsp_init);
|
||||
break;
|
||||
case FUNC_DISPLAY_POWER:
|
||||
LcdDisplayOnOff(disp_power);
|
||||
LcdDisplayOnOff();
|
||||
break;
|
||||
case FUNC_DISPLAY_CLEAR:
|
||||
lcd->clear();
|
||||
|
@ -238,9 +238,6 @@ bool Xdsp01(uint8_t function)
|
|||
case FUNC_DISPLAY_DRAW_STRING:
|
||||
LcdDrawStringAt();
|
||||
break;
|
||||
case FUNC_DISPLAY_ONOFF:
|
||||
LcdDisplayOnOff(dsp_on);
|
||||
break;
|
||||
// case FUNC_DISPLAY_ROTATION:
|
||||
// break;
|
||||
#ifdef USE_DISPLAY_MODES1TO5
|
||||
|
|
|
@ -145,21 +145,16 @@ void Ili9341DrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint
|
|||
tft->println(str);
|
||||
}
|
||||
|
||||
void Ili9341DisplayOnOff(uint8_t on)
|
||||
void Ili9341DisplayOnOff()
|
||||
{
|
||||
// tft->showDisplay(on);
|
||||
// tft->invertDisplay(on);
|
||||
// tft->showDisplay(disp_power);
|
||||
// tft->invertDisplay(disp_power);
|
||||
if (PinUsed(GPIO_BACKLIGHT)) {
|
||||
pinMode(Pin(GPIO_BACKLIGHT), OUTPUT);
|
||||
digitalWrite(Pin(GPIO_BACKLIGHT), on);
|
||||
digitalWrite(Pin(GPIO_BACKLIGHT), disp_power);
|
||||
}
|
||||
}
|
||||
|
||||
void Ili9341OnOff(void)
|
||||
{
|
||||
Ili9341DisplayOnOff(disp_power);
|
||||
}
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
#ifdef USE_DISPLAY_MODES1TO5
|
||||
|
@ -277,7 +272,7 @@ bool Xdsp04(uint8_t function)
|
|||
Ili9341Init(dsp_init);
|
||||
break;
|
||||
case FUNC_DISPLAY_POWER:
|
||||
Ili9341OnOff();
|
||||
Ili9341DisplayOnOff();
|
||||
break;
|
||||
case FUNC_DISPLAY_CLEAR:
|
||||
Ili9341Clear();
|
||||
|
@ -315,9 +310,6 @@ bool Xdsp04(uint8_t function)
|
|||
case FUNC_DISPLAY_DRAW_STRING:
|
||||
Ili9341DrawStringAt(dsp_x, dsp_y, dsp_str, dsp_color, dsp_flag);
|
||||
break;
|
||||
case FUNC_DISPLAY_ONOFF:
|
||||
Ili9341DisplayOnOff(dsp_on);
|
||||
break;
|
||||
case FUNC_DISPLAY_ROTATION:
|
||||
tft->setRotation(Settings.display_rotate);
|
||||
break;
|
||||
|
|
|
@ -91,7 +91,7 @@ void SevensegInitDriver(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Settings.display_width = 4;
|
||||
Settings.display_height = sevensegs;
|
||||
|
||||
|
@ -127,7 +127,7 @@ void SevensegDrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uin
|
|||
// Some combinations won't make sense.
|
||||
// Reference: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-led-backpack.pdf
|
||||
// This code has been tested on 1.2" and 0.56" 7-Segment LED displays, but should mostly work for others.
|
||||
//
|
||||
//
|
||||
// Prefixes:
|
||||
// x upcoming decimal integer number displayed as hex
|
||||
// : turn on middle colon
|
||||
|
@ -138,7 +138,7 @@ void SevensegDrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uin
|
|||
// z clear this display
|
||||
// f upcoming number is floating point
|
||||
// r raw segment based on bitmap of upcoming integer number (see reference document above)
|
||||
//
|
||||
//
|
||||
// Some sample valid combinations:
|
||||
// 787 -> 787
|
||||
// x47 -> 2F
|
||||
|
@ -364,7 +364,6 @@ bool Xdsp11(uint8_t function)
|
|||
SevensegRefresh();
|
||||
break;
|
||||
#endif // USE_DISPLAY_MODES1TO5
|
||||
case FUNC_DISPLAY_ONOFF:
|
||||
case FUNC_DISPLAY_POWER:
|
||||
SevensegOnOff();
|
||||
break;
|
||||
|
|
|
@ -112,7 +112,6 @@ const uint8_t xdsp_present = sizeof(xdsp_func_ptr) / sizeof(xdsp_func_ptr[0]);
|
|||
* FUNC_DISPLAY_FONT_SIZE
|
||||
* FUNC_DISPLAY_ROTATION
|
||||
* FUNC_DISPLAY_DRAW_STRING
|
||||
* FUNC_DISPLAY_ONOFF
|
||||
\*********************************************************************************************/
|
||||
|
||||
uint8_t XdspPresent(void)
|
||||
|
|
Loading…
Reference in New Issue