@ -1,3 +1,23 @@
/*
* Copyright ( c ) 2014 - 2015 , TAKAHASHI Tomohiro ( TTRFTECH ) edy555 @ gmail . com
* All rights reserved .
*
* This is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 , or ( at your option )
* any later version .
*
* The software is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio ; see the file COPYING . If not , write to
* the Free Software Foundation , Inc . , 51 Franklin Street ,
* Boston , MA 02110 - 1301 , USA .
*/
# include <math.h>
# include <string.h>
# include "ch.h"
@ -15,8 +35,8 @@ int16_t area_width = AREA_WIDTH_NORMAL;
int16_t area_height = AREA_HEIGHT_NORMAL ;
// Cell render use spi buffer
typedef uint16_t pixel ;
pixel * cell_buffer = ( pixel * ) spi_buffer ;
typedef uint16_t pixel_t ;
pixel_t * cell_buffer = ( pixel_t * ) spi_buffer ;
// Cell size
// Depends from spi_buffer size, CELLWIDTH*CELLHEIGHT*sizeof(pixel) <= sizeof(spi_buffer)
# define CELLWIDTH (64)
@ -51,9 +71,10 @@ static index_t trace_index[TRACES_MAX][POINTS_COUNT];
# define CELL_X(i) (int)(((i)>>16))
# define CELL_Y(i) (int)(((i)&0xFFFF))
//#define float ToI nt(v) ((int)(v))
//#define float 2i nt(v) ((int)(v))
static int
floatToInt ( float v ) {
float2int ( float v )
{
if ( v < 0 ) return v - 0.5 ;
if ( v > 0 ) return v + 0.5 ;
return 0 ;
@ -112,8 +133,7 @@ polar_grid(int x, int y)
if ( d = = 0 ) return 1 ;
// vertical and horizontal axis
if ( x = = 0 | | y = = 0 )
return 1 ;
if ( x = = 0 | | y = = 0 ) return 1 ;
d = circle_inout ( x , y , P_RADIUS / 5 ) ;
if ( d = = 0 ) return 1 ;
@ -124,8 +144,7 @@ polar_grid(int x, int y)
if ( d > 0 ) return 0 ;
// cross sloping lines
if ( x = = y | | x = = - y )
return 1 ;
if ( x = = y | | x = = - y ) return 1 ;
d = circle_inout ( x , y , P_RADIUS * 3 / 5 ) ;
if ( d = = 0 ) return 1 ;
@ -151,23 +170,18 @@ smith_grid(int x, int y)
// outer circle
d = circle_inout ( x , y , P_RADIUS ) ;
if ( d < 0 )
return 0 ;
if ( d = = 0 )
return 1 ;
if ( d < 0 ) return 0 ;
if ( d = = 0 ) return 1 ;
// horizontal axis
if ( y = = 0 )
return 1 ;
if ( y = = 0 ) return 1 ;
// shift circle center to right origin
x - = P_RADIUS ;
// Constant Reactance Circle: 2j : R/2 = P_RADIUS/2
if ( circle_inout ( x , y + P_RADIUS / 2 , P_RADIUS / 2 ) = = 0 )
return 1 ;
if ( circle_inout ( x , y - P_RADIUS / 2 , P_RADIUS / 2 ) = = 0 )
return 1 ;
if ( circle_inout ( x , y + P_RADIUS / 2 , P_RADIUS / 2 ) = = 0 ) return 1 ;
if ( circle_inout ( x , y - P_RADIUS / 2 , P_RADIUS / 2 ) = = 0 ) return 1 ;
// Constant Resistance Circle: 3 : R/4 = P_RADIUS/4
d = circle_inout ( x + P_RADIUS / 4 , y , P_RADIUS / 4 ) ;
@ -175,10 +189,8 @@ smith_grid(int x, int y)
if ( d = = 0 ) return 1 ;
// Constant Reactance Circle: 1j : R = P_RADIUS
if ( circle_inout ( x , y + P_RADIUS , P_RADIUS ) = = 0 )
return 1 ;
if ( circle_inout ( x , y - P_RADIUS , P_RADIUS ) = = 0 )
return 1 ;
if ( circle_inout ( x , y + P_RADIUS , P_RADIUS ) = = 0 ) return 1 ;
if ( circle_inout ( x , y - P_RADIUS , P_RADIUS ) = = 0 ) return 1 ;
// Constant Resistance Circle: 1 : R/2
d = circle_inout ( x + P_RADIUS / 2 , y , P_RADIUS / 2 ) ;
@ -186,14 +198,11 @@ smith_grid(int x, int y)
if ( d = = 0 ) return 1 ;
// Constant Reactance Circle: 1/2j : R*2
if ( circle_inout ( x , y + P_RADIUS * 2 , P_RADIUS * 2 ) = = 0 )
return 1 ;
if ( circle_inout ( x , y - P_RADIUS * 2 , P_RADIUS * 2 ) = = 0 )
return 1 ;
if ( circle_inout ( x , y + P_RADIUS * 2 , P_RADIUS * 2 ) = = 0 ) return 1 ;
if ( circle_inout ( x , y - P_RADIUS * 2 , P_RADIUS * 2 ) = = 0 ) return 1 ;
// Constant Resistance Circle: 1/3 : R*3/4
if ( circle_inout ( x + P_RADIUS * 3 / 4 , y , P_RADIUS * 3 / 4 ) = = 0 )
return 1 ;
if ( circle_inout ( x + P_RADIUS * 3 / 4 , y , P_RADIUS * 3 / 4 ) = = 0 ) return 1 ;
return 0 ;
}
@ -355,8 +364,7 @@ static int
rectangular_grid_x ( int x )
{
x - = CELLOFFSETX ;
if ( x < 0 )
return 0 ;
if ( x < 0 ) return 0 ;
if ( x = = 0 | | x = = WIDTH )
return 1 ;
if ( ( ( ( x + grid_offset ) * 10 ) % grid_width ) < 10 )
@ -466,7 +474,8 @@ swr(const float *v)
}
static float
resitance ( const float * v ) {
resitance ( const float * v )
{
float z0 = 50 ;
float d = z0 / ( ( 1 - v [ 0 ] ) * ( 1 - v [ 0 ] ) + v [ 1 ] * v [ 1 ] ) ;
float zr = ( ( 1 + v [ 0 ] ) * ( 1 - v [ 0 ] ) - v [ 1 ] * v [ 1 ] ) * d ;
@ -474,7 +483,8 @@ resitance(const float *v) {
}
static float
reactance ( const float * v ) {
reactance ( const float * v )
{
float z0 = 50 ;
float d = z0 / ( ( 1 - v [ 0 ] ) * ( 1 - v [ 0 ] ) + v [ 1 ] * v [ 1 ] ) ;
float zi = 2 * v [ 1 ] * d ;
@ -485,8 +495,8 @@ static void
cartesian_scale ( float re , float im , int * xp , int * yp , float scale )
{
//float scale = 4e-3;
int x = float ToI nt( re * P_RADIUS * scale ) ;
int y = float ToI nt( im * P_RADIUS * scale ) ;
int x = float 2i nt( re * P_RADIUS * scale ) ;
int y = float 2i nt( im * P_RADIUS * scale ) ;
if ( x < - P_RADIUS ) x = - P_RADIUS ;
else if ( x > P_RADIUS ) x = P_RADIUS ;
if ( y < - P_RADIUS ) y = - P_RADIUS ;
@ -566,7 +576,7 @@ trace_into_index(int t, int i, float array[POINTS_COUNT][2])
if ( v < 0 ) v = 0 ;
if ( v > NGRIDY ) v = NGRIDY ;
x = ( i * ( WIDTH ) + ( sweep_points - 1 ) / 2 ) / ( sweep_points - 1 ) + CELLOFFSETX ;
y = float ToI nt( v * GRIDY ) ;
y = float 2i nt( v * GRIDY ) ;
set_index :
return INDEX ( x , y ) ;
}
@ -594,6 +604,7 @@ format_smith_value(char *buf, int len, const float coeff[2], uint32_t frequency)
plot_printf ( buf , len , " %.1fdB %.1f " S_DEGREE , v , phase ( coeff ) ) ;
}
break ;
case MS_REIM :
plot_printf ( buf , len , " %F%+Fj " , coeff [ 0 ] , coeff [ 1 ] ) ;
break ;
@ -606,8 +617,7 @@ format_smith_value(char *buf, int len, const float coeff[2], uint32_t frequency)
if ( zi < 0 ) { // Capacity
prefix = ' F ' ;
value = - 1 / ( 2 * VNA_PI * frequency * zi ) ;
}
else {
} else {
prefix = ' H ' ;
value = zi / ( 2 * VNA_PI * frequency ) ;
}
@ -698,8 +708,7 @@ trace_get_value_string_delta(int t, char *buf, int len, float array[POINTS_COUNT
case TRC_SWR :
format = S_DELTA " %.3f " ;
v = swr ( coeff ) ;
if ( v ! = INFINITY )
v - = swr ( coeff_ref ) ;
if ( v ! = INFINITY ) v - = swr ( coeff_ref ) ;
break ;
case TRC_SMITH :
format_smith_value ( buf , len , coeff , frequencies [ index ] ) ;
@ -753,12 +762,15 @@ trace_get_info(int t, char *buf, int len)
return 0 ;
}
static float time_of_index ( int idx ) {
static float time_of_index ( int idx )
{
return 1.0 / ( float ) ( frequencies [ 1 ] - frequencies [ 0 ] ) / ( float ) FFT_SIZE * idx ;
}
static float distance_of_index ( int idx ) {
float distance = ( ( float ) idx * ( float ) SPEED_OF_LIGHT ) / ( ( float ) ( frequencies [ 1 ] - frequencies [ 0 ] ) * ( float ) FFT_SIZE * 2.0 ) ;
static float distance_of_index ( int idx )
{
float distance = ( ( float ) idx * ( float ) SPEED_OF_LIGHT ) /
( ( float ) ( frequencies [ 1 ] - frequencies [ 0 ] ) * ( float ) FFT_SIZE * 2.0 ) ;
return distance * velocity_factor ;
}
@ -788,7 +800,8 @@ force_set_markmap(void)
}
void
invalidateRect ( int x0 , int y0 , int x1 , int y1 ) {
invalidate_rect ( int x0 , int y0 , int x1 , int y1 )
{
x0 / = CELLWIDTH ;
x1 / = CELLWIDTH ;
y0 / = CELLHEIGHT ;
@ -832,7 +845,7 @@ static inline void
markmap_upperarea ( void )
{
// Hardcoded, Text info from upper area
invalidate R ect( 0 , 0 , AREA_WIDTH_NORMAL , 31 ) ;
invalidate _r ect( 0 , 0 , AREA_WIDTH_NORMAL , 31 ) ;
}
//
@ -924,8 +937,7 @@ draw_refpos(int x, int y, int c)
{
int y0 = y , j ;
for ( j = 0 ; j < REFERENCE_HEIGHT ; j + + , y0 + + ) {
if ( y0 < 0 | | y0 > = CELLHEIGHT )
continue ;
if ( y0 < 0 | | y0 > = CELLHEIGHT ) continue ;
int x0 = x ;
uint8_t bits = reference_bitmap [ j ] ;
while ( bits ) {
@ -997,8 +1009,7 @@ draw_marker(int x, int y, int c, int ch)
uint8_t bits = marker_bitmap [ ch * MARKER_HEIGHT + j ] ;
bool force_color = false ;
while ( bits ) {
if ( bits & 0x80 )
force_color = true ;
if ( bits & 0x80 ) force_color = true ;
if ( x0 > = 0 & & x0 < CELLWIDTH & & y0 > = 0 & & y0 < CELLHEIGHT ) {
if ( bits & 0x80 )
cell_buffer [ y0 * CELLWIDTH + x0 ] = c ;
@ -1023,7 +1034,7 @@ markmap_marker(int marker)
index_t index = trace_index [ t ] [ markers [ marker ] . index ] ;
int x = CELL_X ( index ) - X_MARKER_OFFSET ;
int y = CELL_Y ( index ) - Y_MARKER_OFFSET ;
invalidate R ect( x , y , x + MARKER_WIDTH - 1 , y + MARKER_HEIGHT - 1 ) ;
invalidate _r ect( x , y , x + MARKER_WIDTH - 1 , y + MARKER_HEIGHT - 1 ) ;
}
}
@ -1211,7 +1222,7 @@ draw_cell(int m, int n)
# 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 ) ) ;
int count = h * CELLWIDTH / ( 16 / sizeof ( pixel_t ) ) ;
uint32_t * p = ( uint32_t * ) cell_buffer ;
while ( count - - ) {
p [ 0 ] = DEFAULT_BG_COLOR | ( DEFAULT_BG_COLOR < < 16 ) ;
@ -1227,15 +1238,16 @@ draw_cell(int m, int n)
c = config . grid_color ;
// Generate grid type list
uint32_t trace_type = 0 ;
for ( t = 0 ; t < TRACES_MAX ; t + + )
if ( trace [ t ] . enabled )
for ( t = 0 ; t < TRACES_MAX ; t + + ) {
if ( trace [ t ] . enabled ) {
trace_type | = ( 1 < < trace [ t ] . type ) ;
}
}
// Draw rectangular plot (40 system ticks for all screen calls)
if ( trace_type & RECTANGULAR_GRID_MASK ) {
for ( x = 0 ; x < w ; x + + ) {
if ( rectangular_grid_x ( x + x0 ) ) {
for ( y = 0 ; y < h ; y + + )
cell_buffer [ y * CELLWIDTH + x ] = c ;
for ( y = 0 ; y < h ; y + + ) cell_buffer [ y * CELLWIDTH + x ] = c ;
}
}
for ( y = 0 ; y < h ; y + + ) {
@ -1250,15 +1262,13 @@ draw_cell(int m, int n)
if ( trace_type & ( 1 < < TRC_SMITH ) ) {
for ( y = 0 ; y < h ; y + + )
for ( x = 0 ; x < w ; x + + )
if ( smith_grid ( x + x0 , y + y0 ) )
cell_buffer [ y * CELLWIDTH + x ] = c ;
if ( smith_grid ( x + x0 , y + y0 ) ) cell_buffer [ y * CELLWIDTH + x ] = c ;
}
// Polar greed line (800 system ticks for all screen calls)
else if ( trace_type & ( 1 < < TRC_POLAR ) ) {
for ( y = 0 ; y < h ; y + + )
for ( x = 0 ; x < w ; x + + )
if ( polar_grid ( x + x0 , y + y0 ) )
cell_buffer [ y * CELLWIDTH + x ] = c ;
if ( polar_grid ( x + x0 , y + y0 ) ) cell_buffer [ y * CELLWIDTH + x ] = c ;
}
#if 0
else if ( trace_type & ( 1 < < TRC_ADMIT ) ) {
@ -1271,18 +1281,21 @@ draw_cell(int m, int n)
# endif
# endif
// PULSE;
// Draw traces (50-600 system ticks for all screen calls, depend from lines count and size)
// Draw traces (50-600 system ticks for all screen calls, depend from lines
// count and size)
# if 1
for ( t = 0 ; t < TRACES_MAX ; t + + ) {
if ( ! trace [ t ] . enabled )
continue ;
c = config . trace_color [ t ] ;
// draw polar plot (check all points)
i0 = 0 ; i1 = 0 ;
i0 = 0 ;
i1 = 0 ;
uint32_t trace_type = ( 1 < < trace [ t ] . type ) ;
if ( trace_type & ( ( 1 < < TRC_SMITH ) | ( 1 < < TRC_POLAR ) ) )
i1 = sweep_points - 1 ;
else // draw rectangular plot (search index range in cell, save 50-70 system ticks for all screen calls)
else // draw rectangular plot (search index range in cell, save 50-70
// system ticks for all screen calls)
search_index_range_x ( x0 , x0 + w , trace_index [ t ] , & i0 , & i1 ) ;
index_t * index = trace_index [ t ] ;
for ( i = i0 ; i < i1 ; i + + ) {
@ -1295,7 +1308,8 @@ draw_cell(int m, int n)
}
# else
for ( x = 0 ; x < area_width ; x + = 6 )
cell_drawline ( x - x0 , 0 - y0 , area_width - x - x0 , area_height - y0 , config . trace_color [ 0 ] ) ;
cell_drawline ( x - x0 , 0 - y0 , area_width - x - x0 , area_height - y0 ,
config . trace_color [ 0 ] ) ;
# endif
// PULSE;
// draw marker symbols on each trace (<10 system ticks for all screen calls)
@ -1310,7 +1324,8 @@ draw_cell(int m, int n)
int x = CELL_X ( index ) - x0 - X_MARKER_OFFSET ;
int y = CELL_Y ( index ) - y0 - Y_MARKER_OFFSET ;
// Check marker icon on cell
if ( x + MARKER_WIDTH > = 0 & & x - MARKER_WIDTH < CELLWIDTH & & y + MARKER_HEIGHT > = 0 & & y - MARKER_HEIGHT < CELLHEIGHT )
if ( x + MARKER_WIDTH > = 0 & & x - MARKER_WIDTH < CELLWIDTH & &
y + MARKER_HEIGHT > = 0 & & y - MARKER_HEIGHT < CELLHEIGHT )
draw_marker ( x , y , config . trace_color [ t ] , i ) ;
}
}
@ -1330,7 +1345,7 @@ draw_cell(int m, int n)
continue ;
int x = 0 - x0 + CELLOFFSETX - REFERENCE_X_OFFSET ;
if ( x + REFERENCE_WIDTH > = 0 & & x - REFERENCE_WIDTH < CELLWIDTH ) {
int y = HEIGHT - float ToI nt( ( get_trace_refpos ( t ) * GRIDY ) ) - y0 - REFERENCE_Y_OFFSET ;
int y = HEIGHT - float 2i nt( ( get_trace_refpos ( t ) * GRIDY ) ) - y0 - REFERENCE_Y_OFFSET ;
if ( y + REFERENCE_HEIGHT > = 0 & & y - REFERENCE_HEIGHT < CELLHEIGHT )
draw_refpos ( x , y , config . trace_color [ t ] ) ;
}
@ -1338,8 +1353,8 @@ draw_cell(int m, int n)
// Need right clip cell render (25 system ticks for all screen calls)
# if 1
if ( w < CELLWIDTH ) {
pixel * src = cell_buffer + CELLWIDTH ;
pixel * dst = cell_buffer + w ;
pixel_t * src = cell_buffer + CELLWIDTH ;
pixel_t * dst = cell_buffer + w ;
for ( y = h ; - - y ; src + = CELLWIDTH - w )
for ( x = w ; x - - ; )
* dst + + = * src + + ;
@ -1350,7 +1365,8 @@ draw_cell(int m, int n)
}
static void
draw_all_cells ( bool flush_markmap ) {
draw_all_cells ( bool flush_markmap )
{
int m , n ;
// START_PROFILE
for ( m = 0 ; m < ( area_width + CELLWIDTH - 1 ) / CELLWIDTH ; m + + )
@ -1412,7 +1428,7 @@ void
request_to_draw_cells_behind_menu ( void )
{
// Values Hardcoded from ui.c
invalidate R ect( 320 - 70 , 0 , 319 , 239 ) ;
invalidate _r ect( 320 - 70 , 0 , 319 , 239 ) ;
redraw_request | = REDRAW_CELLS ;
}
@ -1420,7 +1436,7 @@ void
request_to_draw_cells_behind_numeric_input ( void )
{
// Values Hardcoded from ui.c
invalidate R ect( 0 , 240 - 32 , 319 , 239 ) ;
invalidate _r ect( 0 , 240 - 32 , 319 , 239 ) ;
redraw_request | = REDRAW_CELLS ;
}
@ -1478,7 +1494,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 ;
setForegroundColor ( config . trace_color [ t ] ) ;
ili9341_set_foreground ( config . trace_color [ t ] ) ;
if ( mk = = active_marker )
cell_drawstring ( S_SARROW , xpos , ypos ) ;
xpos + = 5 ;
@ -1500,7 +1516,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 ) ;
setForegroundColor ( DEFAULT_FG_COLOR ) ;
ili9341_set_foreground ( DEFAULT_FG_COLOR ) ;
cell_drawstring ( buf , xpos , ypos ) ;
j + + ;
}
@ -1512,7 +1528,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 ) ;
setForegroundColor ( DEFAULT_FG_COLOR ) ;
ili9341_set_foreground ( DEFAULT_FG_COLOR ) ;
cell_drawstring ( buf , xpos , ypos ) ;
xpos + = 27 ;
if ( ( domain_mode & DOMAIN_MODE ) = = DOMAIN_FREQ ) {
@ -1532,7 +1548,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 ;
setForegroundColor ( config . trace_color [ t ] ) ;
ili9341_set_foreground ( config . trace_color [ t ] ) ;
if ( t = = uistat . current_trace )
cell_drawstring ( S_SARROW , xpos , ypos ) ;
xpos + = 5 ;
@ -1545,7 +1561,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 ) ;
setForegroundColor ( DEFAULT_FG_COLOR ) ;
ili9341_set_foreground ( DEFAULT_FG_COLOR ) ;
cell_drawstring ( buf , xpos , ypos ) ;
j + + ;
}
@ -1554,7 +1570,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 ;
setForegroundColor ( DEFAULT_FG_COLOR ) ;
ili9341_set_foreground ( DEFAULT_FG_COLOR ) ;
if ( uistat . lever_mode = = LM_MARKER )
cell_drawstring ( S_SARROW , xpos , ypos ) ;
xpos + = 5 ;
@ -1569,7 +1585,7 @@ cell_draw_marker_info(int x0, int y0)
}
cell_drawstring ( buf , xpos , ypos ) ;
}
setForegroundColor ( DEFAULT_FG_COLOR ) ;
ili9341_set_foreground ( DEFAULT_FG_COLOR ) ;
if ( electrical_delay ! = 0 ) {
// draw electrical delay
int xpos = 21 + CELLOFFSETX - x0 ;
@ -1605,8 +1621,8 @@ draw_frequencies(void)
plot_printf ( buf1 , sizeof ( buf1 ) , " START 0s " ) ;
plot_printf ( buf2 , sizeof ( buf2 ) , " STOP %Fs (%Fm) " , time_of_index ( sweep_points - 1 ) , distance_of_index ( sweep_points - 1 ) ) ;
}
setForegroundColor ( DEFAULT_FG_COLOR ) ;
setBackgroundColor ( DEFAULT_BG_COLOR ) ;
ili9341_set_foreground ( DEFAULT_FG_COLOR ) ;
ili9341_set_background ( DEFAULT_BG_COLOR ) ;
ili9341_fill ( 0 , FREQUENCIES_YPOS , 320 , FONT_GET_HEIGHT , DEFAULT_BG_COLOR ) ;
if ( uistat . lever_mode = = LM_CENTER )
buf1 [ 0 ] = S_SARROW [ 0 ] ;
@ -1622,8 +1638,8 @@ draw_cal_status(void)
int x = 0 ;
int y = 100 ;
char c [ 3 ] ;
setForegroundColor ( DEFAULT_FG_COLOR ) ;
setBackgroundColor ( DEFAULT_BG_COLOR ) ;
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 ) ;
if ( cal_status & CALSTAT_APPLY ) {
c [ 0 ] = cal_status & CALSTAT_INTERPOLATED ? ' c ' : ' C ' ;
@ -1657,8 +1673,8 @@ static void draw_battery_status(void)
return ;
uint8_t string_buf [ 16 ] ;
// Set battery color
setForegroundColor ( vbat < BATTERY_WARNING_LEVEL ? DEFAULT_LOW_BAT_COLOR : DEFAULT_NORMAL_BAT_COLOR ) ;
setBackgroundColor ( DEFAULT_BG_COLOR ) ;
ili9341_set_foreground ( vbat < BATTERY_WARNING_LEVEL ? DEFAULT_LOW_BAT_COLOR : DEFAULT_NORMAL_BAT_COLOR ) ;
ili9341_set_background ( DEFAULT_BG_COLOR ) ;
// plot_printf(string_buf, sizeof string_buf, "V:%d", vbat);
// ili9341_drawstringV(string_buf, 1, 60);
// Prepare battery bitmap image
@ -1689,8 +1705,8 @@ request_to_redraw_grid(void)
void
redraw_frame ( void )
{
setBackgroundColor ( DEFAULT_BG_COLOR ) ;
clearS creen( ) ;
ili9341_set_background ( DEFAULT_BG_COLOR ) ;
ili9341_clear_s creen( ) ;
draw_frequencies ( ) ;
draw_cal_status ( ) ;
}