Merge branch 'master' into tinySA-V4-SI4463

Removed_REF_marker
erikkaashoek 5 years ago
commit c2ce6e10c9

@ -413,14 +413,18 @@ void ili9341_init(void)
LCD_CS_HIGH;
}
void ili9341_bulk_8bit(int x, int y, int w, int h, uint16_t *palette)
{
static void ili9341_setWindow(int x, int y, int w, int h){
//uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
//uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint32_t xx = __REV16(x | ((x + w - 1) << 16));
uint32_t yy = __REV16(y | ((y + h - 1) << 16));
send_command(ILI9341_COLUMN_ADDRESS_SET, 4, (uint8_t *)&xx);
send_command(ILI9341_PAGE_ADDRESS_SET, 4, (uint8_t *)&yy);
}
void ili9341_bulk_8bit(int x, int y, int w, int h, uint16_t *palette)
{
ili9341_setWindow(x, y ,w, h);
send_command(ILI9341_MEMORY_WRITE, 0, NULL);
uint8_t *buf = (uint8_t *)spi_buffer;
@ -433,12 +437,7 @@ void ili9341_bulk_8bit(int x, int y, int w, int h, uint16_t *palette)
#ifndef __USE_DISPLAY_DMA__
void ili9341_fill(int x, int y, int w, int h, uint16_t color)
{
//uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
//uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint32_t xx = __REV16(x | ((x + w - 1) << 16));
uint32_t yy = __REV16(y | ((y + h - 1) << 16));
send_command(ILI9341_COLUMN_ADDRESS_SET, 4, (uint8_t*)&xx);
send_command(ILI9341_PAGE_ADDRESS_SET, 4, (uint8_t*)&yy);
ili9341_setWindow(x, y ,w, h);
send_command(ILI9341_MEMORY_WRITE, 0, NULL);
int32_t len = w * h;
while (len-- > 0)
@ -448,13 +447,7 @@ void ili9341_fill(int x, int y, int w, int h, uint16_t color)
void ili9341_bulk(int x, int y, int w, int h)
{
//uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
//uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint16_t *buf = spi_buffer;
uint32_t xx = __REV16(x | ((x + w - 1) << 16));
uint32_t yy = __REV16(y | ((y + h - 1) << 16));
send_command(ILI9341_COLUMN_ADDRESS_SET, 4, (uint8_t *)&xx);
send_command(ILI9341_PAGE_ADDRESS_SET, 4, (uint8_t*)&yy);
ili9341_setWindow(x, y ,w, h);
send_command(ILI9341_MEMORY_WRITE, 0, NULL);
int32_t len = w * h;
while (len-- > 0)
@ -466,17 +459,12 @@ void ili9341_bulk(int x, int y, int w, int h)
// Use DMA for send data
//
// Fill region by some color
void ili9341_fill(int x, int y, int w, int h, uint16_t color)
void ili9341_fill(int x, int y, int w, int h)
{
//uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
//uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint32_t xx = __REV16(x | ((x + w - 1) << 16));
uint32_t yy = __REV16(y | ((y + h - 1) << 16));
send_command(ILI9341_COLUMN_ADDRESS_SET, 4, (uint8_t *)&xx);
send_command(ILI9341_PAGE_ADDRESS_SET, 4, (uint8_t *)&yy);
ili9341_setWindow(x, y ,w, h);
send_command(ILI9341_MEMORY_WRITE, 0, NULL);
dmaStreamSetMemory0(dmatx, &color);
dmaStreamSetMemory0(dmatx, &background_color);
dmaStreamSetMode(dmatx, txdmamode | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD);
dmaStreamFlush(w * h);
// LCD_CS_HIGH;
@ -485,10 +473,7 @@ void ili9341_fill(int x, int y, int w, int h, uint16_t color)
// Copy spi_buffer to region
void ili9341_bulk(int x, int y, int w, int h)
{
uint32_t xx = __REV16(x | ((x + w - 1) << 16));
uint32_t yy = __REV16(y | ((y + h - 1) << 16));
send_command(ILI9341_COLUMN_ADDRESS_SET, 4, (uint8_t *)&xx);
send_command(ILI9341_PAGE_ADDRESS_SET, 4, (uint8_t *)&yy);
ili9341_setWindow(x, y ,w, h);
send_command(ILI9341_MEMORY_WRITE, 0, NULL);
// Init Tx DMA mem->spi, set size, mode (spi and mem data size is 16 bit)
@ -504,12 +489,7 @@ void ili9341_bulk(int x, int y, int w, int h)
void ili9341_read_memory(int x, int y, int w, int h, int len, uint16_t *out)
{
//uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
//uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint32_t xx = __REV16(x | ((x + w - 1) << 16));
uint32_t yy = __REV16(y | ((y + h - 1) << 16));
send_command(ILI9341_COLUMN_ADDRESS_SET, 4, (uint8_t *)&xx);
send_command(ILI9341_PAGE_ADDRESS_SET, 4, (uint8_t*)&yy);
ili9341_setWindow(x, y ,w, h);
send_command(ILI9341_MEMORY_READ, 0, NULL);
// Skip data from rx buffer
spi_DropRx();
@ -575,20 +555,24 @@ void ili9341_read_memory(int x, int y, int w, int h, int len, uint16_t *out)
void ili9341_clear_screen(void)
{
ili9341_fill(0, 0, ILI9341_WIDTH, ILI9341_HEIGHT, background_color);
ili9341_fill(0, 0, ILI9341_WIDTH, ILI9341_HEIGHT);
}
#ifndef ili9341_set_foreground
void ili9341_set_foreground(uint16_t fg)
void ili9341_set_foreground(uint16_t fg_idx)
{
foreground_color = fg;
if (fg_idx >= 32)
foreground_color = fg_idx;
else
foreground_color = GET_PALTETTE_COLOR(fg_idx);
}
#endif
#ifndef ili9341_set_background
void ili9341_set_background(uint16_t bg)
void ili9341_set_background(uint16_t bg_idx)
{
background_color = bg;
// if (bg_idx >= 32) bg_idx = 0;
background_color = GET_PALTETTE_COLOR(bg_idx);
}
#endif
@ -742,7 +726,7 @@ void ili9341_line(int x0, int y0, int x1, int y1)
if (e2 < dy) { err += dx; y0 += sy; }
}
#endif
SWAP(foreground_color, background_color);
if (x0 > x1) {
SWAP(x0, x1);
SWAP(y0, y1);
@ -767,12 +751,13 @@ void ili9341_line(int x0, int y0, int x1, int y1)
}
}
if (dy > 0)
ili9341_fill(x0, y0, dx, dy, foreground_color);
ili9341_fill(x0, y0, dx, dy);
else
ili9341_fill(x0, y0+dy, dx, -dy, foreground_color);
ili9341_fill(x0, y0+dy, dx, -dy);
x0 += dx;
y0 += dy;
}
SWAP(foreground_color, background_color);
}
#if 0

@ -860,11 +860,6 @@ usage:
config_t config = {
.magic = CONFIG_MAGIC,
.dac_value = 1922,
.grid_color = DEFAULT_GRID_COLOR,
.ham_color = DEFAULT_HAM_COLOR,
.menu_normal_color = DEFAULT_MENU_COLOR,
.menu_active_color = DEFAULT_MENU_ACTIVE_COLOR,
.trace_color = { DEFAULT_TRACE_1_COLOR, DEFAULT_TRACE_2_COLOR, DEFAULT_TRACE_3_COLOR},
// .touch_cal = { 693, 605, 124, 171 }, // 2.4 inch LCD panel
// .touch_cal = { 347, 495, 160, 205 }, // 2.8 inch LCD panel
.touch_cal = { 261, 605, 115, 146 }, // 4 inch panel
@ -873,6 +868,7 @@ config_t config = {
#ifdef __VNA__
.harmonic_freq_threshold = 300000000,
#endif
.lcd_palette = LCD_DEFAULT_PALETTE,
.vbat_offset = 500,
.frequency_IF2 = 2048600000,
.setting_frequency_10mhz = 1000015.0,
@ -904,7 +900,7 @@ static const marker_t def_markers[MARKERS_MAX] = {
};
// Load propeties default settings
void load_default_properties(void)
void load_LCD_properties(void)
{
//Magic add on caldata_save
//current_props.magic = CONFIG_MAGIC;
@ -2235,43 +2231,19 @@ VNA_SHELL_FUNCTION(cmd_color)
int i;
if (argc != 2) {
shell_printf("usage: color {id} {rgb24}\r\n");
for (i=-3; i < TRACES_MAX; i++) {
#if 0
switch(i) {
case -3: color = config.grid_color; break;
case -2: color = config.menu_normal_color; break;
case -1: color = config.menu_active_color; break;
default: color = config.trace_color[i];break;
}
#else
// WARNING!!! Dirty hack for size, depend from config struct
color = config.trace_color[i];
#endif
color = ((color >> 3) & 0x001c00) |
((color >> 5) & 0x0000f8) |
((color << 16) & 0xf80000) |
((color << 13) & 0x00e000);
// color = (color>>8)|(color<<8);
// color = ((color<<8)&0xF80000)|((color<<5)&0x00FC00)|((color<<3)&0x0000F8);
shell_printf(" %d: 0x%06x\r\n", i, color);
for (i=0; i < MAX_PALETTE; i++) {
color = GET_PALTETTE_COLOR(i);
color = HEXRGB(color);
shell_printf(" %2d: 0x%06x\r\n", i, color);
}
return;
}
i = my_atoi(argv[0]);
if (i < -3 && i >= TRACES_MAX)
if (i >= MAX_PALETTE)
return;
color = RGBHEX(my_atoui(argv[1]));
#if 0
switch(i) {
case -3: config.grid_color = color; break;
case -2: config.menu_normal_color = color; break;
case -1: config.menu_active_color = color; break;
default: config.trace_color[i] = color;break;
}
#else
// WARNING!!! Dirty hack for size, depend from config struct
config.trace_color[i] = color;
#endif
config.lcd_palette[i] = color;
// Redraw all
redraw_request|= REDRAW_AREA;
}
@ -2370,8 +2342,8 @@ static const VNAShellCommand commands[] =
{"test" , cmd_test , 0},
{"touchcal" , cmd_touchcal , CMD_WAIT_MUTEX},
{"touchtest" , cmd_touchtest , CMD_WAIT_MUTEX},
{"pause" , cmd_pause , 0},
{"resume" , cmd_resume , 0},
{"pause" , cmd_pause , CMD_WAIT_MUTEX},
{"resume" , cmd_resume , CMD_WAIT_MUTEX},
{"caloutput" , cmd_caloutput , 0},
#ifdef __VNA__
{"cal" , cmd_cal , CMD_WAIT_MUTEX},
@ -2411,7 +2383,7 @@ static const VNAShellCommand commands[] =
{ "levelchange", cmd_levelchange, 0 },
{ "modulation", cmd_modulation, 0 },
{ "rbw", cmd_rbw, 0 },
{ "mode", cmd_mode, 0 },
{ "mode", cmd_mode, CMD_WAIT_MUTEX },
{ "spur", cmd_spur, 0 },
{ "load", cmd_load, 0 },
{ "offset", cmd_offset, 0},
@ -2735,7 +2707,7 @@ static UARTConfig uart_cfg_1 = {
#endif
#if 0
static const SerialConfig default_config =
static const SerialConfig LCD_config =
{
9600,
0,
@ -2842,7 +2814,7 @@ int main(void)
/* restore config */
config_recall();
if (caldata_recall(0) == -1) {
load_default_properties();
load_LCD_properties();
}
/*
@ -2896,7 +2868,7 @@ int main(void)
#endif
if (caldata_recall(0) == -1) {
load_default_properties();
load_LCD_properties();
}
set_refer_output(-1);
@ -2967,8 +2939,8 @@ void hard_fault_handler_c(uint32_t *sp)
int y = 0;
int x = OFFSETX + 1;
static char buf[96];
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
plot_printf(buf, sizeof(buf), "SP 0x%08x", (uint32_t)sp);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
plot_printf(buf, sizeof(buf), "R0 0x%08x", r0);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);

@ -133,7 +133,7 @@ void cal_done(void);
#endif
#define MAX_FREQ_TYPE 5
enum stimulus_type {
ST_START=0, ST_STOP, ST_CENTER, ST_SPAN, ST_CW
ST_START=0, ST_STOP, ST_CENTER, ST_SPAN, ST_CW, ST_DUMMY // Last is used in marker ops
};
void set_sweep_points(uint16_t points);
@ -227,6 +227,7 @@ void set_clear_storage(void);
void set_subtract_storage(void);
void toggle_normalize(void);
void toggle_waterfall(void);
void disable_waterfall(void);
void set_mode(int);
int GetMode(void);
void set_reflevel(float);
@ -413,6 +414,9 @@ extern const uint8_t numfont16x22[];
#define S_OHM "\036" // 0x1E
#define S_DEGREE "\037" // 0x1F
// Max palette indexes in config
#define MAX_PALETTE 32
// trace
#define MAX_TRACE_TYPE 12
enum trace_type {
@ -460,31 +464,28 @@ typedef struct trace {
typedef struct config {
int32_t magic;
uint16_t dac_value;
uint16_t grid_color;
uint16_t menu_normal_color;
uint16_t menu_active_color;
uint16_t trace_color[TRACES_MAX];
uint16_t lcd_palette[MAX_PALETTE];
int16_t touch_cal[4];
int8_t _mode;
uint32_t _serial_speed;
#ifdef __VNA__
uint32_t harmonic_freq_threshold;
#endif
uint16_t dac_value;
uint16_t vbat_offset;
float low_level_offset;
float high_level_offset;
uint32_t correction_frequency[CORRECTION_POINTS];
float correction_value[CORRECTION_POINTS];
uint32_t deviceid;
uint16_t ham_color;
uint32_t setting_frequency_10mhz;
uint16_t gridlines;
uint16_t hambands;
uint32_t frequency_IF2;
int8_t _mode;
int8_t cor_am;
int8_t cor_wfm;
int8_t cor_nfm;
uint32_t setting_frequency_10mhz;
int8_t dummy;
// uint8_t _reserved[22];
uint32_t checksum;
@ -587,12 +588,10 @@ extern volatile uint8_t redraw_request;
* ili9341.c
*/
// SPI bus revert byte order
//gggBBBbb RRRrrGGG
#define byteReverse16(x) (uint16_t)(((x) << 8) & 0xff00) | (((x) >> 8) & 0xff)
#define RGB565(r,g,b) byteReverse16( ((((uint16_t)(r))<<8)&0b1111100000000000) | ((((uint16_t)(g))<<3)&0b0000011111100000) | ((((uint16_t)(b))>>3)&0b0000000000011111) )
//#define RGB565(r,g,b) ( (((g)&0x1c)<<11) | (((b)&0xf8)<<5) | ((r)&0xf8) | (((g)&0xe0)>>5) )
// 16-bit gggBBBbb RRRrrGGG
#define RGB565(r,g,b) ( (((g)&0x1c)<<11) | (((b)&0xf8)<<5) | ((r)&0xf8) | (((g)&0xe0)>>5) )
#define RGBHEX(hex) ( (((hex)&0x001c00)<<3) | (((hex)&0x0000f8)<<5) | (((hex)&0xf80000)>>16) | (((hex)&0x00e000)>>13) )
#define HEXRGB(hex) ( (((hex)>>3)&0x001c00) | (((hex)>>5)&0x0000f8) | (((hex)<<16)&0xf80000) | (((hex)<<13)&0x00e000) )
// Define size of screen buffer in pixels (one pixel 16bit size)
#define SPI_BUFFER_SIZE (CELLWIDTH*CELLHEIGHT)
@ -600,27 +599,71 @@ extern volatile uint8_t redraw_request;
#define LCD_WIDTH 480
#define LCD_HEIGHT 320
#define DEFAULT_FG_COLOR RGB565(255,255,255)
#define DEFAULT_BG_COLOR RGB565( 0, 0, 0)
#define DARK_GREY RGB565(140,140,140)
#define LIGHT_GREY RGB565(220,220,220)
#define DEFAULT_GRID_COLOR RGB565(128,128,128)
#define DEFAULT_HAM_COLOR RGB565(80,80,80)
#define DEFAULT_GRID_VALUE_COLOR RGB565(196,196,196)
#define DEFAULT_MENU_COLOR RGB565(255,255,255)
#define DEFAULT_MENU_TEXT_COLOR RGB565( 0, 0, 0)
#define DEFAULT_MENU_ACTIVE_COLOR RGB565(180,255,180)
#define DEFAULT_TRACE_1_COLOR RGB565(255, 0, 0) /* RGB565(255,255, 0) */
#define DEFAULT_TRACE_2_COLOR RGB565( 0,255, 0)/* RGB565( 0,255,255) */
#define DEFAULT_TRACE_3_COLOR RGB565(255,255, 0)/* RGB565( 0,255, 0) */
#define DEFAULT_TRIGGER_COLOR RGB565( 0, 0,255)/* RGB565( 0 0,255) */
//#define DEFAULT_TRACE_4_COLOR RGB565(255, 0,255)
#define DEFAULT_NORMAL_BAT_COLOR RGB565( 31,227, 0)
#define DEFAULT_LOW_BAT_COLOR RGB565(255, 0, 0)
#define DEFAULT_SPEC_INPUT_COLOR RGB565(128,255,128);
#define BRIGHT_COLOR_BLUE RGB565(0,0,255)
#define BRIGHT_COLOR_RED RGB565(255,128,128)
#define BRIGHT_COLOR_GREEN RGB565(0,255,0)
#define LCD_BG_COLOR 0
#define LCD_FG_COLOR 1
#define LCD_GRID_COLOR 2
#define LCD_MENU_COLOR 3
#define LCD_MENU_TEXT_COLOR 4
#define LCD_MENU_ACTIVE_COLOR 5
#define LCD_TRACE_1_COLOR 6
#define LCD_TRACE_2_COLOR 7
#define LCD_TRACE_3_COLOR 8
#define LCD_TRACE_4_COLOR 9
#define LCD_NORMAL_BAT_COLOR 10
#define LCD_LOW_BAT_COLOR 11
#define LCD_TRIGGER_COLOR 12
#define LCD_RISE_EDGE_COLOR 13
#define LCD_FALLEN_EDGE_COLOR 14
#define LCD_SWEEP_LINE_COLOR 15
#define LCD_BW_TEXT_COLOR 16
#define LCD_INPUT_TEXT_COLOR 17
#define LCD_INPUT_BG_COLOR 18
#define LCD_BRIGHT_COLOR_BLUE 19
#define LCD_BRIGHT_COLOR_RED 20
#define LCD_BRIGHT_COLOR_GREEN 21
#define LCD_DARK_GREY 22
#define LCD_LIGHT_GREY 23
#define LCD_HAM_COLOR 24
#define LCD_GRID_VALUE_COLOR 25
#define LCD_M_REFERENCE 26
#define LCD_M_DELTA 27
#define LCD_M_NOISE 28
#define LCD_M_DEFAULT 29
#define LCD_DEFAULT_PALETTE {\
[LCD_BG_COLOR ] = RGB565( 0, 0, 0), \
[LCD_FG_COLOR ] = RGB565(255,255,255), \
[LCD_GRID_COLOR ] = RGB565(128,128,128), \
[LCD_MENU_COLOR ] = RGB565(230,230,230), \
[LCD_MENU_TEXT_COLOR ] = RGB565( 0, 0, 0), \
[LCD_MENU_ACTIVE_COLOR] = RGB565(210,210,210), \
[LCD_TRACE_1_COLOR ] = RGB565(255, 0, 0), \
[LCD_TRACE_2_COLOR ] = RGB565( 0,255, 0), \
[LCD_TRACE_3_COLOR ] = RGB565(255,255, 0), \
[LCD_TRACE_4_COLOR ] = RGB565(255, 0,255), \
[LCD_NORMAL_BAT_COLOR ] = RGB565( 31,227, 0), \
[LCD_LOW_BAT_COLOR ] = RGB565(255, 0, 0), \
[LCD_TRIGGER_COLOR ] = RGB565( 0, 0,255), \
[LCD_RISE_EDGE_COLOR ] = RGB565(255,255,255), \
[LCD_FALLEN_EDGE_COLOR] = RGB565(128,128,128), \
[LCD_SWEEP_LINE_COLOR ] = RGB565( 0,255, 0), \
[LCD_BW_TEXT_COLOR ] = RGB565(128,128,128), \
[LCD_INPUT_TEXT_COLOR ] = RGB565( 0, 0, 0), \
[LCD_INPUT_BG_COLOR ] = RGB565(255,255,255), \
[LCD_BRIGHT_COLOR_BLUE] = RGB565( 0, 0,255), \
[LCD_BRIGHT_COLOR_RED ] = RGB565(255,128,128), \
[LCD_BRIGHT_COLOR_GREEN]= RGB565( 0,255, 0), \
[LCD_DARK_GREY ] = RGB565(140,140,140), \
[LCD_LIGHT_GREY ] = RGB565(220,220,220), \
[LCD_HAM_COLOR ] = RGB565( 80, 80, 80), \
[LCD_GRID_VALUE_COLOR ] = RGB565(196,196,196), \
[LCD_M_REFERENCE ] = RGB565(255,255,255), \
[LCD_M_DELTA ] = RGB565( 0,255, 0), \
[LCD_M_NOISE ] = RGB565( 0,255,255), \
[LCD_M_DEFAULT ] = RGB565(255,255, 0), \
}
#define GET_PALTETTE_COLOR(idx) config.lcd_palette[idx]
extern uint16_t foreground_color;
extern uint16_t background_color;
@ -636,15 +679,10 @@ extern uint16_t spi_buffer[SPI_BUFFER_SIZE];
void ili9341_init(void);
void ili9341_test(int mode);
void ili9341_bulk(int x, int y, int w, int h);
void ili9341_fill(int x, int y, int w, int h, uint16_t color);
void ili9341_fill(int x, int y, int w, int h);
#if 1
void ili9341_set_foreground(uint16_t fg);
void ili9341_set_background(uint16_t fg);
#else
#define ili9341_set_foreground(fg) { foreground_color = fg; }
#define ili9341_set_background(bg) { background_color = bg;}
#endif
void ili9341_set_foreground(uint16_t fg_idx);
void ili9341_set_background(uint16_t bg_idx);
void ili9341_clear_screen(void);
void blit8BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *bitmap);
@ -829,7 +867,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e46 /* 'CONF' */
#define CONFIG_MAGIC 0x434f4e47 /* 'CONF' */
extern int16_t lastsaveid;
//extern properties_t *active_props;

101
plot.c

@ -74,12 +74,12 @@ typedef uint32_t map_t;
uint16_t marker_color(int mtype)
{
if (mtype & M_REFERENCE)
return(RGBHEX(0xFFFFFF));
return LCD_M_REFERENCE;
if (mtype & M_DELTA)
return(RGBHEX(0x00FF00));
return LCD_M_DELTA;
if (mtype & M_NOISE)
return(RGBHEX(0x00FFFF));
return(RGBHEX(0xFFFF00));
return LCD_M_NOISE;
return LCD_M_DEFAULT;
}
//#if 4 != M_TRACKING
@ -149,8 +149,10 @@ void update_grid(void)
grid_width = (WIDTH) * (grid / 100) / (fspan / 1000);
force_set_markmap();
if (get_waterfall())
ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom, 0);
if (get_waterfall()){
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom);
}
redraw_request |= REDRAW_FREQUENCY;
}
@ -1539,27 +1541,28 @@ draw_cell(int m, int n)
#if 0
// use memset 350 system ticks for all screen calls
// as understand it use 8 bit set, slow down on 32 bit systems
memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t));
memset(spi_buffer, LCD_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t));
#else
// use direct set 35 system ticks for all screen calls
#if CELLWIDTH%8 != 0
#error "CELLWIDTH % 8 should be == 0 for speed, or need rewrite cell cleanup"
#endif
// Set DEFAULT_BG_COLOR for 8 pixels in one cycle
int count = h*CELLWIDTH / (16/sizeof(pixel_t));
// Set LCD_BG_COLOR for 8 pixels in one cycle
int count = h*CELLWIDTH / 8;
uint32_t *p = (uint32_t *)cell_buffer;
uint32_t clr = GET_PALTETTE_COLOR(LCD_BG_COLOR) | (GET_PALTETTE_COLOR(LCD_BG_COLOR) << 16);
while (count--) {
p[0] = DEFAULT_BG_COLOR | (DEFAULT_BG_COLOR << 16);
p[1] = DEFAULT_BG_COLOR | (DEFAULT_BG_COLOR << 16);
p[2] = DEFAULT_BG_COLOR | (DEFAULT_BG_COLOR << 16);
p[3] = DEFAULT_BG_COLOR | (DEFAULT_BG_COLOR << 16);
p[0] = clr;
p[1] = clr;
p[2] = clr;
p[3] = clr;
p += 4;
}
#endif
// Draw grid
#if 1
c = config.grid_color;
c = GET_PALTETTE_COLOR(LCD_GRID_COLOR);
// Generate grid type list
uint32_t trace_type = 0;
for (t = 0; t < TRACES_MAX; t++) {
@ -1572,7 +1575,7 @@ draw_cell(int m, int n)
for (x = 0; x < w; x++) {
#ifdef __HAM_BAND__
if (ham_band(x+x0)) {
for (y = 0; y < h; y++) cell_buffer[y * CELLWIDTH + x] = config.ham_color;
for (y = 0; y < h; y++) cell_buffer[y * CELLWIDTH + x] = GET_PALTETTE_COLOR(LCD_HAM_COLOR);
}
#endif
if (rectangular_grid_x(x + x0)) {
@ -1618,7 +1621,7 @@ draw_cell(int m, int n)
if (tp>=0 && tp < h)
for (x = 0; x < w; x++)
if (x + x0 >= CELLOFFSETX && x + x0 <= WIDTH + CELLOFFSETX)
cell_buffer[tp * CELLWIDTH + x] = DEFAULT_TRIGGER_COLOR;
cell_buffer[tp * CELLWIDTH + x] = LCD_TRIGGER_COLOR;
}
#if 1
@ -1633,7 +1636,7 @@ draw_cell(int m, int n)
for (t = 0; t < TRACES_MAX; t++) {
if (!trace[t].enabled)
continue;
c = config.trace_color[t];
c = GET_PALTETTE_COLOR(LCD_TRACE_1_COLOR + t);
// draw polar plot (check all points)
i0 = 0;
i1 = 0;
@ -1674,10 +1677,10 @@ draw_cell(int m, int n)
if (x + MARKER_WIDTH >= 0 && x - MARKER_WIDTH < CELLWIDTH &&
y + MARKER_HEIGHT >= 0 && y - MARKER_HEIGHT < CELLHEIGHT){
// Draw marker plate
ili9341_set_foreground(config.trace_color[t]);
ili9341_set_foreground(LCD_TRACE_1_COLOR + t);
cell_blit_bitmap(x, y, MARKER_WIDTH, MARKER_HEIGHT, MARKER_BITMAP(0));
// Draw marker number
ili9341_set_foreground(DEFAULT_BG_COLOR);
ili9341_set_foreground(LCD_BG_COLOR);
cell_blit_bitmap(x, y, MARKER_WIDTH, MARKER_HEIGHT, MARKER_BITMAP(i+1));
}
// }
@ -1704,7 +1707,7 @@ draw_cell(int m, int n)
if (x + REFERENCE_WIDTH >= 0 && x - REFERENCE_WIDTH < CELLWIDTH) {
int y = HEIGHT - float2int((get_trace_refpos(t) * GRIDY)) - y0 - REFERENCE_Y_OFFSET;
if (y + REFERENCE_HEIGHT >= 0 && y - REFERENCE_HEIGHT < CELLHEIGHT){
ili9341_set_foreground(config.trace_color[t]);
ili9341_set_foreground(GET_PALTETTE_COLOR(LCD_TRACE_1_COLOR + t));
cell_blit_bitmap(x , y, REFERENCE_WIDTH, REFERENCE_HEIGHT, reference_bitmap);
}
}
@ -1942,7 +1945,7 @@ cell_draw_marker_info(int x0, int y0)
int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(FONT_GET_HEIGHT+1) - y0;
ili9341_set_foreground(config.trace_color[t]);
ili9341_set_foreground(GET_PALTETTE_COLOR(LCD_TRACE_1_COLOR + t));
if (mk == active_marker)
cell_drawstring(S_SARROW, xpos, ypos);
xpos += 5;
@ -1964,7 +1967,7 @@ cell_draw_marker_info(int x0, int y0)
trace_get_value_string_delta(t, buf, sizeof buf, measured[trace[t].channel], markers[mk].index, markers[active_marker].index);
else
trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel], markers[mk].index);
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
cell_drawstring(buf, xpos, ypos);
j++;
}
@ -1976,7 +1979,7 @@ cell_draw_marker_info(int x0, int y0)
int ypos = 1 + (j/2)*(FONT_GET_HEIGHT+1) - y0;
plot_printf(buf, sizeof buf, S_DELTA"%d-%d:", active_marker+1, previous_marker+1);
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
cell_drawstring(buf, xpos, ypos);
xpos += 27;
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) {
@ -1996,7 +1999,7 @@ cell_draw_marker_info(int x0, int y0)
int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(FONT_GET_HEIGHT+1) - y0;
ili9341_set_foreground(config.trace_color[t]);
ili9341_set_foreground(GET_PALTETTE_COLOR(LCD_TRACE_1_COLOR + t));
if (t == uistat.current_trace)
cell_drawstring(S_SARROW, xpos, ypos);
xpos += 5;
@ -2009,7 +2012,7 @@ cell_draw_marker_info(int x0, int y0)
xpos += n * 5 + 2;
//xpos += 60;
trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel], idx);
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
cell_drawstring(buf, xpos, ypos);
j++;
}
@ -2018,7 +2021,7 @@ cell_draw_marker_info(int x0, int y0)
int xpos = (WIDTH/2+40) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(FONT_GET_HEIGHT+1) - y0;
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
if (uistat.lever_mode == LM_MARKER)
cell_drawstring(S_SARROW, xpos, ypos);
xpos += 5;
@ -2033,7 +2036,7 @@ cell_draw_marker_info(int x0, int y0)
}
cell_drawstring(buf, xpos, ypos);
}
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
if (electrical_delay != 0) {
// draw electrical delay
int xpos = 21 + CELLOFFSETX - x0;
@ -2058,7 +2061,7 @@ static void cell_grid_line_info(int x0, int y0)
char buf[32];
int xpos = GRID_X_TEXT - x0;
int ypos = 0 - y0 + 2;
ili9341_set_foreground(DEFAULT_GRID_VALUE_COLOR);
ili9341_set_foreground(LCD_GRID_VALUE_COLOR);
float ref = get_trace_refpos(TRACE_ACTUAL);
float scale = get_trace_scale(TRACE_ACTUAL);;
for (int i = 0; i < NGRIDY; i++){
@ -2208,11 +2211,11 @@ static void cell_draw_marker_info(int x0, int y0)
#endif
int k = 0;
if (i == active_marker) {
// ili9341_set_foreground(DEFAULT_BG_COLOR);
// ili9341_set_foreground(LCD_BG_COLOR);
// ili9341_set_background(marker_color(markers[i].mtype));
buf[k++] = S_SARROW[0];
} else {
// ili9341_set_background(DEFAULT_BG_COLOR);
// ili9341_set_background(LCD_BG_COLOR);
// ili9341_set_foreground(marker_color(markers[i].mtype));
buf[k++] = ' ';
// buf[k++] = ' ';
@ -2228,12 +2231,12 @@ static void cell_draw_marker_info(int x0, int y0)
buf[k++] = 'N';
buf[k++] = ' ';
// buf[k++] = 0;
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
uint16_t color;
if ((!setting.subtract_stored) && // Disabled when normalized
((setting.mode == M_LOW && temppeakLevel - get_attenuation() + setting.offset > -10) ||
(setting.mode == M_HIGH && temppeakLevel - get_attenuation()+ setting.offset > -29) ))
color = BRIGHT_COLOR_RED;
color = LCD_BRIGHT_COLOR_RED;
else
color = marker_color(markers[i].mtype);
ili9341_set_foreground(color);
@ -2285,9 +2288,9 @@ draw_frequencies(void)
plot_printf(buf2, sizeof(buf2), "STOP %Fs (%Fm)", time_of_index(sweep_points-1), distance_of_index(sweep_points-1));
}
#endif
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_fill(0, FREQUENCIES_YPOS, LCD_WIDTH, FONT_GET_HEIGHT, DEFAULT_BG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(0, FREQUENCIES_YPOS, LCD_WIDTH, FONT_GET_HEIGHT);
if (uistat.lever_mode == LM_CENTER)
buf1[0] = S_SARROW[0];
if (uistat.lever_mode == LM_SPAN)
@ -2306,9 +2309,9 @@ draw_cal_status(void)
int x = 0;
int y = 100;
char c[3];
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_fill(0, y, OFFSETX, 6*(FONT_GET_HEIGHT+1), DEFAULT_BG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(0, y, OFFSETX, 6*(FONT_GET_HEIGHT+1), LCD_BG_COLOR);
if (cal_status & CALSTAT_APPLY) {
c[0] = cal_status & CALSTAT_INTERPOLATED ? 'c' : 'C';
c[1] = active_props == &current_props ? '*' : '0' + lastsaveid;
@ -2342,8 +2345,8 @@ static void draw_battery_status(void)
return;
uint8_t string_buf[16];
// Set battery color
ili9341_set_foreground(vbat < BATTERY_WARNING_LEVEL ? DEFAULT_LOW_BAT_COLOR : DEFAULT_NORMAL_BAT_COLOR);
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_foreground(vbat < BATTERY_WARNING_LEVEL ? LCD_LOW_BAT_COLOR : LCD_NORMAL_BAT_COLOR);
ili9341_set_background(LCD_BG_COLOR);
// Prepare battery bitmap image
// Battery top
@ -2377,7 +2380,7 @@ request_to_redraw_grid(void)
void
redraw_frame(void)
{
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_clear_screen();
draw_frequencies();
draw_cal_status();
@ -2474,9 +2477,23 @@ toggle_waterfall(void)
waterfall = W_OFF;
}
_grid_y = graph_bottom / NGRIDY;
ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom, 0);
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom);
request_to_redraw_grid();
}
void
disable_waterfall(void)
{
graph_bottom = NO_WATERFALL;
waterfall = W_OFF;
_grid_y = graph_bottom / NGRIDY;
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom);
request_to_redraw_grid();
}
void
plot_init(void)
{

@ -58,14 +58,14 @@ VNA_SHELL_FUNCTION(cmd_mode)
VNA_SHELL_FUNCTION(cmd_modulation )
{
static const char cmd_mod[] = "off|AM|NFM|WFM|extern|freq;
static const char cmd_mod[] = "off|am|nfm|wfm|extern|freq";
if (argc < 1) {
usage:
shell_printf("usage: modulation %s 100..6000\r\n", cmd_mod);
return;
}
static const int cmd_mod_val[] = { MO_NONE, MO_AM, MO_NFM, MO_WFM, MO_EXTERNAL, -1};
int m = get_str_index(argv[1], cmd_mod);
int m = get_str_index(argv[0], cmd_mod);
if (m<0)
goto usage;
if (cmd_mod_val[m] >=0)
@ -78,24 +78,38 @@ VNA_SHELL_FUNCTION(cmd_modulation )
}
}
VNA_SHELL_FUNCTION(cmd_spur)
int generic_option_cmd( const char *cmd, const char *cmd_list, int argc, char *argv)
{
if (argc != 1) {
usage:
shell_printf("usage: spur on|off\r\n");
return;
shell_printf("usage: %s %s\r\n", cmd, cmd_list);
return -1;
}
if (strcmp(argv[0],"on") == 0) {
set_spur(1);
} else if (strcmp(argv[0],"off") == 0) {
set_spur(0);
} else
int m = get_str_index(argv, cmd_list);
if (m < 0)
goto usage;
return m;
}
VNA_SHELL_FUNCTION(cmd_spur)
{
// static const char cmd[] = "off|on";
// if (argc != 1) {
// usage:
// shell_printf("usage: spur %s\r\n", cmd);
// return;
// }
int m = generic_option_cmd("spur", "off|on", argc, argv[0]);
if (m>=0) {
set_spur(m);
redraw_request |= REDRAW_CAL_STATUS | REDRAW_AREA;
}
}
VNA_SHELL_FUNCTION(cmd_output)
{
#if 0
if (argc != 1) {
usage:
shell_printf("usage: output on|off\r\n");
@ -107,7 +121,12 @@ VNA_SHELL_FUNCTION(cmd_output)
setting.mute = true;
} else
goto usage;
#endif
int m = generic_option_cmd("output", "off|on", argc, argv[0]);
if (m>=0) {
setting.mute = m;
dirty = true;
}
}
VNA_SHELL_FUNCTION(cmd_load)
@ -626,13 +645,17 @@ VNA_SHELL_FUNCTION(cmd_scanraw)
if (argc == 3) {
points = my_atoi(argv[2]);
}
// if (get_waterfall())
// disable_waterfall(); // display dma hangs when waterfall is enabled
uint32_t old_step = setting.frequency_step;
float f_step = (stop-start)/ points;
setting.frequency_step = (uint32_t)f_step;
streamPut(shell_stream, '{');
static uint32_t old_start=0, old_stop=0, old_points=0;
if (old_start != start || old_stop != stop || old_points != points) {
if (old_start != start || old_stop != stop || old_points != points) { // To prevent dirty for every sweep
dirty = true;
old_start = start;
old_stop = stop;
@ -658,7 +681,6 @@ VNA_SHELL_FUNCTION(cmd_caloutput)
{
static const char cmd[] = "off|30|15|10|4|3|2|1";
if (argc != 1) {
usage:
shell_printf("usage: caloutput %s\r\n", cmd);
return;
}

@ -1409,7 +1409,7 @@ int binary_search_frequency(int f) // Search which index in the frequency t
return -1;
}
uint32_t interpolate_maximum(int m)
void interpolate_maximum(int m)
{
const int idx = markers[m].index;
markers[m].frequency = frequencies[idx];
@ -1746,7 +1746,7 @@ pureRSSI_t perform(bool break_on_operation, int i, uint32_t f, int tracking)
if (i == 0 || setting.frequency_step != 0)
correct_RSSI_freq = get_frequency_correction(f);
}
int *current_fm_modulation;
int *current_fm_modulation = 0;
if (MODE_OUTPUT(setting.mode)) {
if (setting.modulation != MO_NONE && setting.modulation != MO_EXTERNAL && setting.modulation_frequency != 0) {
modulation_delay = (1000000/ MODULATION_STEPS ) / setting.modulation_frequency; // 5 steps so 1MHz/5
@ -1780,7 +1780,7 @@ modulation_again:
PE4302_Write_Byte(p);
#endif
}
else if (setting.modulation == MO_NFM || setting.modulation == MO_WFM ) { //FM modulation
else if (current_fm_modulation) { // setting.modulation == MO_NFM || setting.modulation == MO_WFM //FM modulation
#ifdef __SI4432__
SI4432_Sel = SI4432_LO ;
int offset = current_fm_modulation[modulation_counter];
@ -2176,7 +2176,8 @@ sweep_again: // stay in sweep loop when output mo
scandirty = false;
if (break_on_operation && operation_requested) { // break loop if needed
if (setting.actual_sweep_time_us > ONE_SECOND_TIME && MODE_INPUT(setting.mode)) {
ili9341_fill(OFFSETX, CHART_BOTTOM+1, WIDTH, 1, 0); // Erase progress bar
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(OFFSETX, CHART_BOTTOM+1, WIDTH, 1); // Erase progress bar
}
return false;
}
@ -2216,8 +2217,10 @@ sweep_again: // stay in sweep loop when output mo
if (setting.actual_sweep_time_us > ONE_SECOND_TIME && (i & 0x07) == 0) { // if required
int pos = i * (WIDTH+1) / sweep_points;
ili9341_fill(OFFSETX, CHART_BOTTOM+1, pos, 1, BRIGHT_COLOR_GREEN); // update sweep progress bar
ili9341_fill(OFFSETX+pos, CHART_BOTTOM+1, WIDTH-pos, 1, 0);
ili9341_set_background(LCD_SWEEP_LINE_COLOR);
ili9341_fill(OFFSETX, CHART_BOTTOM+1, pos, 1); // update sweep progress bar
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(OFFSETX+pos, CHART_BOTTOM+1, WIDTH-pos, 1);
}
// ------------------------ do all RSSI calculations from CALC menu -------------------
@ -2338,7 +2341,11 @@ sweep_again: // stay in sweep loop when output mo
}
// scandirty = true; // To show trigger happened
}
if (setting.actual_sweep_time_us > ONE_SECOND_TIME && MODE_INPUT(setting.mode)) {
// ili9341_fill(OFFSETX, CHART_BOTTOM+1, WIDTH, 1, 0); // Erase progress bar before updating actual_sweep_time
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(OFFSETX, CHART_BOTTOM+1, WIDTH, 1);
}
// ---------------------- process measured actual sweep time -----------------
// For CW mode value calculated in SI4432_Fill
if (setting.measure_sweep_time_us == 0)
@ -2723,7 +2730,6 @@ sweep_again: // stay in sweep loop when output mo
// redraw_marker(peak_marker, FALSE);
// STOP_PROFILE;
ili9341_fill(OFFSETX, CHART_BOTTOM+1, WIDTH, 1, 0);
palSetPad(GPIOC, GPIOC_LED);
return true;
@ -2917,8 +2923,8 @@ void draw_cal_status(void)
if (!UNIT_IS_LINEAR(setting.unit))
rounding = true;
const char * const unit = unit_string[setting.unit];
ili9341_fill(0, 0, OFFSETX, CHART_BOTTOM, 0x0000);
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(0, 0, OFFSETX, CHART_BOTTOM);
if (MODE_OUTPUT(setting.mode)) { // No cal status during output
return;
}
@ -2926,7 +2932,7 @@ void draw_cal_status(void)
// if (current_menu_is_form() && !in_selftest)
// return;
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
float yMax = setting.reflevel;
// Top level
@ -2935,20 +2941,16 @@ void draw_cal_status(void)
else
plot_printf(buf, BLEN, "%+4.3F", (yMax/setting.unit_scale));
if (level_is_calibrated()) {
if (setting.auto_reflevel)
color = DEFAULT_FG_COLOR;
else
color = BRIGHT_COLOR_GREEN;
}
if (level_is_calibrated())
color = setting.auto_reflevel ? LCD_FG_COLOR : LCD_BRIGHT_COLOR_GREEN;
else
color = BRIGHT_COLOR_RED;
color = LCD_BRIGHT_COLOR_RED;
ili9341_set_foreground(color);
ili9341_drawstring(buf, x, y);
// Unit
#if 0
color = DEFAULT_FG_COLOR;
color = LCD_FG_COLOR;
ili9341_set_foreground(color);
if (setting.auto_reflevel){
y += YSTEP + YSTEP/2 ;
@ -2960,7 +2962,7 @@ void draw_cal_status(void)
ili9341_drawstring(buf, x, y);
// Scale
color = DEFAULT_FG_COLOR;
color = LCD_FG_COLOR;
ili9341_set_foreground(color);
y += YSTEP + YSTEP/2;
#if 1
@ -2979,20 +2981,20 @@ void draw_cal_status(void)
ili9341_drawstring(buf, x, y);
if (is_paused()) {
color = BRIGHT_COLOR_GREEN;
color = LCD_BRIGHT_COLOR_GREEN;
ili9341_set_foreground(color);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("PAUSED", x, y);
}
if (setting.trigger == T_SINGLE || setting.trigger == T_NORMAL ) {
color = BRIGHT_COLOR_GREEN;
color = LCD_BRIGHT_COLOR_GREEN;
ili9341_set_foreground(color);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("ARMED", x, y);
}
if (signal_is_AM) {
color = BRIGHT_COLOR_RED;
color = LCD_BRIGHT_COLOR_RED;
ili9341_set_foreground(color);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("AM", x, y);
@ -3001,9 +3003,9 @@ void draw_cal_status(void)
// if (setting.mode == M_LOW) {
// Attenuation
if (setting.auto_attenuation)
color = DEFAULT_FG_COLOR;
color = LCD_FG_COLOR;
else
color = BRIGHT_COLOR_GREEN;
color = LCD_BRIGHT_COLOR_GREEN;
ili9341_set_foreground(color);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("Atten:", x, y);
@ -3014,7 +3016,7 @@ void draw_cal_status(void)
// Average
if (setting.average>0) {
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("Calc:", x, y);
@ -3025,7 +3027,7 @@ void draw_cal_status(void)
// Spur
#ifdef __SPUR__
if (setting.spur_removal) {
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("Spur:", x, y);
@ -3034,7 +3036,7 @@ void draw_cal_status(void)
ili9341_drawstring(buf, x, y);
}
if (setting.mirror_masking) {
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("Mask:", x, y);
@ -3045,16 +3047,16 @@ void draw_cal_status(void)
#endif
if (setting.subtract_stored) {
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("Norm.", x, y);
}
// RBW
if (setting.rbw_x10)
color = BRIGHT_COLOR_GREEN;
color = LCD_BRIGHT_COLOR_GREEN;
else
color = DEFAULT_FG_COLOR;
color = LCD_FG_COLOR;
ili9341_set_foreground(color);
y += YSTEP + YSTEP/2 ;
@ -3067,7 +3069,7 @@ void draw_cal_status(void)
#if 0
// VBW
if (setting.frequency_step > 0) {
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("VBW:", x, y);
@ -3079,9 +3081,9 @@ void draw_cal_status(void)
#endif
// Sweep time
if (setting.step_delay != 0)
color = BRIGHT_COLOR_GREEN;
color = LCD_BRIGHT_COLOR_GREEN;
else
color = DEFAULT_FG_COLOR;
color = LCD_FG_COLOR;
ili9341_set_foreground(color);
@ -3120,7 +3122,7 @@ void draw_cal_status(void)
// Cal output
if (setting.refer >= 0) {
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("Ref:", x, y);
@ -3132,7 +3134,7 @@ void draw_cal_status(void)
// Offset
if (setting.offset != 0.0) {
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("Amp:", x, y);
@ -3143,7 +3145,7 @@ void draw_cal_status(void)
// Repeat
if (setting.repeat != 1) {
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("Repeat:", x, y);
@ -3156,9 +3158,9 @@ void draw_cal_status(void)
// Trigger
if (setting.trigger != T_AUTO) {
if (is_paused() || setting.trigger == T_NORMAL) {
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
} else {
ili9341_set_foreground(BRIGHT_COLOR_RED);
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
}
y += YSTEP + YSTEP/2 ;
ili9341_drawstring("TRIG:", x, y);
@ -3174,16 +3176,16 @@ void draw_cal_status(void)
// Mode
if (level_is_calibrated())
color = BRIGHT_COLOR_GREEN;
color = LCD_BRIGHT_COLOR_GREEN;
else
color = BRIGHT_COLOR_RED;
color = LCD_BRIGHT_COLOR_RED;
ili9341_set_foreground(color);
y += YSTEP + YSTEP/2 ;
ili9341_drawstring_7x13(MODE_LOW(setting.mode) ? "LOW" : "HIGH", x, y);
// Compact status string
// ili9341_set_background(DEFAULT_FG_COLOR);
ili9341_set_foreground(DEFAULT_FG_COLOR);
// ili9341_set_background(LCD_FG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
y += YSTEP + YSTEP/2 ;
strncpy(buf," ",BLEN-1);
if (setting.auto_attenuation)
@ -3217,7 +3219,7 @@ void draw_cal_status(void)
strncpy(buf,&VERSION[8], BLEN-1);
ili9341_drawstring(buf, x, y);
// ili9341_set_background(DEFAULT_BG_COLOR);
// ili9341_set_background(LCD_BG_COLOR);
if (!get_waterfall()) { // Do not draw bottom level if in waterfall mode
// Bottom level
y = area_height - 8 + OFFSETY;
@ -3228,11 +3230,11 @@ void draw_cal_status(void)
// buf[5]=0;
if (level_is_calibrated())
if (setting.auto_reflevel)
color = DEFAULT_FG_COLOR;
color = LCD_FG_COLOR;
else
color = BRIGHT_COLOR_GREEN;
color = LCD_BRIGHT_COLOR_GREEN;
else
color = BRIGHT_COLOR_RED;
color = LCD_BRIGHT_COLOR_RED;
ili9341_set_foreground(color);
ili9341_drawstring(buf, x, y);
}
@ -3333,7 +3335,7 @@ void cell_draw_test_info(int x0, int y0)
i++;
int xpos = 25 - x0;
int ypos = 50+i*INFO_SPACING - y0;
unsigned int color = RGBHEX(0xFFFFFF);
unsigned int color = LCD_FG_COLOR;
if (i == -1) {
plot_printf(self_test_status_buf, sizeof self_test_status_buf, "Self test status:");
} else if (test_case[i].kind == TC_END) {
@ -3344,13 +3346,13 @@ void cell_draw_test_info(int x0, int y0)
} else {
plot_printf(self_test_status_buf, sizeof self_test_status_buf, "Test %d: %s%s", i+1, test_fail_cause[i], test_text[test_status[i]] );
if (test_status[i] == TS_PASS)
color = RGBHEX(0x00FF00);
color = LCD_BRIGHT_COLOR_GREEN;
else if (test_status[i] == TS_CRITICAL)
color = RGBHEX(0xFFFF00);
color = LCD_TRACE_3_COLOR; // Yellow
else if (test_status[i] == TS_FAIL)
color = RGBHEX(0xFF7F7F);
color = LCD_BRIGHT_COLOR_RED;
else
color = RGBHEX(0x0000FF);
color = LCD_BRIGHT_COLOR_BLUE;
}
ili9341_set_foreground(color);
cell_drawstring(self_test_status_buf, xpos, ypos);
@ -3658,7 +3660,7 @@ void self_test(int test)
if (test_step == 2) {
if (peakLevel < -60) {
test_step = TEST_END;
ili9341_set_foreground(BRIGHT_COLOR_RED);
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
ili9341_drawstring_7x13("Signal level too low", 30, 140);
ili9341_drawstring_7x13("Check cable between High and Low connectors", 30, 160);
goto resume2;
@ -3674,7 +3676,7 @@ void self_test(int test)
}
test_step++;
} while (test_case[test_step].kind != TC_END && setting.test_argument == 0 );
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
ili9341_drawstring_7x13("Self test complete", 50, 200);
ili9341_drawstring_7x13("Touch screen to continue", 50, 215);
resume2:
@ -3925,14 +3927,14 @@ void calibrate(void)
test_acquire(TEST_POWER); // Acquire test
local_test_status = test_validate(TEST_POWER); // Validate test
if (peakLevel < -50) {
ili9341_set_foreground(BRIGHT_COLOR_RED);
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
ili9341_drawstring_7x13("Signal level too low", 30, 140);
ili9341_drawstring_7x13("Check cable between High and Low connectors", 30, 160);
goto quit;
}
// chThdSleepMilliseconds(1000);
if (local_test_status != TS_PASS) {
ili9341_set_foreground(BRIGHT_COLOR_RED);
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
ili9341_drawstring_7x13("Calibration failed", 30, 140);
goto quit;
} else {
@ -3968,7 +3970,7 @@ void calibrate(void)
#endif
config_save();
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
ili9341_drawstring_7x13("Calibration complete", 30, 140);
quit:
ili9341_drawstring_7x13("Touch screen to continue", 30, 200);

116
ui.c

@ -328,8 +328,8 @@ touch_cal_exec(void)
int x1, x2, y1, y2;
adc_stop();
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_clear_screen();
ili9341_line(0, 0, 0, 32);
ili9341_line(0, 0, 32, 0);
@ -369,8 +369,8 @@ touch_draw_test(void)
adc_stop();
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_clear_screen();
ili9341_drawstring("TOUCH TEST: DRAG PANEL, PRESS BUTTON TO FINISH", OFFSETX, LCD_HEIGHT - FONT_GET_HEIGHT);
@ -415,8 +415,8 @@ show_version(void)
{
int x = 5, y = 5, i = 0;
adc_stop();
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_clear_screen();
uint16_t shift = 0b0000010000111110;
@ -471,8 +471,8 @@ enter_dfu(void)
adc_stop();
int x = 5, y = 5;
ili9341_set_foreground(DEFAULT_FG_COLOR);
ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
// leave a last message
ili9341_clear_screen();
ili9341_drawstring_7x13("DFU: Device Firmware Update Mode\n"
@ -827,6 +827,13 @@ static UI_FUNCTION_CALLBACK(menu_marker_op_cb)
}
}
break;
case 4: // marker -> ref level
{
float l = actual_t[markers[active_marker].index];
float s_max = value(l)/setting.scale;
user_set_reflevel(setting.scale*(floor(s_max)+2));
}
break;
#ifdef __VNA__
case 4: /* MARKERS->EDELAY */
{
@ -1470,15 +1477,15 @@ static void
draw_button(uint16_t x, uint16_t y, uint16_t w, uint16_t h, ui_button_t *b)
{
uint16_t bw = b->border&BUTTON_BORDER_WIDTH_MASK;
ili9341_fill(x + bw, y + bw, w - (bw * 2), h - (bw * 2), b->bg);
ili9341_set_background(b->bg);ili9341_fill(x + bw, y + bw, w - (bw * 2), h - (bw * 2));
if (bw==0) return;
uint16_t br = RGB565(255,255,255);
uint16_t bd = RGB565(196,196,196);
uint16_t br = LCD_RISE_EDGE_COLOR;
uint16_t bd = LCD_FALLEN_EDGE_COLOR;
uint16_t type = b->border;
ili9341_fill(x, y, w, bw, type&BUTTON_BORDER_TOP ? br : bd); // top
ili9341_fill(x + w - bw, y, bw, h, type&BUTTON_BORDER_RIGHT ? br : bd); // right
ili9341_fill(x, y, bw, h, type&BUTTON_BORDER_LEFT ? br : bd); // left
ili9341_fill(x, y + h - bw, w, bw, type&BUTTON_BORDER_BOTTOM ? br : bd); // bottom
ili9341_set_background(type&BUTTON_BORDER_TOP ? br : bd);ili9341_fill(x, y, w, bw); // top
ili9341_set_background(type&BUTTON_BORDER_RIGHT ? br : bd);ili9341_fill(x + w - bw, y, bw, h); // right
ili9341_set_background(type&BUTTON_BORDER_LEFT ? br : bd);ili9341_fill(x, y, bw, h); // left
ili9341_set_background(type&BUTTON_BORDER_BOTTOM ? br : bd);ili9341_fill(x, y + h - bw, w, bw); // bottom
}
static void
@ -1486,20 +1493,20 @@ draw_keypad(void)
{
int i = 0;
ui_button_t button;
button.fg = DEFAULT_MENU_TEXT_COLOR;
button.fg = LCD_MENU_TEXT_COLOR;
while (keypads[i].c >= 0) {
button.bg = RGB565(230,230,230);//config.menu_normal_color;
button.bg = LCD_MENU_COLOR;
if (i == selection){
button.bg = RGB565(210,210,210);//config.menu_active_color;
button.bg = LCD_MENU_ACTIVE_COLOR;
button.border = KEYBOARD_BUTTON_BORDER|BUTTON_BORDER_FALLING;
}
else
button.border = KEYBOARD_BUTTON_BORDER|BUTTON_BORDER_RISE;
ili9341_set_foreground(button.fg);
ili9341_set_background(button.bg);
int x = KP_GET_X(keypads[i].x);
int y = KP_GET_Y(keypads[i].y);
draw_button(x, y, KP_WIDTH, KP_HEIGHT, &button);
ili9341_set_foreground(button.fg);
ili9341_set_background(button.bg);
if (keypads[i].c < KP_0) { // KP_0
ili9341_drawfont(keypads[i].c,
x + (KP_WIDTH - NUM_FONT_GET_WIDTH) / 2,
@ -1527,9 +1534,10 @@ menu_is_multiline(const char *label)
static void
draw_numeric_area_frame(void)
{
ili9341_fill(0, LCD_HEIGHT-NUM_INPUT_HEIGHT, LCD_WIDTH, NUM_INPUT_HEIGHT, config.menu_normal_color);
ili9341_set_foreground(DEFAULT_MENU_TEXT_COLOR);
ili9341_set_background(config.menu_normal_color);
ili9341_set_foreground(LCD_INPUT_TEXT_COLOR);
ili9341_set_background(LCD_INPUT_BG_COLOR);
ili9341_fill(0, LCD_HEIGHT-NUM_INPUT_HEIGHT, LCD_WIDTH, NUM_INPUT_HEIGHT);
char *name = keypads_mode_tbl[keypad_mode].name;
int lines = menu_is_multiline(name);
ili9341_drawstring_7x13(name, 10, LCD_HEIGHT-NUM_INPUT_HEIGHT + (NUM_INPUT_HEIGHT-lines*bFONT_STR_HEIGHT)/2);
@ -1544,8 +1552,8 @@ draw_numeric_input(const char *buf)
int focused = FALSE;
uint16_t xsim = 0b0010010000000000;
uint16_t fg = DEFAULT_MENU_TEXT_COLOR;
uint16_t bg = config.menu_normal_color;
uint16_t fg = LCD_INPUT_TEXT_COLOR;
uint16_t bg = LCD_INPUT_BG_COLOR;
for (i = 0, x = 64; i < 10 && buf[i]; i++, xsim<<=1) {
int c = buf[i];
if (c == '.')
@ -1561,14 +1569,14 @@ draw_numeric_input(const char *buf)
ili9341_drawfont(c, x, LCD_HEIGHT-NUM_INPUT_HEIGHT+4);
else if (focused) // c not number, but focused
ili9341_drawfont(0, x, LCD_HEIGHT-NUM_INPUT_HEIGHT+4);
// else // erase
// ili9341_fill(x, LCD_HEIGHT-NUM_INPUT_HEIGHT+4, NUM_FONT_GET_HEIGHT, NUM_FONT_GET_WIDTH+2+8, bg);
else // erase
ili9341_fill(x, LCD_HEIGHT-NUM_INPUT_HEIGHT+4, NUM_FONT_GET_HEIGHT, NUM_FONT_GET_WIDTH+2+8);
x += xsim&0x8000 ? NUM_FONT_GET_WIDTH+2+8 : NUM_FONT_GET_WIDTH+2;
}
// erase last
// ili9341_fill(x, LCD_HEIGHT-NUM_INPUT_HEIGHT+4, NUM_FONT_GET_WIDTH+2+8, NUM_FONT_GET_WIDTH+2+8, config.menu_normal_color);
ili9341_fill(x, LCD_HEIGHT-NUM_INPUT_HEIGHT+4, LCD_WIDTH-x-1, NUM_FONT_GET_WIDTH+2+8, config.menu_normal_color);
ili9341_fill(x, LCD_HEIGHT-NUM_INPUT_HEIGHT+4, LCD_WIDTH-x-1, NUM_FONT_GET_WIDTH+2+8);
if (buf[0] == 0 && kp_help_text != NULL) {
ili9341_set_foreground(fg);
ili9341_set_background(bg);
@ -1588,24 +1596,24 @@ menu_item_modify_attribute(const menuitem_t *menu, int item,
} else if (menu == menu_marker_sel) {
if (item < 4) {
if (markers[item].enabled) {
*bg = DEFAULT_MENU_TEXT_COLOR;
*bg = LCD_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
}
} else if (item == 5) {
if (uistat.marker_delta) {
*bg = DEFAULT_MENU_TEXT_COLOR;
*bg = LCD_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
}
}
} else if (menu == menu_marker_search) {
if (item == 4 && uistat.marker_tracking) {
*bg = DEFAULT_MENU_TEXT_COLOR;
*bg = LCD_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
}
} else if (menu == menu_marker_smith) {
if (marker_smith_format == item) {
*bg = DEFAULT_MENU_TEXT_COLOR;
*bg = LCD_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
}
} else if (menu == menu_calop) {
@ -1615,17 +1623,17 @@ menu_item_modify_attribute(const menuitem_t *menu, int item,
|| (item == 3 && (cal_status & CALSTAT_ISOLN))
|| (item == 4 && (cal_status & CALSTAT_THRU))) {
domain_mode = (domain_mode & ~DOMAIN_MODE) | DOMAIN_FREQ;
*bg = DEFAULT_MENU_TEXT_COLOR;
*bg = LCD_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
}
} else if (menu == menu_stimulus) {
if (item == 5 /* PAUSE */ && !(sweep_mode&SWEEP_ENABLE)) {
*bg = DEFAULT_MENU_TEXT_COLOR;
*bg = LCD_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
}
} else if (menu == menu_cal) {
if (item == 3 /* CORRECTION */ && (cal_status & CALSTAT_APPLY)) {
*bg = DEFAULT_MENU_TEXT_COLOR;
*bg = LCD_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
}
} else if (menu == menu_bandwidth) {
@ -1639,7 +1647,7 @@ menu_item_modify_attribute(const menuitem_t *menu, int item,
|| (item == 2 && (domain_mode & TD_FUNC) == TD_FUNC_LOWPASS_STEP)
|| (item == 3 && (domain_mode & TD_FUNC) == TD_FUNC_BANDPASS)
) {
*bg = DEFAULT_MENU_TEXT_COLOR;
*bg = LCD_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
}
} else if (menu == menu_transform_window) {
@ -1647,7 +1655,7 @@ menu_item_modify_attribute(const menuitem_t *menu, int item,
|| (item == 1 && (domain_mode & TD_WINDOW) == TD_WINDOW_NORMAL)
|| (item == 2 && (domain_mode & TD_WINDOW) == TD_WINDOW_MAXIMUM)
) {
*bg = DEFAULT_MENU_TEXT_COLOR;
*bg = LCD_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
}
}
@ -1762,16 +1770,16 @@ draw_menu_buttons(const menuitem_t *menu)
button.border = MENU_BUTTON_BORDER;
if (MT_MASK(menu[i].type) == MT_TITLE) {
button.fg = RGB565(255,255,255);//config.menu_normal_color;
button.bg = DEFAULT_MENU_TEXT_COLOR;
button.fg = LCD_FG_COLOR;
button.bg = LCD_BG_COLOR;
button.border = 0; // no border for title
} else {
button.bg = RGB565(230,230,230);
button.fg = DEFAULT_MENU_TEXT_COLOR;
button.bg = LCD_MENU_COLOR;
button.fg = LCD_MENU_TEXT_COLOR;
}
if (i == selection){
button.bg = RGB565(210,210,210);//config.menu_active_color;
button.bg = LCD_MENU_ACTIVE_COLOR;
button.border|= BUTTON_BORDER_FALLING;
}
else
@ -1795,13 +1803,14 @@ draw_menu_buttons(const menuitem_t *menu)
// Prepare button label
plot_printf(button.text, sizeof button.text, menu[i].label, button.param_1.u, button.param_2.u);
ili9341_set_foreground(button.fg);
ili9341_set_background(button.bg);
if (menu[i].type & MT_FORM) {
int button_width = MENU_FORM_WIDTH;
int button_start = (LCD_WIDTH - MENU_FORM_WIDTH)/2; // At center of screen
int button_height = MENU_BUTTON_HEIGHT;
draw_button(button_start, y, button_width, button_height, &button);
ili9341_set_foreground(button.fg);
ili9341_set_background(button.bg);
uint16_t text_offs = button_start + 6;
if (button.icon >=0){
blit8BitWidthBitmap(button_start+3, y+(MENU_BUTTON_HEIGHT-ICON_HEIGHT)/2, ICON_WIDTH, ICON_HEIGHT, &check_box[button.icon*2*ICON_HEIGHT]);
@ -1820,6 +1829,8 @@ draw_menu_buttons(const menuitem_t *menu)
int button_start = LCD_WIDTH - MENU_BUTTON_WIDTH;
int button_height = MENU_BUTTON_HEIGHT;
draw_button(button_start, y, button_width, button_height, &button);
ili9341_set_foreground(button.fg);
ili9341_set_background(button.bg);
uint16_t text_offs = button_start + 7;
if (button.icon >=0){
blit8BitWidthBitmap(button_start+2, y+(MENU_BUTTON_HEIGHT-ICON_HEIGHT)/2, ICON_WIDTH, ICON_HEIGHT, &check_box[button.icon*2*ICON_HEIGHT]);
@ -1836,8 +1847,9 @@ draw_menu_buttons(const menuitem_t *menu)
y += MENU_BUTTON_HEIGHT;
}
// Cleanup other buttons (less flicker)
ili9341_set_background(LCD_BG_COLOR);
for (; y < MENU_BUTTON_MAX*MENU_BUTTON_HEIGHT; y+=MENU_BUTTON_HEIGHT)
ili9341_fill(LCD_WIDTH-MENU_BUTTON_WIDTH, y, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT, DEFAULT_BG_COLOR);
ili9341_fill(LCD_WIDTH-MENU_BUTTON_WIDTH, y, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT);
}
static systime_t prev_touch_time = 0;
@ -1949,11 +1961,11 @@ static void
erase_menu_buttons(void)
{
// Not need, screen redraw in all cases
// ili9341_fill(area_width, 0, LCD_WIDTH - area_width, area_height, DEFAULT_BG_COLOR);
// ili9341_fill(area_width, 0, LCD_WIDTH - area_width, area_height, LCD_BG_COLOR);
// if (current_menu_is_form())
// ili9341_fill(OFFSETX, 0,LCD_WIDTH-OFFSETX, MENU_BUTTON_HEIGHT*MENU_BUTTON_MAX, DEFAULT_BG_COLOR);
// ili9341_fill(OFFSETX, 0,LCD_WIDTH-OFFSETX, MENU_BUTTON_HEIGHT*MENU_BUTTON_MAX, LCD_BG_COLOR);
// else
// ili9341_fill(LCD_WIDTH-MENU_BUTTON_WIDTH, 0, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT*MENU_BUTTON_MAX, DEFAULT_BG_COLOR);
// ili9341_fill(LCD_WIDTH-MENU_BUTTON_WIDTH, 0, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT*MENU_BUTTON_MAX, LCD_BG_COLOR);
draw_frequencies();
}
@ -1961,7 +1973,8 @@ erase_menu_buttons(void)
static void
erase_numeric_input(void)
{
ili9341_fill(0, LCD_HEIGHT-NUM_INPUT_HEIGHT, LCD_WIDTH, NUM_INPUT_HEIGHT, DEFAULT_BG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(0, LCD_HEIGHT-NUM_INPUT_HEIGHT, LCD_WIDTH, NUM_INPUT_HEIGHT);
}
#endif
@ -1972,11 +1985,12 @@ leave_ui_mode()
// request_to_draw_cells_behind_menu();
// erase_menu_buttons();
// }
ili9341_set_background(LCD_BG_COLOR);
// Erase bottom area (not redraw on area update)
if (MENU_BUTTON_HEIGHT*MENU_BUTTON_MAX - area_height > 0)
ili9341_fill(LCD_WIDTH-MENU_BUTTON_WIDTH, area_height, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT*MENU_BUTTON_MAX - area_height, DEFAULT_BG_COLOR);
ili9341_fill(LCD_WIDTH-MENU_BUTTON_WIDTH, area_height, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT*MENU_BUTTON_MAX - area_height);
if (get_waterfall())
ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom, 0);
ili9341_fill(OFFSETX, graph_bottom, LCD_WIDTH - OFFSETX, CHART_BOTTOM - graph_bottom);
redraw_request|=REDRAW_AREA | REDRAW_FREQUENCY | REDRAW_CAL_STATUS | REDRAW_BATTERY;
}

@ -469,7 +469,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_mode_acb)
if (b){
if (item == setting.mode) {
b->param_1.text = "Return";
b->bg = RGB565(200,200,200);//config.menu_active_color;
b->bg = LCD_MENU_ACTIVE_COLOR;
b->border = BUTTON_BORDER_FALLING | MENU_BUTTON_BORDER;
}
else
@ -1597,16 +1597,15 @@ const menuitem_t menu_marker_ops[] = {
{ MT_CALLBACK, ST_STOP, S_RARROW" STOP", menu_marker_op_cb },
{ MT_CALLBACK, ST_CENTER, S_RARROW" CENTER", menu_marker_op_cb },
{ MT_CALLBACK, ST_SPAN, S_RARROW" SPAN", menu_marker_op_cb },
{ MT_CALLBACK, 4, S_RARROW" REF LEVEL",menu_marker_op_cb },
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
static const menuitem_t menu_marker[] = {
// { MT_SUBMENU, 0, "SELECT\nMARKER", menu_marker_sel},
{ MT_SUBMENU, 0, "MODIFY\nMARKERS", menu_marker_select},
{ MT_SUBMENU, 0, "MARKER OPS", menu_marker_ops},
{ MT_SUBMENU, 0, "MARKER\nOPS", menu_marker_ops},
{ MT_SUBMENU, 0, "SEARCH\nMARKER", menu_marker_search},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel

Loading…
Cancel
Save

Powered by TurnKey Linux.