DiSlord remote screen update

Speed-test
erikkaashoek 4 years ago
parent 06392925f6
commit e51ca7c513

@ -610,8 +610,8 @@ void ili9341_fill(int x, int y, int w, int h)
#endif #endif
#ifdef __REMOTE_DESKTOP__ #ifdef __REMOTE_DESKTOP__
if (auto_capture) { if (auto_capture) {
send_region("fill", x, y, w, h); remote_region_t rd = {"fill\r\n", x, y, w, h};
send_buffer((uint8_t *)&background_color, sizeof(pixel_t)); send_region(&rd, (uint8_t *)&background_color, sizeof(pixel_t));
} }
#endif #endif
#if 1 #if 1
@ -632,8 +632,8 @@ static void ili9341_DMA_bulk(uint16_t x, uint16_t y, uint16_t w, uint16_t h, pix
#endif #endif
#ifdef __REMOTE_DESKTOP__ #ifdef __REMOTE_DESKTOP__
if (auto_capture) { if (auto_capture) {
send_region("bulk", x, y, w, h); remote_region_t rd = {"bulk\r\n", x, y, w, h};
send_buffer((uint8_t *)buffer, w *h * sizeof(pixel_t)); send_region(&rd, (uint8_t *)buffer, w * h * sizeof(pixel_t));
} }
#endif #endif
// while (SPI_IN_TX_RX(LCD_SPI)); // while (SPI_IN_TX_RX(LCD_SPI));

@ -82,7 +82,6 @@ static bool sweep(bool break_on_operation);
uint8_t sweep_mode = SWEEP_ENABLE; uint8_t sweep_mode = SWEEP_ENABLE;
uint16_t redraw_request = 0; // contains REDRAW_XXX flags uint16_t redraw_request = 0; // contains REDRAW_XXX flags
uint8_t auto_capture = false;
// Version text, displayed in Config->Version menu, also send by info command // Version text, displayed in Config->Version menu, also send by info command
const char *info_about[]={ const char *info_about[]={
BOARD_NAME, BOARD_NAME,
@ -699,6 +698,20 @@ VNA_SHELL_FUNCTION(cmd_dump)
#endif #endif
#ifdef __REMOTE_DESKTOP__ #ifdef __REMOTE_DESKTOP__
uint8_t remote_mouse_down = false;
uint8_t auto_capture = false;
void send_region(remote_region_t *rd, uint8_t * buf, uint16_t size)
{
if (SDU1.config->usbp->state == USB_ACTIVE) {
streamWrite(shell_stream, (void*) rd, sizeof(remote_region_t));
streamWrite(shell_stream, (void*) buf, size);
streamWrite(shell_stream, (void*)"ch> \r\n", 6);
}
else
auto_capture = false;
}
VNA_SHELL_FUNCTION(cmd_refresh) VNA_SHELL_FUNCTION(cmd_refresh)
{ {
// read pixel count at one time (PART*2 bytes required for read buffer) // read pixel count at one time (PART*2 bytes required for read buffer)
@ -708,27 +721,19 @@ VNA_SHELL_FUNCTION(cmd_refresh)
} }
} }
int16_t mouse_x = 0;
int16_t mouse_y = 0;
uint8_t mouse_down = false;
VNA_SHELL_FUNCTION(cmd_touch) VNA_SHELL_FUNCTION(cmd_touch)
{ {
if (argc == 2){ if (argc != 2) return;
mouse_x = my_atoi(argv[0]); touch_set(my_atoi(argv[0]), my_atoi(argv[1]));
mouse_y = my_atoi(argv[1]); remote_mouse_down = true;
mouse_down = true;
handle_touch_interrupt(); handle_touch_interrupt();
}
} }
VNA_SHELL_FUNCTION(cmd_release) VNA_SHELL_FUNCTION(cmd_release)
{ {
if (argc==2) { if (argc == 2)
mouse_x = my_atoi(argv[0]); touch_set(my_atoi(argv[0]), my_atoi(argv[1]));
mouse_y = my_atoi(argv[1]); remote_mouse_down = false;
}
mouse_down = false;
handle_touch_interrupt(); handle_touch_interrupt();
} }
#endif #endif
@ -757,35 +762,6 @@ VNA_SHELL_FUNCTION(cmd_capture)
} }
} }
void send_region(const char *t, int16_t x, int16_t y, int16_t w, int16_t h)
{
if (SDU1.config->usbp->state == USB_ACTIVE) {
shell_printf(t);
struct {
char new_str[2];
int16_t x;
int16_t y;
int16_t w;
int16_t h;
} region={"\r\n", x,y,w,h};
streamWrite(shell_stream, (void*)&region, sizeof(region));
}
else
auto_capture = false;
}
void send_buffer(uint8_t * buf, int s)
{
if (SDU1.config->usbp->state == USB_ACTIVE) {
while (s > 0) {
streamWrite(shell_stream, (void*) buf, (s > 128 ? 128 : s));
buf = buf+128;
s -= 128;
}
streamWrite(shell_stream, (void*)"ch> \r\n", 6);
}
}
#ifdef ENABLE_SD_CARD_CMD #ifdef ENABLE_SD_CARD_CMD
#ifndef __USE_SD_CARD__ #ifndef __USE_SD_CARD__
#error "Need enable SD card support __USE_SD_CARD__ in nanovna.h, for use ENABLE_SD_CARD_CMD" #error "Need enable SD card support __USE_SD_CARD__ in nanovna.h, for use ENABLE_SD_CARD_CMD"

@ -198,13 +198,6 @@ extern freq_t maxFreq;
extern const char TINYSA_VERSION[]; extern const char TINYSA_VERSION[];
#ifdef __REMOTE_DESKTOP__
extern uint8_t auto_capture;
extern int16_t mouse_x;
extern int16_t mouse_y;
extern uint8_t mouse_down;
#endif
#define MAX_FREQ_TYPE 5 #define MAX_FREQ_TYPE 5
enum stimulus_type { enum stimulus_type {
ST_START=0, ST_STOP, ST_CENTER, ST_SPAN, ST_CW, ST_DUMMY // Last is used in marker ops ST_START=0, ST_STOP, ST_CENTER, ST_SPAN, ST_CW, ST_DUMMY // Last is used in marker ops
@ -218,10 +211,20 @@ void my_microsecond_delay(int t);
float my_atof(const char *p); float my_atof(const char *p);
freq_t my_atoui(const char *p); freq_t my_atoui(const char *p);
int shell_printf(const char *fmt, ...); int shell_printf(const char *fmt, ...);
#ifdef __REMOTE_DESKTOP__ #ifdef __REMOTE_DESKTOP__
void send_region(const char *t, int16_t x, int16_t y, int16_t w, int16_t h); extern uint8_t remote_mouse_down;
void send_buffer(uint8_t * buf, int s); extern uint8_t auto_capture;
typedef struct {
char new_str[6];
int16_t x;
int16_t y;
int16_t w;
int16_t h;
} remote_region_t;
void send_region(remote_region_t *rd, uint8_t * buf, uint16_t size);
#endif #endif
void set_marker_frequency(int m, freq_t f); void set_marker_frequency(int m, freq_t f);
void set_marker_time(int m, float f); void set_marker_time(int m, float f);
void set_marker_index(int m, int16_t idx); void set_marker_index(int m, int16_t idx);
@ -1319,6 +1322,7 @@ void draw_menu(void);
void draw_menu_mask(uint32_t mask); void draw_menu_mask(uint32_t mask);
void refres_sweep_menu(void); void refres_sweep_menu(void);
int check_touched(void); int check_touched(void);
void touch_set(int16_t x, int16_t y);
int invoke_quick_menu(int); int invoke_quick_menu(int);
bool ui_process_listen_lever(void); bool ui_process_listen_lever(void);
void refresh_sweep_menu(int i); void refresh_sweep_menu(int i);

39
ui.c

@ -336,14 +336,9 @@ touch_check(void)
last_touch_y = y; last_touch_y = y;
} }
#ifdef __REMOTE_DESKTOP__ #ifdef __REMOTE_DESKTOP__
mouse_down = false; remote_mouse_down = false;
} } else {
if (!stat) { stat = remote_mouse_down;
stat = mouse_down;
if (mouse_down) {
last_touch_x = mouse_x;
last_touch_y = mouse_y;
}
#endif #endif
} }
if (stat != last_touch_status) { if (stat != last_touch_status) {
@ -357,6 +352,11 @@ touch_check(void)
//******************************************************************************* //*******************************************************************************
#endif // end SOFTWARE_TOUCH #endif // end SOFTWARE_TOUCH
void touch_set(int16_t x, int16_t y) {
last_touch_x = x;
last_touch_y = y;
}
void void
touch_wait_release(void) touch_wait_release(void)
{ {
@ -458,12 +458,14 @@ void
touch_position(int *x, int *y) touch_position(int *x, int *y)
{ {
#ifdef __REMOTE_DESKTOP__ #ifdef __REMOTE_DESKTOP__
*x = (mouse_down ? mouse_x : (last_touch_x - config.touch_cal[0]) * 16 / config.touch_cal[2]); if (remote_mouse_down) {
*y = (mouse_down ? mouse_y : (last_touch_y - config.touch_cal[1]) * 16 / config.touch_cal[3]); *x = last_touch_x;
#else *y = last_touch_y;
return;
}
#endif
*x = (last_touch_x - config.touch_cal[0]) * 16 / config.touch_cal[2]; *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]; *y = (last_touch_y - config.touch_cal[1]) * 16 / config.touch_cal[3];
#endif
} }
void void
@ -2278,11 +2280,6 @@ void ui_process_touch(void)
} }
static uint16_t previous_button_state = 0; static uint16_t previous_button_state = 0;
#ifdef __REMOTE_DESKTOP__
static uint16_t previous_mouse_state = 0;
static int16_t previous_mouse_x = 0;
static int16_t previous_mouse_y = 0;
#endif
void void
ui_process(void) ui_process(void)
@ -2292,16 +2289,12 @@ ui_process(void)
selection = -1; // hide keyboard mode selection selection = -1; // hide keyboard mode selection
ui_mode_menu(); ui_mode_menu();
} }
if (operation_requested&OP_LEVER || previous_button_state != button_state) { if ((operation_requested&OP_LEVER) || previous_button_state != button_state) {
ui_process_lever(); ui_process_lever();
previous_button_state = button_state; previous_button_state = button_state;
operation_requested = OP_NONE; operation_requested = OP_NONE;
} }
if (operation_requested&OP_TOUCH if (operation_requested&OP_TOUCH) {
#ifdef __REMOTE_DESKTOP__
|| previous_mouse_state != mouse_down || previous_mouse_x != mouse_x || previous_mouse_y != mouse_y
#endif
) {
ui_process_touch(); ui_process_touch();
operation_requested = OP_NONE; operation_requested = OP_NONE;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.