Rotate display added

pull/29/head
erikkaashoek 4 years ago
parent 369342fcd3
commit 06caa0d4f6

@ -620,6 +620,12 @@ void ili9341_fill(int x, int y, int w, int h)
// while (SPI_IN_TX_RX(LCD_SPI));
}
void ili9341_flip(bool flip) {
uint8_t memAcc = flip ? DISPLAY_ROTATION_180 : DISPLAY_ROTATION_0;
send_command(ILI9341_MEMORY_ACCESS_CONTROL, 1, &memAcc);
}
static void ili9341_DMA_bulk(uint16_t x, uint16_t y, uint16_t w, uint16_t h, pixel_t *buffer){
#if 1
ili9341_setWindow(x, y ,w, h);

@ -1906,7 +1906,7 @@ static const VNAShellCommand commands[] =
{"recall" , cmd_recall , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD},
{"trace" , cmd_trace , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD},
{"trigger" , cmd_trigger , CMD_RUN_IN_LOAD},
{"marker" , cmd_marker , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD},
{"marker" , cmd_marker , CMD_RUN_IN_LOAD},
#ifdef ENABLE_USART_COMMAND
{"usart" , cmd_usart , CMD_WAIT_MUTEX},
{"usart_cfg" , cmd_usart_cfg , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD},
@ -2227,7 +2227,7 @@ static void VNAShell_executeLine(char *line)
if (scp) {
if (scp->flags & CMD_WAIT_MUTEX) {
shell_function = scp->sc_function;
operation_requested|=OP_CONSOLE;
operation_requested|=OP_CONSOLE; // this will abort current sweep to give priority to the new request
// Wait execute command in sweep thread
do {
osalThreadSleepMilliseconds(10);

@ -713,6 +713,7 @@ typedef struct config {
int8_t cor_nfm;
uint8_t _brightness;
uint8_t high_out_adf4350;
uint8_t flip;
#ifdef __ULTRA__
uint8_t direct;
#endif
@ -994,6 +995,7 @@ void ili9341_init(void);
void ili9341_test(int mode);
void ili9341_bulk(int x, int y, int w, int h); // send data to display, in DMA mode use it, but wait DMA complete
void ili9341_fill(int x, int y, int w, int h);
void ili9341_flip(bool flip);
// Double buffer mode parser
#if DISPLAY_CELL_BUFFER_COUNT == 1

15
ui.c

@ -385,6 +385,8 @@ void
touch_cal_exec(void)
{
int x1, x2, y1, y2;
int old_flip = config.flip;
config.flip = 0;
ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_clear_screen();
@ -413,6 +415,8 @@ touch_cal_exec(void)
config.touch_cal[2] = (x2 - x1) * 16 / LCD_WIDTH;
config.touch_cal[3] = (y2 - y1) * 16 / LCD_HEIGHT;
config.flip = old_flip;
config_save(); // Auto save touch calibration
//redraw_all();
@ -466,8 +470,15 @@ touch_position(int *x, int *y)
return;
}
#endif
*x = (last_touch_x - config.touch_cal[0]) * 16 / config.touch_cal[2];
*y = (last_touch_y - config.touch_cal[1]) * 16 / config.touch_cal[3];
int tx = (last_touch_x - config.touch_cal[0]) * 16 / config.touch_cal[2];
int ty = (last_touch_y - config.touch_cal[1]) * 16 / config.touch_cal[3];
if (config.flip) {
tx = LCD_WIDTH - 1 - tx;
ty = LCD_HEIGHT - 1 - ty;
}
*x = tx;
*y = ty;
}
void

@ -2234,6 +2234,19 @@ static UI_FUNCTION_ADV_CALLBACK(menu_pause_acb)
// draw_cal_status();
}
static UI_FUNCTION_ADV_CALLBACK(menu_flip_acb)
{
(void) data;
(void) item;
if (b){
return;
}
config.flip = ! config.flip;
ili9341_flip(config.flip);
config_save();
redraw_request|= REDRAW_AREA | REDRAW_FREQUENCY | REDRAW_CAL_STATUS;
}
static UI_FUNCTION_ADV_CALLBACK(menu_shift_acb)
{
(void) data;
@ -2988,6 +3001,7 @@ static const menuitem_t menu_display[] = {
{ MT_KEYPAD, KM_SWEEP_TIME, "SWEEP\nTIME", "0..600s, 0=disable"}, // This must be item 3 to match highlighting
{ MT_SUBMENU, 0, "SWEEP\nPOINTS", menu_sweep_points},
{ MT_SUBMENU, 0, "SWEEP\nACCURACY", menu_sweep_speed},
{ MT_ADV_CALLBACK,0, "ROTATE\nDISPLAY", menu_flip_acb},
//#ifdef __REMOTE_DESKTOP__
// { MT_ADV_CALLBACK,0, "SEND\nDISPLAY", menu_send_display_acb},
//#endif

Loading…
Cancel
Save

Powered by TurnKey Linux.