mirror of https://github.com/arendst/Tasmota.git
Merge remote-tracking branch 'Tasmota/development' into development
This commit is contained in:
commit
eb5870de12
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -149,7 +149,7 @@ void Renderer::DrawStringAt(int16_t x, int16_t y, const char* text, uint16_t col
|
|||
#endif
|
||||
|
||||
#ifndef USE_GFX_FONTS
|
||||
if (!font) {
|
||||
if (!font || font == 5) {
|
||||
#endif
|
||||
if (flag) {
|
||||
x=(x-1)*OLED_FONT_WIDTH*textsize_x;
|
||||
|
@ -200,8 +200,13 @@ sFONT RAFont = {
|
|||
12, /* Height */
|
||||
};
|
||||
|
||||
extern uint8_t *loaded_font;
|
||||
|
||||
void Renderer::setTextFont(uint8_t f) {
|
||||
font=f;
|
||||
|
||||
font = f;
|
||||
|
||||
setFont(0);
|
||||
|
||||
#ifdef USE_GFX_FONTS
|
||||
switch (f) {
|
||||
|
@ -269,6 +274,10 @@ void Renderer::setTextFont(uint8_t f) {
|
|||
selected_font = &Font24_7seg;
|
||||
break;
|
||||
#endif
|
||||
case 5:
|
||||
setFont(ramfont);
|
||||
break;
|
||||
|
||||
default:
|
||||
selected_font = &Font12;
|
||||
break;
|
||||
|
@ -278,6 +287,17 @@ void Renderer::setTextFont(uint8_t f) {
|
|||
}
|
||||
|
||||
|
||||
void Renderer::SetRamfont(uint8_t *font) {
|
||||
ramfont = (GFXfont*)font;
|
||||
uint32_t bitmap_offset = (uint32_t)ramfont->bitmap;
|
||||
uint32_t glyph_offset = (uint32_t)ramfont->glyph;
|
||||
|
||||
ramfont->bitmap = (uint8_t*)((uint32_t)font + bitmap_offset);
|
||||
ramfont->glyph = (GFXglyph*)((uint32_t)font + glyph_offset);
|
||||
|
||||
setFont(ramfont);
|
||||
}
|
||||
|
||||
void Renderer::clearDisplay(void) {
|
||||
fillScreen(BLACK);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||
virtual uint16_t GetColorFromIndex(uint8_t index);
|
||||
|
||||
void SetRamfont(uint8_t *font);
|
||||
virtual void DisplayOnff(int8_t on);
|
||||
virtual void DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font);
|
||||
virtual void Begin(int16_t p1,int16_t p2,int16_t p3);
|
||||
|
@ -52,6 +52,7 @@ private:
|
|||
sFONT *selected_font;
|
||||
uint8_t font;
|
||||
uint8_t tsize = 1;
|
||||
GFXfont *ramfont = 0;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <Arduino.h>
|
||||
#include "uDisplay.h"
|
||||
|
||||
#define UDSP_DEBUG
|
||||
//#define UDSP_DEBUG
|
||||
|
||||
const uint16_t udisp_colors[]={UDISP_BLACK,UDISP_WHITE,UDISP_RED,UDISP_GREEN,UDISP_BLUE,UDISP_CYAN,UDISP_MAGENTA,\
|
||||
UDISP_YELLOW,UDISP_NAVY,UDISP_DARKGREEN,UDISP_DARKCYAN,UDISP_MAROON,UDISP_PURPLE,UDISP_OLIVE,\
|
||||
|
@ -48,6 +48,7 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
|
|||
lutftime = 350;
|
||||
lut3time = 10;
|
||||
ep_mode = 0;
|
||||
allcmd_mode = 0;
|
||||
startline = 0xA1;
|
||||
uint8_t section = 0;
|
||||
dsp_ncmds = 0;
|
||||
|
@ -70,6 +71,12 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
|
|||
// id line
|
||||
lp1++;
|
||||
section = *lp1++;
|
||||
if (section == 'I') {
|
||||
if (*lp1 == 'C') {
|
||||
allcmd_mode = 1;
|
||||
lp1++;
|
||||
}
|
||||
}
|
||||
if (*lp1 == ',') lp1++;
|
||||
}
|
||||
if (*lp1 != ':' && *lp1 != '\n') {
|
||||
|
@ -413,7 +420,11 @@ Renderer *uDisplay::Init(void) {
|
|||
#ifdef UDSP_DEBUG
|
||||
Serial.printf("%02x ", iob );
|
||||
#endif
|
||||
spi_data8(iob);
|
||||
if (!allcmd_mode) {
|
||||
spi_data8(iob);
|
||||
} else {
|
||||
spi_command(iob);
|
||||
}
|
||||
}
|
||||
SPI_CS_HIGH
|
||||
#ifdef UDSP_DEBUG
|
||||
|
@ -864,11 +875,21 @@ void uDisplay::setAddrWindow_int(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
|
|||
udisp_swap(x2,y2);
|
||||
}
|
||||
spi_command(saw_1);
|
||||
spi_data8(x);
|
||||
spi_data8(x2);
|
||||
if (allcmd_mode) {
|
||||
spi_data8(x);
|
||||
spi_data8(x2);
|
||||
} else {
|
||||
spi_command(x);
|
||||
spi_command(x2);
|
||||
}
|
||||
spi_command(saw_2);
|
||||
spi_data8(y);
|
||||
spi_data8(y2);
|
||||
if (allcmd_mode) {
|
||||
spi_data8(y);
|
||||
spi_data8(y2);
|
||||
} else {
|
||||
spi_command(y);
|
||||
spi_command(y2);
|
||||
}
|
||||
if (saw_3 != 0xff) {
|
||||
spi_command(saw_3); // write to RAM
|
||||
}
|
||||
|
@ -953,8 +974,14 @@ void uDisplay::setRotation(uint8_t rotation) {
|
|||
SPI_BEGIN_TRANSACTION
|
||||
SPI_CS_LOW
|
||||
spi_command(madctrl);
|
||||
spi_data8(rot[cur_rot]);
|
||||
if (sa_mode == 8) {
|
||||
|
||||
if (!allcmd_mode) {
|
||||
spi_data8(rot[cur_rot]);
|
||||
} else {
|
||||
spi_command(rot[cur_rot]);
|
||||
}
|
||||
|
||||
if ((sa_mode == 8) && !allcmd_mode) {
|
||||
spi_command(startline);
|
||||
spi_data8((cur_rot < 2) ? height() : 0);
|
||||
}
|
||||
|
|
|
@ -135,6 +135,7 @@ class uDisplay : public Renderer {
|
|||
uint8_t dsp_ncmds;
|
||||
uint8_t dsp_on;
|
||||
uint8_t dsp_off;
|
||||
uint8_t allcmd_mode;
|
||||
uint16_t splash_font;
|
||||
uint16_t splash_size;
|
||||
uint16_t splash_xp;
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
:H,SSD1331,96,64,16,SPI,1,*,*,*,*,*,*,*,10
|
||||
:S,1,1,1,0,40,10
|
||||
:IC
|
||||
AE,0
|
||||
A0,1,72
|
||||
A1,1,00
|
||||
A2,1,00
|
||||
A4,0
|
||||
A8,1,3F
|
||||
AD,1,8E
|
||||
B0,1,0B
|
||||
B1,1,31
|
||||
B3,1,F0
|
||||
8A,1,64
|
||||
8B,1,78
|
||||
8C,1,64
|
||||
BB,1,3A
|
||||
BE,1,3E
|
||||
87,1,06
|
||||
81,1,91
|
||||
82,1,50
|
||||
83,1,7D
|
||||
AF,0
|
||||
:o,AE
|
||||
:O,AF
|
||||
:A,15,75,FF,8
|
||||
:R,A0,A1
|
||||
:0,72,00,00,00
|
||||
:1,71,00,00,01
|
||||
:2,30,00,00,02
|
||||
:3,33,00,00,03
|
||||
:i,A6,A7
|
||||
#
|
|
@ -24,10 +24,10 @@ AF,80
|
|||
:O,AF
|
||||
:A,15,75,5C,8
|
||||
:R,A0,A1
|
||||
:0,74,00,00,01
|
||||
:1,77,00,00,00
|
||||
:2,76,00,00,03
|
||||
:3,75,00,00,02
|
||||
:0,74,00,00,00
|
||||
:1,77,00,00,01
|
||||
:2,76,00,00,02
|
||||
:3,75,00,00,03
|
||||
:i,A6,A7
|
||||
:D,C7
|
||||
#
|
||||
|
|
|
@ -729,6 +729,34 @@ void DisplayText(void)
|
|||
cp += 1;
|
||||
}
|
||||
break;
|
||||
#ifdef USE_UFILESYS
|
||||
#ifdef USE_RAMFONT
|
||||
extern FS *ffsp;
|
||||
case 'F':
|
||||
{ char *ep = strchr(cp,':');
|
||||
if (ep) {
|
||||
static uint8_t *ram_font;
|
||||
*ep = 0;
|
||||
ep++;
|
||||
if (ffsp) {
|
||||
File fp;
|
||||
fp = ffsp->open(cp, "r");
|
||||
if (fp > 0) {
|
||||
uint32_t size = fp.size();
|
||||
if (ram_font) free (ram_font);
|
||||
ram_font = (uint8_t*)special_malloc(size+4);
|
||||
fp.read((uint8_t*)ram_font, size);
|
||||
fp.close();
|
||||
if (renderer) renderer->SetRamfont(ram_font);
|
||||
Serial.printf("Font loaded: %s\n",cp );
|
||||
}
|
||||
}
|
||||
cp = ep;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // USE_RAMFONT
|
||||
#endif // USE_UFILESYS
|
||||
case 'a':
|
||||
// rotation angle
|
||||
if (renderer) renderer->setRotation(*cp&3);
|
||||
|
|
Loading…
Reference in New Issue