Open Vitalij1967 opened 3 years ago
The library is super!
Thanks! I will do continue upgrading this repository.
It works fine but if you use a dynamic font (for example, a voltmeter, no refresh) Can fix in functions Static Void LCD_Char (int16_t x, int16_t y, const gfxglyph glyph, const gfxfont font, uint8_t size, uint32_t color24) thanks
Try LCD_Font(5, 100, "01.23", _64_Segment_7_Num, 1,TFT9341_WHITE); HAL_Delay(1000); LCD_Font(5, 100, "65.32", _64_Segment_7_Num, 1,TFT9341_WHITE); HAL_Delay(1000);
In _64_Segment_7_Num, there is no point(".") Can you add? Which font generator are you using?
Try LCD_Font(5, 100, "01.23", _64_Segment_7_Num, 1,TFT9341_WHITE); HAL_Delay(1000); LCD_Font(5, 100, "65.32", _64_Segment_7_Num, 1,TFT9341_WHITE); HAL_Delay(1000);
In _64_Segment_7_Num, there is no point(".") Can you add? Which font generator are you using?
Try this font generator http://oleddisplay.squix.ch/#/home Some fonts is ready here https://github.com/anothermist/DISPLAYS/tree/master/0_FONTS
Try this font generator http://oleddisplay.squix.ch/#/home Some fonts is ready here https://github.com/anothermist/DISPLAYS/tree/master/0_FONTS
thanks
Static text, excellent. Dynamic does not work. You try this code.
LCD_Font(5, 100, "01.23", _64_Segment_7_Num, 1,WHITE); HAL_Delay(1000); LCD_Font(5, 100, "65.32", _64_Segment_7_Num, 1,WHITE); HAL_Delay(1000);
Try this font generator http://oleddisplay.squix.ch/#/home Some fonts is ready here https://github.com/anothermist/DISPLAYS/tree/master/0_FONTS
thanks
Static text, excellent. Dynamic does not work. You try this code.
LCD_Font(5, 100, "01.23", _64_Segment_7_Num, 1,WHITE); HAL_Delay(1000); LCD_Font(5, 100, "65.32", _64_Segment_7_Num, 1,WHITE); HAL_Delay(1000);
Sorry, but I don't understand, what you mean "dynamic text". If you want just overwrite old text to new, you must save in variable old value and print this in background colour before printing updated text. Example here https://github.com/anothermist/STATION_SSD1963_F103C8T6/tree/main/00_STATION If you use ONLY(!) monospaced fonts, you can overwrite every symbol with empty space.
You can send me code to gmail (anothermist@...) or telegram @anothermist
There is no secret.
//----------------------------- UART -------------------------------------------------
// HAL_UART_Receive_DMA(&huart1, (uint8_t*) "Disconnected!", 14);
// HAL_Delay(100);
{
if(hdma_usart1_rx.State==HAL_DMA_STATE_READY)
HAL_Delay(100);//DelayMicro(100);
signalUs[13]=0;
HAL_UART_Receive_DMA(&huart1, (uint8_t*) signalUs, 13);
HAL_Delay(200);
if (strcmp ("Connect to PC", signalUs) == 0)
{
LCD_Font(50, 20, signalUs, _12_Serif_Bold_Italic, 1,WHITE);
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;
}
else
{
LCD_Font(50, 20, signalUs, _12_Serif_Bold_Italic, 1,GREEN); // Disconnected
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;
}
}
//------------------------------------------------------------------------------------------
There is no secret.
//----------------------------- UART ------------------------------------------------- // HAL_UART_Receive_DMA(&huart1, (uint8_t*) "Disconnected!", 14); // HAL_Delay(100); { if(hdma_usart1_rx.State==HAL_DMA_STATE_READY) HAL_Delay(100);//DelayMicro(100); signalUs[13]=0; HAL_UART_Receive_DMA(&huart1, (uint8_t*) signalUs, 13); HAL_Delay(200); if (strcmp ("Connect to PC", signalUs) == 0) { LCD_Font(50, 20, signalUs, _12_Serif_Bold_Italic, 1,WHITE); hdma_usart1_rx.State=HAL_DMA_STATE_BUSY; } else { LCD_Font(50, 20, signalUs, _12_Serif_Bold_Italic, 1,GREEN); // Disconnected hdma_usart1_rx.State=HAL_DMA_STATE_BUSY; } }
//------------------------------------------------------------------------------------------
In this code you don’t have any command to clear old text before writing new.
// BLACK – is background color, ORANGE – is text color. Printing float example with overwrite old text
float temperatureLast, temperature;
if (temperature != temperatureLast && temperature >= -40 && temperature <= 40) {
char weatherPrintT[4];
if (temperatureLast >= 10 || (temperatureLast < 0 && temperatureLast > -10)) {
sprintf(weatherPrintT, "%.1f", temperatureLast);
LCD_Font(705, 40, weatherPrintT, &DejaVu_Sans_36, 1, BLACK);
}
else if (temperatureLast < 10 && temperatureLast > 0) {
sprintf(weatherPrintT, "%.1f", temperatureLast);
LCD_Font(731, 40, weatherPrintT, &DejaVu_Sans_36, 1, BLACK);
}
else if (temperatureLast <= -10) {
sprintf(weatherPrintT, "%2d", (int8_t)temperatureLast);
LCD_Font(705, 40, weatherPrintT, &DejaVu_Sans_36, 1, BLACK);
}
if (temperature >= 10 || (temperature < 0 && temperature > -10)) {
sprintf(weatherPrintT, "%.1f", temperature);
LCD_Font(705, 40, weatherPrintT, &DejaVu_Sans_36, 1, ORANGE);
}
else if (temperature < 10 && temperature > 0) {
sprintf(weatherPrintT, "%.1f", temperature);
LCD_Font(731, 40, weatherPrintT, &DejaVu_Sans_36, 1, ORANGE);
}
else if (temperature <= -10) {
sprintf(weatherPrintT, "%2d", (int8_t)temperature);
LCD_Font(705, 40, weatherPrintT, &DejaVu_Sans_36, 1, ORANGE);
}
temperatureLast = temperature;
}
I found this code, but I can't figure out how to use it in my code.
char signalUs[15];
BackColor RED
I found this code, but I can't figure out how to use it in my code.
In your code you can just override old text with background colour
print Connected: LCD_Font(50, 20, "Disconnected", _12_Serif_Bold_Italic, 1, BACKCOLOR); LCD_Font(50, 20, "Connected", _12_Serif_Bold_Italic, 1, GREEN);
print Disconnected: LCD_Font(50, 20, "Connected", _12_Serif_Bold_Italic, 1, BACKCOLOR); LCD_Font(50, 20, "Disconnected", _12_Serif_Bold_Italic, 1, GREEN);
OR create array and use sprintf (a lot examples here https://github.com/anothermist/STATION_SSD1963_F103C8T6/blob/main/00_STATION/Src/main.c)
20210406_100752.mp4 Flicker
lol, can you add condition in code "if (printed now != current value) PRINT; else DONOTHING :)
if(hdma_usart1_rx.State==HAL_DMA_STATE_READY)
HAL_Delay(100);//DelayMicro(100);
signalUs[13]=0;
HAL_UART_Receive_DMA(&huart1, (uint8_t*) signalUs, 13);
HAL_Delay(200);
if (strcmp ("Connect to PC", signalUs) == 0)
{
LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, RED);
LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, WHITE);
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;
}
else
{
LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, RED);
LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, WHITE);
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;
}
I'm already confused
// if (strcmp ("Connect to PC", signalUs) == 0)
if ("Connect to PC"!= signalUs)
{
LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, RED);
LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, WHITE);
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;
}
else
{
LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, RED);
LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, WHITE);
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;
}
// if (strcmp ("Connect to PC", signalUs) == 0)
if ("Connect to PC"!= signalUs)
{
LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, RED);
LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, WHITE);
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;
}
else
{
/* LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, RED);
LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, WHITE);
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;*/
}
// if (strcmp ("Connect to PC", signalUs) == 0) if ("Connect to PC"!= signalUs) { LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, RED); LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, WHITE); hdma_usart1_rx.State=HAL_DMA_STATE_BUSY; } else { /* LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, RED); LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, WHITE); hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;*/ }
if (NEED_UPDATE) {
if (strcmp ("Connect to PC", signalUs) == 0)
{
LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, RED);
LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, WHITE);
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;
}
else
{
LCD_Font(50, 20, "Connected!", _12_Serif_Bold_Italic, 1, RED);
LCD_Font(50, 20, "Disconnected!", _12_Serif_Bold_Italic, 1, WHITE);
hdma_usart1_rx.State=HAL_DMA_STATE_BUSY;
}
} // else do nothing, don't print every 100ms one text if it's printed!
while (1) { // VoltMetter();
UARTConnect();
I have a display without a touchscreen, what should I change to make the display work? thanks