Merge branch 'V4.3' of https://github.com/erikkaashoek/tinySA into DiSlord_browser

pull/52/head
DiSlord Live 3 years ago
commit 43f5337576

@ -963,7 +963,7 @@ config_t config = {
.touch_cal = { 347, 495, 160, 205 }, // 2.8 inch LCD panel .touch_cal = { 347, 495, 160, 205 }, // 2.8 inch LCD panel
#endif #endif
#ifdef TINYSA4 #ifdef TINYSA4
.touch_cal = { 278, 513, 115, 154 }, // 4 inch panel .touch_cal = { 444, 715, 3552, 3499 }, // 4 inch panel
#endif #endif
._mode = _MODE_USB | _MODE_AUTO_FILENAME, ._mode = _MODE_USB | _MODE_AUTO_FILENAME,
._serial_speed = SERIAL_DEFAULT_BITRATE, ._serial_speed = SERIAL_DEFAULT_BITRATE,

@ -1384,7 +1384,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200 //sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e5C /* 'CONF' */ #define CONFIG_MAGIC 0x434f4e5D /* 'CONF' */
extern int16_t lastsaveid; extern int16_t lastsaveid;
//extern properties_t *active_props; //extern properties_t *active_props;

@ -38,6 +38,7 @@ static void update_waterfall(void);
#ifdef __LEVEL_METER__ #ifdef __LEVEL_METER__
static void update_level_meter(void); static void update_level_meter(void);
char level_text[20]; char level_text[20];
char freq_text[20];
#endif #endif
void cell_draw_test_info(int x0, int y0); void cell_draw_test_info(int x0, int y0);
int cell_printf(int16_t x, int16_t y, const char *fmt, ...); int cell_printf(int16_t x, int16_t y, const char *fmt, ...);
@ -1255,6 +1256,9 @@ draw_all(bool flush)
if (isFullScreenMode()) return; if (isFullScreenMode()) return;
#ifdef __LEVEL_METER__ #ifdef __LEVEL_METER__
level_text[0] = 0; // Clear level text level_text[0] = 0; // Clear level text
#ifdef TINYSA4
freq_text[0] = 0; // Clear level text
#endif
#endif #endif
if (redraw_request & REDRAW_AREA) // this set all area for update if (redraw_request & REDRAW_AREA) // this set all area for update
force_set_markmap(); force_set_markmap();
@ -1544,6 +1548,11 @@ static void trace_print_value_string( // Only used at one place
#endif #endif
plot_printf(ptr2, sizeof(buf2) - 9, "%9.*QHz", digits, freq); plot_printf(ptr2, sizeof(buf2) - 9, "%9.*QHz", digits, freq);
} }
#ifdef __LEVEL_METER__
#ifdef TINYSA4
if (freq_text[0] == 0) strcpy(freq_text, &ptr2[3]);
#endif
#endif
const char *format; const char *format;
if (UNIT_IS_LINEAR(setting.unit)) if (UNIT_IS_LINEAR(setting.unit))
format = FONT_s"%s %.3F%s%s%s%s"; // 5 characters incl u, m, etc... format = FONT_s"%s %.3F%s%s%s%s"; // 5 characters incl u, m, etc...
@ -1556,8 +1565,9 @@ static void trace_print_value_string( // Only used at one place
#endif #endif
cell_printf(xpos, ypos, format, buf2, v, unit_string[unit_index], (mtype & M_DELTA?"c":"") , (mtype & M_NOISE?"/Hz":""), (mtype & M_AVER?"/T":"")); cell_printf(xpos, ypos, format, buf2, v, unit_string[unit_index], (mtype & M_DELTA?"c":"") , (mtype & M_NOISE?"/Hz":""), (mtype & M_AVER?"/T":""));
#ifdef __LEVEL_METER__ #ifdef __LEVEL_METER__
if (level_text[0] == 0) if (level_text[0] == 0){
plot_printf(level_text, sizeof(level_text), &format[3], v, unit_string[unit_index], (mtype & M_DELTA?"c":"") , (mtype & M_NOISE?"/Hz":"") ,(mtype & M_AVER?"/T":"")); plot_printf(level_text, sizeof(level_text), &format[3], v, unit_string[unit_index], (mtype & M_DELTA?"c":"") , (mtype & M_NOISE?"/Hz":"") ,(mtype & M_AVER?"/T":""));
}
#endif #endif
} }
@ -2118,6 +2128,11 @@ static void update_level_meter(void){
int w = ili9341_drawstring_size(level_text, OFFSETX + 3, graph_bottom + 3,BIG_SIZE, x_max); // TODO Size 4 does not transfer to remote desktop?????? int w = ili9341_drawstring_size(level_text, OFFSETX + 3, graph_bottom + 3,BIG_SIZE, x_max); // TODO Size 4 does not transfer to remote desktop??????
if (w < x_max) if (w < x_max)
ili9341_fill(w, graph_bottom+3, x_max - w, BIG_SIZE * wFONT_GET_HEIGHT); ili9341_fill(w, graph_bottom+3, x_max - w, BIG_SIZE * wFONT_GET_HEIGHT);
#ifdef TINYSA4
w = ili9341_drawstring_size(freq_text, OFFSETX + 3, graph_bottom + 3 + BIG_SIZE * wFONT_STR_HEIGHT ,BIG_SIZE, x_max); // TODO Size 4 does not transfer to remote desktop??????
if (w < x_max)
ili9341_fill(w, graph_bottom+3+ BIG_SIZE * wFONT_STR_HEIGHT, x_max - w, BIG_SIZE * wFONT_GET_HEIGHT);
#endif
} }
void void

65
ui.c

@ -408,6 +408,8 @@ touch_wait_released(void)
; ;
} }
#if 0
void void
touch_cal_exec(void) touch_cal_exec(void)
{ {
@ -444,11 +446,58 @@ touch_cal_exec(void)
config.flip = old_flip; config.flip = old_flip;
config_save(); // Auto save touch calibration
//redraw_all(); //redraw_all();
} }
#else
#define CALIBRATION_OFFSET 16
#define TOUCH_MARK_W 9
#define TOUCH_MARK_H 9
#define TOUCH_MARK_X 4
#define TOUCH_MARK_Y 4
static const uint8_t touch_bitmap[]={
_BMP16(0b0000100000000000),
_BMP16(0b0100100100000000),
_BMP16(0b0010101000000000),
_BMP16(0b0000100000000000),
_BMP16(0b1111011110000000),
_BMP16(0b0000100000000000),
_BMP16(0b0010101000000000),
_BMP16(0b0100100100000000),
_BMP16(0b0000100000000000),
};
static void getTouchPoint(uint16_t x, uint16_t y, const char *name, int16_t *data) {
// Clear screen and ask for press
ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_clear_screen();
ili9341_blitBitmap(x, y, TOUCH_MARK_W, TOUCH_MARK_H, touch_bitmap);
lcd_printf((LCD_WIDTH-18*FONT_WIDTH)/2, (LCD_HEIGHT-FONT_GET_HEIGHT)/2, "TOUCH %s *", name);
// Wait release, and fill data
touch_wait_released();
data[0] = last_touch_x;
data[1] = last_touch_y;
}
void
touch_cal_exec(void)
{
const uint16_t x1 = CALIBRATION_OFFSET - TOUCH_MARK_X;
const uint16_t y1 = CALIBRATION_OFFSET - TOUCH_MARK_Y;
const uint16_t x2 = LCD_WIDTH - 1 - CALIBRATION_OFFSET - TOUCH_MARK_X;
const uint16_t y2 = LCD_HEIGHT - 1 - CALIBRATION_OFFSET - TOUCH_MARK_Y;
uint16_t p1 = 0, p2 = 2;
if (config.flip) {p1 = 2, p2 = 0;}
getTouchPoint(x1, y1, "UPPER LEFT", &config.touch_cal[p1]);
getTouchPoint(x2, y2, "LOWER RIGHT", &config.touch_cal[p2]);
config_save(); // Auto save touch calibration
}
#endif
void void
touch_draw_test(void) touch_draw_test(void)
{ {
@ -458,7 +507,7 @@ touch_draw_test(void)
ili9341_set_foreground(LCD_FG_COLOR); ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR); ili9341_set_background(LCD_BG_COLOR);
ili9341_clear_screen(); ili9341_clear_screen();
ili9341_drawstring("TOUCH TEST: DRAG PANEL, PRESS BUTTON TO FINISH", OFFSETX, LCD_HEIGHT - FONT_GET_HEIGHT); ili9341_drawstring("TOUCH PANEL, DRAW LINES, PRESS BUTTON TO FINISH", OFFSETX, LCD_HEIGHT - FONT_GET_HEIGHT);
int old_button_state = 0; int old_button_state = 0;
lcd_set_font(FONT_NORMAL); lcd_set_font(FONT_NORMAL);
@ -496,9 +545,17 @@ touch_position(int *x, int *y)
return; return;
} }
#endif #endif
#if 0
int tx = (last_touch_x - config.touch_cal[0]) * 16 / config.touch_cal[2]; 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]; int ty = (last_touch_y - config.touch_cal[1]) * 16 / config.touch_cal[3];
#else
int tx = ((LCD_WIDTH-1-CALIBRATION_OFFSET)*(last_touch_x - config.touch_cal[0]) + CALIBRATION_OFFSET * (config.touch_cal[2] - last_touch_x)) / (config.touch_cal[2] - config.touch_cal[0]);
if (tx<0) tx = 0; else if (tx>=LCD_WIDTH ) tx = LCD_WIDTH -1;
int ty = ((LCD_HEIGHT-1-CALIBRATION_OFFSET)*(last_touch_y - config.touch_cal[1]) + CALIBRATION_OFFSET * (config.touch_cal[3] - last_touch_y)) / (config.touch_cal[3] - config.touch_cal[1]);
if (ty<0) ty = 0; else if (ty>=LCD_HEIGHT) ty = LCD_HEIGHT-1;
#endif
if (config.flip) { if (config.flip) {
tx = LCD_WIDTH - 1 - tx; tx = LCD_WIDTH - 1 - tx;
ty = LCD_HEIGHT - 1 - ty; ty = LCD_HEIGHT - 1 - ty;
@ -707,8 +764,12 @@ static UI_FUNCTION_CALLBACK(menu_marker_op_cb)
case 4: // marker -> ref level case 4: // marker -> ref level
{ {
float l = actual_t[markers[active_marker].index]; float l = actual_t[markers[active_marker].index];
#if 1
user_set_reflevel(l);
#else
float s_max = value(l)/setting.scale; float s_max = value(l)/setting.scale;
user_set_reflevel(setting.scale*(floorf(s_max)+2)); user_set_reflevel(setting.scale*(floorf(s_max)+2));
#endif
} }
break; break;
#ifdef __VNA__ #ifdef __VNA__

Loading…
Cancel
Save

Powered by TurnKey Linux.