Remote control working

Removed_REF_marker
erikkaashoek 5 years ago
parent e4587197f5
commit 3191fccaad

@ -48,7 +48,7 @@
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#define CH_CFG_ST_FREQUENCY 2000 #define CH_CFG_ST_FREQUENCY 10000
/** /**
* @brief Time delta constant for the tick-less mode. * @brief Time delta constant for the tick-less mode.

@ -469,6 +469,12 @@ void ili9341_fill(int x, int y, int w, int h)
dmaStreamSetMemory0(dmatx, &background_color); dmaStreamSetMemory0(dmatx, &background_color);
dmaStreamSetMode(dmatx, txdmamode | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD); dmaStreamSetMode(dmatx, txdmamode | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD);
dmaStreamFlush(w * h); dmaStreamFlush(w * h);
if (auto_capture) {
send_region("fill", x,y,w,h);
spi_buffer[0] = background_color;
send_buffer((uint8_t *)spi_buffer, 2);
// auto_capture = false;
}
// LCD_CS_HIGH; // LCD_CS_HIGH;
} }
@ -483,6 +489,13 @@ void ili9341_bulk(int x, int y, int w, int h)
dmaStreamSetMode(dmatx, txdmamode | STM32_DMA_CR_PSIZE_HWORD | dmaStreamSetMode(dmatx, txdmamode | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_MINC); STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_MINC);
dmaStreamFlush(w * h); dmaStreamFlush(w * h);
#if 1
if (auto_capture) {
send_region("bulk", x,y,w,h);
send_buffer((uint8_t *)spi_buffer, w*h*2);
// auto_capture = false;
}
#endif
// LCD_CS_HIGH; // LCD_CS_HIGH;
} }
#endif #endif

@ -106,6 +106,7 @@ static int8_t drive_strength = DRIVE_STRENGTH_AUTO;
#endif #endif
uint8_t sweep_mode = SWEEP_ENABLE; uint8_t sweep_mode = SWEEP_ENABLE;
volatile uint8_t redraw_request = 0; // contains REDRAW_XXX flags volatile uint8_t redraw_request = 0; // contains REDRAW_XXX flags
volatile int 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[]={
@ -124,7 +125,6 @@ const char *info_about[]={
}; };
uint16_t dirty = true; uint16_t dirty = true;
bool completed = false; bool completed = false;
static THD_WORKING_AREA(waThread1, 1124); static THD_WORKING_AREA(waThread1, 1124);
@ -806,12 +806,51 @@ VNA_SHELL_FUNCTION(cmd_dump)
} }
#endif #endif
VNA_SHELL_FUNCTION(cmd_refresh)
{
// read pixel count at one time (PART*2 bytes required for read buffer)
int i, y;
int m = generic_option_cmd("refresh", "off|on", argc, argv[0]);
if (m>=0) {
auto_capture = m;
}
}
volatile int mouse_x = 0;
volatile int mouse_y = 0;
volatile int mouse_down = false;
VNA_SHELL_FUNCTION(cmd_touch)
{
if (argc == 2){
mouse_x = (uint32_t)my_atoi(argv[0]);
mouse_y = (uint32_t)my_atoi(argv[1]);
mouse_down = true;
handle_touch_interrupt();
}
}
VNA_SHELL_FUNCTION(cmd_release)
{
if (argc==2) {
mouse_x = (uint32_t)my_atoi(argv[0]);
mouse_y = (uint32_t)my_atoi(argv[1]);
}
mouse_down = false;
handle_touch_interrupt();
}
VNA_SHELL_FUNCTION(cmd_capture) VNA_SHELL_FUNCTION(cmd_capture)
{ {
// 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)
(void)argc;
(void)argv;
int i, y; int i, y;
#if 0
int m = generic_option_cmd("capture", "off|on", argc, argv[0]);
if (m>=0) {
auto_capture = m;
return;
}
#endif
#if SPI_BUFFER_SIZE < (2*LCD_WIDTH) #if SPI_BUFFER_SIZE < (2*LCD_WIDTH)
#error "Low size of spi_buffer for cmd_capture" #error "Low size of spi_buffer for cmd_capture"
#endif #endif
@ -826,6 +865,26 @@ VNA_SHELL_FUNCTION(cmd_capture)
} }
} }
void send_region(const char *t, int x, int y, int w, int h)
{
shell_printf("%s\r\n", t);
streamPut(shell_stream, (((uint16_t) x) & 0xff));
streamPut(shell_stream, (((uint16_t)x>>8) & 0xff));
streamPut(shell_stream, (((uint16_t) y) & 0xff));
streamPut(shell_stream, (((uint16_t)y>>8) & 0xff));
streamPut(shell_stream, (((uint16_t) w) & 0xff));
streamPut(shell_stream, (((uint16_t)w>>8) & 0xff));
streamPut(shell_stream, (((uint16_t) h) & 0xff));
streamPut(shell_stream, (((uint16_t)h>>8) & 0xff));
}
void send_buffer(uint8_t * buf, int s)
{
for (int i = 0; i < s; i++) {
streamPut(shell_stream, *buf++);
}
shell_printf("ch> \r\n");
}
#if 0 #if 0
VNA_SHELL_FUNCTION(cmd_gamma) VNA_SHELL_FUNCTION(cmd_gamma)
{ {
@ -2385,6 +2444,10 @@ static const VNAShellCommand commands[] =
{"edelay" , cmd_edelay , 0}, {"edelay" , cmd_edelay , 0},
#endif #endif
{"capture" , cmd_capture , CMD_WAIT_MUTEX}, {"capture" , cmd_capture , CMD_WAIT_MUTEX},
{"refresh" , cmd_refresh , 0},
{"touch" , cmd_touch , 0},
{"release" , cmd_release , 0},
{"vbat" , cmd_vbat , CMD_WAIT_MUTEX}, // Uses same adc as touch!!!!! {"vbat" , cmd_vbat , CMD_WAIT_MUTEX}, // Uses same adc as touch!!!!!
#ifdef ENABLE_VBAT_OFFSET_COMMAND #ifdef ENABLE_VBAT_OFFSET_COMMAND
{"vbat_offset" , cmd_vbat_offset , 0}, {"vbat_offset" , cmd_vbat_offset , 0},

@ -98,6 +98,11 @@ typedef float measurement_t[TRACES_MAX][POINTS_COUNT];
extern measurement_t measured; extern measurement_t measured;
#endif #endif
extern volatile int auto_capture;
extern volatile int mouse_x;
extern volatile int mouse_y;
extern volatile int mouse_down;
#ifdef __VNA__ #ifdef __VNA__
// Minimum frequency set // Minimum frequency set
#define START_MIN 50000 #define START_MIN 50000
@ -167,6 +172,8 @@ uint32_t get_sweep_frequency(int type);
void my_microsecond_delay(int t); void my_microsecond_delay(int t);
float my_atof(const char *p); float my_atof(const char *p);
int shell_printf(const char *fmt, ...); int shell_printf(const char *fmt, ...);
void send_region(const char *t, int x, int y, int w, int h);
void send_buffer(uint8_t * buf, int s);
void set_marker_frequency(int m, uint32_t f); void set_marker_frequency(int m, uint32_t f);
void toggle_sweep(void); void toggle_sweep(void);
@ -307,6 +314,8 @@ void set_measurement(int);
//extern int setting.step_delay; //extern int setting.step_delay;
void sweep_remote(void); void sweep_remote(void);
extern void set_modulo(uint32_t f); extern void set_modulo(uint32_t f);
extern int generic_option_cmd( const char *cmd, const char *cmd_list, int argc, char *argv);
#ifdef __AUDIO__ #ifdef __AUDIO__
/* /*
* dsp.c * dsp.c

@ -1762,30 +1762,23 @@ search_maximum(int m, uint32_t center, int span)
//static const unsigned int spur_alternate_IF = DEFAULT_SPUR_IF; // if the frequency is found in the spur table use this IF frequency //static const unsigned int spur_alternate_IF = DEFAULT_SPUR_IF; // if the frequency is found in the spur table use this IF frequency
static const uint32_t spur_table[] = // Frequencies to avoid static const uint32_t spur_table[] = // Frequencies to avoid
{ {
117716000, // 117716000,
243775000, 243775000, // OK
// 244250000, // 244250000,
325000000, 325000000, // Not OK
// 325190000, // 325190000,
487541650, // This is linked to the MODULO of the ADF4350 487541650, // OK This is linked to the MODULO of the ADF4350
// 487993000, // 487993000,
// 488020700, // 488020700,
// 487551700, // 487551700,
// 487578000, // 487578000,
// 488500000, // 488500000,
650700000, 650687000, // OK
// 651333333, // 651333333,
732750000, 731780000, // OK
746083000 // 746083000
/*
* 144.3
* 159
* 209.8 30MHz
* 239.8
* 269.9 30MHz?
*/
// 1956000000,
#if 0 #if 0
// 580000, // 433.8 MHz table // 580000, // 433.8 MHz table
// 880000, //? // 880000, //?

24
ui.c

@ -312,6 +312,14 @@ touch_check(void)
last_touch_x = x; last_touch_x = x;
last_touch_y = y; last_touch_y = y;
} }
mouse_down = false;
}
if (!stat) {
stat = mouse_down;
if (mouse_down) {
last_touch_x = mouse_x;
last_touch_y = mouse_y;
}
} }
#if 0 // Long press detection #if 0 // Long press detection
systime_t ticks = chVTGetSystemTimeX(); systime_t ticks = chVTGetSystemTimeX();
@ -420,12 +428,15 @@ touch_draw_test(void)
do { do {
if (touch_check() == EVT_TOUCH_PRESSED){ if (touch_check() == EVT_TOUCH_PRESSED){
touch_position(&x0, &y0); touch_position(&x0, &y0);
ili9341_line(x0, y0, x0, y0);
do { do {
chThdSleepMilliseconds(50); chThdSleepMilliseconds(50);
touch_position(&x1, &y1); touch_position(&x1, &y1);
if (x0!= x1 || y0 != y1) {
ili9341_line(x0, y0, x1, y1); ili9341_line(x0, y0, x1, y1);
x0 = x1; x0 = x1;
y0 = y1; y0 = y1;
}
} while (touch_check() != EVT_TOUCH_RELEASED); } while (touch_check() != EVT_TOUCH_RELEASED);
} }
}while (!(btn_check() & EVT_BUTTON_SINGLE_CLICK)); }while (!(btn_check() & EVT_BUTTON_SINGLE_CLICK));
@ -436,8 +447,8 @@ touch_draw_test(void)
void void
touch_position(int *x, int *y) touch_position(int *x, int *y)
{ {
*x = (last_touch_x - config.touch_cal[0]) * 16 / config.touch_cal[2]; *x = (mouse_down ? mouse_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 = (mouse_down ? mouse_y : (last_touch_y - config.touch_cal[1]) * 16 / config.touch_cal[3]);
} }
@ -2862,6 +2873,9 @@ void ui_process_touch(void)
} }
static int previous_button_state = 0; static int previous_button_state = 0;
static int previous_mouse_state = 0;
static int previous_mouse_x = 0;
static int previous_mouse_y = 0;
void void
ui_process(void) ui_process(void)
@ -2874,11 +2888,13 @@ ui_process(void)
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;
if (operation_requested&OP_TOUCH) } else if (operation_requested&OP_TOUCH || previous_mouse_state != mouse_down || previous_mouse_x != mouse_x || previous_mouse_y != mouse_y) {
ui_process_touch(); ui_process_touch();
previous_mouse_state = mouse_down;
operation_requested = OP_NONE; operation_requested = OP_NONE;
} }
}
/* Triggered when the button is pressed or released. The LED4 is set to ON.*/ /* Triggered when the button is pressed or released. The LED4 is set to ON.*/
static void extcb1(EXTDriver *extp, expchannel_t channel) static void extcb1(EXTDriver *extp, expchannel_t channel)

@ -971,10 +971,10 @@ static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb)
kp_help_text = "Modulation frequency, 3 .. 10 kHz"; kp_help_text = "Modulation frequency, 3 .. 10 kHz";
ui_mode_keypad(KM_SPAN); ui_mode_keypad(KM_SPAN);
ui_process_keypad(); ui_process_keypad();
if (uistat.value < 3000) // if (uistat.value < 3000)
break; // break;
span = uistat.value; span = uistat.value;
set_sweep_frequency(ST_SPAN, 50000); // 100kHz set_sweep_frequency(ST_SPAN, span * 10);
// update_frequencies(); // To ensure markers are positioned right!!!!!! // update_frequencies(); // To ensure markers are positioned right!!!!!!
set_measurement(M_AM); set_measurement(M_AM);
set_marker_frequency(0, center); set_marker_frequency(0, center);
@ -1402,6 +1402,22 @@ static UI_FUNCTION_ADV_CALLBACK(menu_pause_acb)
// draw_cal_status(); // draw_cal_status();
} }
static UI_FUNCTION_ADV_CALLBACK(menu_send_display_acb)
{
(void) data;
(void) item;
if (b){
b->icon = auto_capture ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
return;
}
auto_capture = ! auto_capture;
// menu_move_back();
// ui_mode_normal();
draw_menu();
// draw_cal_status();
}
static UI_FUNCTION_ADV_CALLBACK(menu_outputmode_acb) static UI_FUNCTION_ADV_CALLBACK(menu_outputmode_acb)
{ {
(void) data; (void) data;
@ -1991,6 +2007,7 @@ static const menuitem_t menu_display[] = {
{ MT_ADV_CALLBACK,3, "NORMALIZE", menu_storage_acb}, { MT_ADV_CALLBACK,3, "NORMALIZE", menu_storage_acb},
{ MT_ADV_CALLBACK,4, "WATER\nFALL", menu_waterfall_acb}, { MT_ADV_CALLBACK,4, "WATER\nFALL", menu_waterfall_acb},
{ MT_SUBMENU, 0, "SWEEP\nSETTINGS", menu_sweep_speed}, { MT_SUBMENU, 0, "SWEEP\nSETTINGS", menu_sweep_speed},
{ MT_ADV_CALLBACK,0, "SEND\nDISPLAY", menu_send_display_acb},
// { MT_KEYPAD, KM_SWEEP_TIME, "SWEEP\nTIME", NULL}, // { MT_KEYPAD, KM_SWEEP_TIME, "SWEEP\nTIME", NULL},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_CANCEL, 0, S_LARROW" BACK", NULL },

Loading…
Cancel
Save

Powered by TurnKey Linux.