Fix waterfall for 145 points

Prepare for 3d buttons update (fix keyboard draw buttons)
pull/4/head
DiSlord 6 years ago
parent bf5c624a79
commit 6833ea601a

@ -135,7 +135,6 @@ void toggle_sweep(void);
void toggle_mute(void); void toggle_mute(void);
void load_default_properties(void); void load_default_properties(void);
extern float perform(bool b, int i, uint32_t f, int e);
enum { enum {
AV_OFF, AV_MIN, AV_MAX_HOLD, AV_MAX_DECAY, AV_4, AV_16 AV_OFF, AV_MIN, AV_MAX_HOLD, AV_MAX_DECAY, AV_4, AV_16
}; };
@ -874,6 +873,8 @@ typedef int16_t pureRSSI_t;
#define float_TO_PURE_RSSI(rssi) ((rssi)*32.0) #define float_TO_PURE_RSSI(rssi) ((rssi)*32.0)
#define PURE_TO_float(rssi) ((rssi)/32.0) #define PURE_TO_float(rssi) ((rssi)/32.0)
extern uint16_t actual_rbw_x10;
int get_waterfall(void); int get_waterfall(void);
void toggle_tracking(void); void toggle_tracking(void);
void calibrate(void); void calibrate(void);
@ -892,7 +893,7 @@ void wait_user(void);
void calibrate(void); void calibrate(void);
float to_dBm(float); float to_dBm(float);
uint32_t calc_min_sweep_time_us(void); uint32_t calc_min_sweep_time_us(void);
extern uint16_t actual_rbw_x10; float perform(bool b, int i, uint32_t f, int e);
enum { enum {
M_OFF, M_IMD, M_OIP3, M_PHASE_NOISE, M_STOP_BAND, M_PASS_BAND, M_LINEARITY M_OFF, M_IMD, M_OIP3, M_PHASE_NOISE, M_STOP_BAND, M_PASS_BAND, M_LINEARITY

@ -2216,7 +2216,10 @@ redraw_frame(void)
static void update_waterfall(void){ static void update_waterfall(void){
int i; int i;
int w_width = area_width < 290 ? area_width : 290; int w_width = area_width < POINTS_COUNT ? area_width : POINTS_COUNT;
// Waterfall only in 290 or 145 points
if (!(sweep_points == 290 || sweep_points == 145))
return;
for (i = HEIGHT_NOSCROLL-1; i >=HEIGHT_SCROLL+2; i--) { // Scroll down for (i = HEIGHT_NOSCROLL-1; i >=HEIGHT_SCROLL+2; i--) { // Scroll down
ili9341_read_memory(OFFSETX, i , w_width, 1, w_width*1, spi_buffer); ili9341_read_memory(OFFSETX, i , w_width, 1, w_width*1, spi_buffer);
ili9341_bulk(OFFSETX, i+1, w_width, 1); ili9341_bulk(OFFSETX, i+1, w_width, 1);
@ -2265,7 +2268,12 @@ static void update_waterfall(void){
else color = RGB565( 0, 124-((y-160)*4), 252-((y-160)*4)); else color = RGB565( 0, 124-((y-160)*4), 252-((y-160)*4));
#endif #endif
spi_buffer[i] = color; if (sweep_points == 290)
spi_buffer[i] = color;
else {
spi_buffer[2*i ] = color;
spi_buffer[2*i+1] = color;
}
} }
ili9341_bulk(OFFSETX, HEIGHT_SCROLL+2, w_width, 1); ili9341_bulk(OFFSETX, HEIGHT_SCROLL+2, w_width, 1);
} }

@ -560,9 +560,9 @@ VNA_SHELL_FUNCTION(cmd_scanraw)
} }
operation_requested = false; operation_requested = false;
for (uint32_t i = 0; i<points; i++) { for (uint32_t i = 0; i<points; i++) {
if (operation_requested)
break;
float val = perform(false, i, start +(uint32_t)(f_step * i), false); float val = perform(false, i, start +(uint32_t)(f_step * i), false);
if (operation_requested) // break on operation in perform
break;
streamPut(shell_stream, 'x'); streamPut(shell_stream, 'x');
int v = val*2 + 256; int v = val*2 + 256;
streamPut(shell_stream, (uint8_t)(v & 0xFF)); streamPut(shell_stream, (uint8_t)(v & 0xFF));
@ -570,6 +570,7 @@ VNA_SHELL_FUNCTION(cmd_scanraw)
} }
streamPut(shell_stream, '}'); streamPut(shell_stream, '}');
setting.frequency_step = old_step; setting.frequency_step = old_step;
redraw_request = 0; // disable screen update in this mode
} }

15
ui.c

@ -1402,6 +1402,17 @@ static const char * const keypad_mode_label[] = {
static const char * const keypad_scale_text[] = { "1", "2", "5", "10", "20" , "50", "100", "200", "500"}; static const char * const keypad_scale_text[] = { "1", "2", "5", "10", "20" , "50", "100", "200", "500"};
//static const int keypad_scale_value[] = { 1, 2, 5, 10, 20 , 50, 100, 200, 500}; //static const int keypad_scale_value[] = { 1, 2, 5, 10, 20 , 50, 100, 200, 500};
static void
draw_button(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t border_colour, uint16_t bg_colour)
{
// background
const uint16_t bw = 2;
ili9341_fill(x + bw, y + bw, w - (bw * 2), h - (bw * 2), bg_colour);
ili9341_fill(x, y, w, bw, border_colour); // top
ili9341_fill(x + w - bw, y, bw, h, border_colour); // right
ili9341_fill(x, y, bw, h, border_colour); // left
ili9341_fill(x, y + h - bw, w, bw, border_colour); // bottom
}
static void static void
draw_keypad(void) draw_keypad(void)
@ -1416,7 +1427,7 @@ draw_keypad(void)
int x = KP_GET_X(keypads[i].x); int x = KP_GET_X(keypads[i].x);
int y = KP_GET_Y(keypads[i].y); int y = KP_GET_Y(keypads[i].y);
// ili9341_fill(x, y, KP_WIDTH, KP_HEIGHT, DEFAULT_MENU_TEXT_COLOR); // black area around button, causes flicker.... // ili9341_fill(x, y, KP_WIDTH, KP_HEIGHT, DEFAULT_MENU_TEXT_COLOR); // black area around button, causes flicker....
ili9341_fill(x+2, y+2, KP_WIDTH-4, KP_HEIGHT-4, bg); draw_button(x, y, KP_WIDTH, KP_HEIGHT, DEFAULT_BG_COLOR, bg);
if (keypads[i].c < 32) { // KP_1 if (keypads[i].c < 32) { // KP_1
ili9341_drawfont(keypads[i].c, ili9341_drawfont(keypads[i].c,
x + (KP_WIDTH - NUM_FONT_GET_WIDTH) / 2, x + (KP_WIDTH - NUM_FONT_GET_WIDTH) / 2,
@ -1756,11 +1767,13 @@ erase_menu_buttons(void)
draw_frequencies(); draw_frequencies();
} }
#if 0
static void static void
erase_numeric_input(void) erase_numeric_input(void)
{ {
ili9341_fill(0, LCD_HEIGHT-NUM_INPUT_HEIGHT, LCD_WIDTH, NUM_INPUT_HEIGHT, DEFAULT_BG_COLOR); ili9341_fill(0, LCD_HEIGHT-NUM_INPUT_HEIGHT, LCD_WIDTH, NUM_INPUT_HEIGHT, DEFAULT_BG_COLOR);
} }
#endif
static void static void
leave_ui_mode() leave_ui_mode()

Loading…
Cancel
Save

Powered by TurnKey Linux.