Update ili9341 init settings for get good gamma curve

Now colors gradient look perfect, so fix begin gradient color more darker
pull/4/head
DiSlord 6 years ago
parent fb44b7d2a3
commit ec40777f97

@ -283,12 +283,12 @@ static const uint8_t ili9341_init_seq[] = {
// display off
ILI9341_DISPLAY_OFF, 0,
// Power control B
ILI9341_POWERB, 3, 0x00, 0x83, 0x30,
ILI9341_POWERB, 3, 0x00, 0xC1, 0x30,
// Power on sequence control
ILI9341_POWER_SEQ, 4, 0x64, 0x03, 0x12, 0x81,
//ILI9341_POWER_SEQ, 4, 0x55, 0x01, 0x23, 0x01,
// Driver timing control A
ILI9341_DTCA, 3, 0x85, 0x01, 0x79,
ILI9341_DTCA, 3, 0x85, 0x00, 0x78,
//ILI9341_DTCA, 3, 0x84, 0x11, 0x7a,
// Power control A
ILI9341_POWERA, 5, 0x39, 0x2C, 0x00, 0x34, 0x02,
@ -297,9 +297,9 @@ static const uint8_t ili9341_init_seq[] = {
// Driver timing control B
ILI9341_DTCB, 2, 0x00, 0x00,
// POWER_CONTROL_1
ILI9341_POWER_CONTROL_1, 1, 0x26,
ILI9341_POWER_CONTROL_1, 1, 0x23,
// POWER_CONTROL_2
ILI9341_POWER_CONTROL_2, 1, 0x11,
ILI9341_POWER_CONTROL_2, 1, 0x10,
// VCOM_CONTROL_1
// ILI9341_VCOM_CONTROL_1, 2, 0x35, 0x3E,
ILI9341_VCOM_CONTROL_1, 2, 0x3e, 0x28,
@ -312,15 +312,15 @@ static const uint8_t ili9341_init_seq[] = {
// COLMOD_PIXEL_FORMAT_SET : 16 bit pixel
ILI9341_PIXEL_FORMAT_SET, 1, 0x55,
// Frame Rate
ILI9341_FRAME_RATE_CONTROL_1, 2, 0x00, 0x1B,
ILI9341_FRAME_RATE_CONTROL_1, 2, 0x00, 0x18,
// Gamma Function Disable
ILI9341_3GAMMA_EN, 1, 0x08,
ILI9341_3GAMMA_EN, 1, 0x00,
// gamma set for curve 01/2/04/08
ILI9341_GAMMA_SET, 1, 0x01,
// positive gamma correction
ILI9341_POSITIVE_GAMMA_CORRECTION, 15, 0x1F, 0x1A, 0x18, 0x0A, 0x0F, 0x06, 0x45, 0x87, 0x32, 0x0A, 0x07, 0x02, 0x07, 0x05, 0x00,
ILI9341_POSITIVE_GAMMA_CORRECTION, 15, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00,
// negativ gamma correction
ILI9341_NEGATIVE_GAMMA_CORRECTION, 15, 0x00, 0x25, 0x27, 0x05, 0x10, 0x09, 0x3A, 0x78, 0x4D, 0x05, 0x18, 0x0D, 0x38, 0x3A, 0x1F,
ILI9341_NEGATIVE_GAMMA_CORRECTION, 15, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F,
// Column Address Set
//ILI9341_COLUMN_ADDRESS_SET, 4, 0x00, 0x00, 0x01, 0x3f, // width 320
// Page Address Set
@ -328,7 +328,7 @@ ILI9341_NEGATIVE_GAMMA_CORRECTION, 15, 0x00, 0x25, 0x27, 0x05, 0x10, 0x09,
// entry mode
ILI9341_ENTRY_MODE_SET, 1, 0x06,
// display function control
ILI9341_DISPLAY_FUNCTION_CONTROL, 4, 0x0A, 0x82, 0x27, 0x00,
ILI9341_DISPLAY_FUNCTION_CONTROL, 3, 0x08, 0x82, 0x27,
// Interface Control (set WEMODE=0)
ILI9341_INTERFACE_CONTROL, 3, 0x00, 0x00, 0x00,
// control display

@ -1598,12 +1598,6 @@ draw_all_cells(bool flush_markmap)
// clear map for next plotting
clear_markmap();
}
// START_PROFILE
#ifdef __SCROLL__
if (waterfall)
update_waterfall();
#endif
// STOP_PROFILE
}
void
@ -1613,8 +1607,15 @@ draw_all(bool flush)
force_set_markmap();
if (redraw_request & REDRAW_MARKER)
markmap_upperarea();
if (redraw_request & (REDRAW_CELLS | REDRAW_MARKER | REDRAW_AREA))
if (redraw_request & (REDRAW_CELLS | REDRAW_MARKER | REDRAW_AREA)){
draw_all_cells(flush);
#ifdef __SCROLL__
// START_PROFILE
if (waterfall)
update_waterfall();
// STOP_PROFILE
#endif
}
if (redraw_request & (REDRAW_CAL_STATUS | REDRAW_FREQUENCY) )
draw_cal_status(); // calculates the actual sweep time, must be before draw_frequencies
if (redraw_request & REDRAW_FREQUENCY)
@ -2219,7 +2220,7 @@ static void update_waterfall(void){
uint16_t y = CELL_Y(index[i]); // should be always in range 0 - HEIGHT_SCROLL
// Calculate gradient palette for range 0 .. 192
// idx r g b
// 0 - 192 0 0
// 0 - 127 0 0
// 32 - 255 127 0
// 64 - 255 255 127
// 96 - 255 255 255
@ -2227,8 +2228,8 @@ static void update_waterfall(void){
// 160 - 0 127 255
// 192 - 0 0 127
// 224 - 0 0 0
// y = (uint8_t)i; // for test
if (y < 32) color = RGB565( 192+((y- 0)*2), 0+((y- 0)*4), 0);
y = (uint8_t)i; // for test
if (y < 32) color = RGB565( 127+((y- 0)*4), 0+((y- 0)*4), 0);
else if (y < 64) color = RGB565( 255, 127+((y- 32)*4), 0+((y- 32)*4));
else if (y < 96) color = RGB565( 255, 255, 127+((y- 64)*4));
else if (y < 128) color = RGB565( 252-((y- 96)*4), 255, 255);

Loading…
Cancel
Save

Powered by TurnKey Linux.