Add level_offset switch and repaired sliders

Removed_REF_marker
erikkaashoek 5 years ago
parent d05ccf73e9
commit e5cd84c9df

@ -66,7 +66,7 @@
<option id="cdt.managedbuild.option.gnu.cross.prefix.903091728" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/> <option id="cdt.managedbuild.option.gnu.cross.prefix.903091728" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
<option id="cdt.managedbuild.option.gnu.cross.path.1331588387" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/> <option id="cdt.managedbuild.option.gnu.cross.path.1331588387" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1658396186" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1658396186" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder arguments="TARGET=&quot;F303&quot;" command="make" id="cdt.managedbuild.builder.gnu.cross.972545419" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/> <builder arguments="TARGET=&quot;F303&quot;" autoBuildTarget="all" buildPath="${workspace_loc:/tinySA}/" cleanBuildTarget="clean" command="make" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="cdt.managedbuild.builder.gnu.cross.972545419" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1120267824" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler"> <tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1120267824" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.693059642" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.693059642" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool> </tool>

@ -1008,6 +1008,7 @@ config_t config = {
.high_out_adf4350 = true, .high_out_adf4350 = true,
#endif #endif
.sweep_voltage = 3.3, .sweep_voltage = 3.3,
.switch_offset = 0.0,
}; };
//properties_t current_props; //properties_t current_props;

@ -623,6 +623,7 @@ typedef struct config {
int8_t cor_nfm; int8_t cor_nfm;
uint8_t high_out_adf4350; uint8_t high_out_adf4350;
float sweep_voltage; float sweep_voltage;
float switch_offset;
uint32_t dummy; uint32_t dummy;
// uint8_t _reserved[22]; // uint8_t _reserved[22];
freq_t checksum; freq_t checksum;

@ -1697,6 +1697,7 @@ redraw_marker(int marker)
redraw_request|=REDRAW_AREA; redraw_request|=REDRAW_AREA;
} }
#if 0 // Not used
void void
request_to_draw_cells_behind_menu(void) request_to_draw_cells_behind_menu(void)
{ {
@ -1715,6 +1716,7 @@ request_to_draw_cells_behind_numeric_input(void)
invalidate_rect(0, LCD_HEIGHT-NUM_INPUT_HEIGHT, LCD_WIDTH-1, LCD_HEIGHT-1); invalidate_rect(0, LCD_HEIGHT-NUM_INPUT_HEIGHT, LCD_WIDTH-1, LCD_HEIGHT-1);
redraw_request |= REDRAW_CELLS; redraw_request |= REDRAW_CELLS;
} }
#endif
static void static void
cell_blit_bitmap(int x, int y, uint16_t w, uint16_t h, const uint8_t *bmp) cell_blit_bitmap(int x, int y, uint16_t w, uint16_t h, const uint8_t *bmp)

@ -250,10 +250,12 @@ VNA_SHELL_FUNCTION(cmd_levelchange)
VNA_SHELL_FUNCTION(cmd_leveloffset) VNA_SHELL_FUNCTION(cmd_leveloffset)
{ {
if (argc == 0) { if (argc == 0) {
shell_printf("leveloffset low %.1f\r\n", config.low_level_offset); const char *p = "leveloffset %s %.1f\r\n";
shell_printf("leveloffset high %.1f\r\n", config.high_level_offset); shell_printf(p, "low", config.low_level_offset);
shell_printf("leveloffset low output %.1f\r\n", config.low_level_output_offset); shell_printf(p, "high", config.high_level_offset);
shell_printf("leveloffset high output %.1f\r\n", config.high_level_output_offset); shell_printf(p, "low output", config.low_level_output_offset);
shell_printf(p, "high output", config.high_level_output_offset);
shell_printf(p, "switch", config.switch_offset);
return; return;
} else if (argc == 2) { } else if (argc == 2) {
float v = my_atof(argv[1]); float v = my_atof(argv[1]);
@ -261,6 +263,8 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
config.low_level_offset = v; config.low_level_offset = v;
else if (strcmp(argv[0],"high") == 0) else if (strcmp(argv[0],"high") == 0)
config.high_level_offset = v; config.high_level_offset = v;
else if (strcmp(argv[0],"switch") == 0)
config.switch_offset = v;
else else
goto usage; goto usage;
dirty = true; dirty = true;
@ -275,7 +279,7 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
dirty = true; dirty = true;
} else { } else {
usage: usage:
shell_printf("leveloffset [low|high] {output} [<offset>]\r\n"); shell_printf("leveloffset [low|high|switch] {output} [-20..+20]\r\n");
} }
} }

@ -82,7 +82,7 @@ const int8_t drive_dBm [16] = {-38, -32, -30, -27, -24, -19, -15, -12, -5, -2, 0
#endif #endif
#ifdef TINYSA4 #ifdef TINYSA4
#define SWITCH_ATTENUATION (setting.mode == M_GENHIGH && config.high_out_adf4350 ? 0 : 37) #define SWITCH_ATTENUATION (setting.mode == M_GENHIGH && config.high_out_adf4350 ? 0 : 37 - config.switch_offset)
//#define POWER_OFFSET -18 // Max level with all enabled //#define POWER_OFFSET -18 // Max level with all enabled
//#define POWER_RANGE 70 //#define POWER_RANGE 70
#define MAX_DRIVE (setting.mode == M_GENHIGH && config.high_out_adf4350 ? 3 : 18) #define MAX_DRIVE (setting.mode == M_GENHIGH && config.high_out_adf4350 ? 3 : 18)
@ -99,7 +99,7 @@ const int8_t drive_dBm [16] = {-38, -32, -30, -27, -24, -19, -15, -12, -5, -2, 0
#else #else
#define SWITCH_ATTENUATION 30 #define SWITCH_ATTENUATION (30 - config.switch_offset)
#define POWER_OFFSET 15 #define POWER_OFFSET 15
#define MAX_DRIVE (setting.mode == M_GENHIGH ? 15 : 11) #define MAX_DRIVE (setting.mode == M_GENHIGH ? 15 : 11)
#define MIN_DRIVE 8 #define MIN_DRIVE 8
@ -4516,35 +4516,39 @@ void calibrate(void)
in_selftest = true; in_selftest = true;
reset_calibration(); reset_calibration();
reset_settings(M_LOW); reset_settings(M_LOW);
for (int j= 0; j < CALIBRATE_RBWS; j++ ) { for (int k = 0; k<2; k++) {
// set_RBW(power_rbw[j]); for (int j= 0; j < CALIBRATE_RBWS; j++ ) {
// set_sweep_points(21); // set_RBW(power_rbw[j]);
test_prepare(TEST_POWER); // set_sweep_points(21);
setting.step_delay_mode = SD_PRECISE; test_prepare(TEST_POWER);
setting.step_delay_mode = SD_PRECISE;
#ifndef TINYSA4 #ifndef TINYSA4
setting.agc = S_OFF; setting.agc = S_OFF;
setting.lna = S_OFF; setting.lna = S_OFF;
#endif #endif
test_acquire(TEST_POWER); // Acquire test test_acquire(TEST_POWER); // Acquire test
local_test_status = test_validate(TEST_POWER); // Validate test local_test_status = test_validate(TEST_POWER); // Validate test
if (peakLevel < -50) { if (k ==0 || k == 1) {
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED); if (peakLevel < -50) {
ili9341_drawstring_7x13("Signal level too low", 30, 140); ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
ili9341_drawstring_7x13("Check cable between High and Low connectors", 30, 160); ili9341_drawstring_7x13("Signal level too low", 30, 140);
goto quit; ili9341_drawstring_7x13("Check cable between High and Low connectors", 30, 160);
} goto quit;
// chThdSleepMilliseconds(1000); }
if (local_test_status != TS_PASS) { // chThdSleepMilliseconds(1000);
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED); if (local_test_status != TS_PASS) {
ili9341_drawstring_7x13("Calibration failed", 30, 140); ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
goto quit; ili9341_drawstring_7x13("Calibration failed", 30, 140);
} else { goto quit;
} else {
#ifdef TINYSA4 #ifdef TINYSA4
set_actual_power(-30.0); // Should be -23.5dBm (V0.2) OR 25 (V0.3) set_actual_power(-30.0); // Should be -23.5dBm (V0.2) OR 25 (V0.3)
#else #else
set_actual_power(-25.0); // Should be -23.5dBm (V0.2) OR 25 (V0.3) set_actual_power(-25.0); // Should be -23.5dBm (V0.2) OR 25 (V0.3)
#endif #endif
chThdSleepMilliseconds(1000); chThdSleepMilliseconds(1000);
}
}
} }
} }
#if 0 // No high input calibration as CAL OUTPUT is unreliable #if 0 // No high input calibration as CAL OUTPUT is unreliable

19
ui.c

@ -26,7 +26,7 @@
#include <math.h> #include <math.h>
#pragma GCC push_options #pragma GCC push_options
#pragma GCC optimize ("Os") #pragma GCC optimize ("Og")
uistat_t uistat = { uistat_t uistat = {
digit: 6, digit: 6,
@ -1318,7 +1318,6 @@ menu_move_back(void)
if (current_menu_is_form()) { if (current_menu_is_form()) {
redraw_frame(); redraw_frame();
redraw_request |= REDRAW_BATTERY;
area_width = 0; area_width = 0;
} else { } else {
// redraw_frame(); // redraw_frame();
@ -1351,7 +1350,6 @@ menu_push_submenu(const menuitem_t *submenu)
ensure_selection(); ensure_selection();
if (menu_is_form(submenu)) { if (menu_is_form(submenu)) {
redraw_frame(); redraw_frame();
redraw_request |= REDRAW_BATTERY;
area_width = 0; area_width = 0;
} else { } else {
// redraw_frame(); // redraw_frame();
@ -1973,6 +1971,8 @@ draw_menu_buttons(const menuitem_t *menu)
ili9341_set_background(LCD_BG_COLOR); ili9341_set_background(LCD_BG_COLOR);
for (; y < MENU_BUTTON_MAX*MENU_BUTTON_HEIGHT; y+=MENU_BUTTON_HEIGHT) 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); ili9341_fill(LCD_WIDTH-MENU_BUTTON_WIDTH, y, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT);
// if (menu[i].type & MT_FORM)
// draw_battery_status();
} }
static systime_t prev_touch_time = 0; static systime_t prev_touch_time = 0;
@ -2028,7 +2028,7 @@ menu_select_touch(int i, int pos)
if (touch_x != prev_touch_x /* - 1 || prev_touch_x + 1 < touch_x */ ) { if (touch_x != prev_touch_x /* - 1 || prev_touch_x + 1 < touch_x */ ) {
keypad_mode = keypad; keypad_mode = keypad;
fetch_numeric_target(); fetch_numeric_target();
int new_slider = touch_x - LCD_WIDTH/2; volatile int new_slider = (int)touch_x - LCD_WIDTH/2; // Can have negative outcome
if (new_slider < - (MENU_FORM_WIDTH-8)/2) if (new_slider < - (MENU_FORM_WIDTH-8)/2)
new_slider = -(MENU_FORM_WIDTH-8)/2; new_slider = -(MENU_FORM_WIDTH-8)/2;
if (new_slider > (MENU_FORM_WIDTH-8)/2) if (new_slider > (MENU_FORM_WIDTH-8)/2)
@ -2044,7 +2044,9 @@ menu_select_touch(int i, int pos)
} }
} }
if (mode == SL_MOVE ) { if (mode == SL_MOVE ) {
uistat.value = uistat.value - setting.slider_position * (setting.slider_span/(MENU_FORM_WIDTH-8)) + new_slider * (setting.slider_span/(MENU_FORM_WIDTH-8)); uistat.value = uistat.value - setting.slider_position * ((int)setting.slider_span/(MENU_FORM_WIDTH-8)) + new_slider * ((int)setting.slider_span/(MENU_FORM_WIDTH-8));
if (uistat.value < 0)
uistat.value = 0;
if (uistat.value < minFreq) if (uistat.value < minFreq)
uistat.value = minFreq; uistat.value = minFreq;
if (uistat.value > maxFreq) if (uistat.value > maxFreq)
@ -2123,6 +2125,7 @@ menu_select_touch(int i, int pos)
if (dt > BUTTON_DOWN_LONG_TICKS || do_exit) { if (dt > BUTTON_DOWN_LONG_TICKS || do_exit) {
selection = -1; selection = -1;
draw_menu(); draw_menu();
redraw_request = 0; // Remove request to redraw grid
return; return;
} }
if (menu_is_form(menu) && MT_MASK(menu[i].type) == MT_KEYPAD && keypad == KM_LOWOUTLEVEL) { if (menu_is_form(menu) && MT_MASK(menu[i].type) == MT_KEYPAD && keypad == KM_LOWOUTLEVEL) {
@ -2148,10 +2151,10 @@ menu_select_touch(int i, int pos)
} else if (menu_is_form(menu) && MT_MASK(menu[i].type) == MT_KEYPAD && keypad == KM_CENTER) { } else if (menu_is_form(menu) && MT_MASK(menu[i].type) == MT_KEYPAD && keypad == KM_CENTER) {
switch (pos) { switch (pos) {
case 0: case 0:
step = -setting.slider_span; step = -(int)setting.slider_span;
break; break;
case 1: case 1:
step = -setting.slider_span/10; step = -(int)setting.slider_span/10;
break; break;
case 2: case 2:
goto nogo; goto nogo;
@ -2758,6 +2761,8 @@ ui_process_keypad(void)
ui_mode_menu(); //Reactivate menu after keypad ui_mode_menu(); //Reactivate menu after keypad
selection = -1; selection = -1;
ensure_selection(); ensure_selection();
// redraw_request = 0; // Clear all draw requests
redraw_request = REDRAW_BATTERY; // Only redraw battery
} else { } else {
ui_mode_normal(); ui_mode_normal();
// request_to_redraw_grid(); // request_to_redraw_grid();

@ -428,6 +428,7 @@ enum {
#ifdef TINYSA4 #ifdef TINYSA4
KM_LPF, KM_LPF,
#endif #endif
// #35
KM_NONE // always at enum end KM_NONE // always at enum end
}; };
@ -472,7 +473,7 @@ static const struct {
#endif #endif
{keypads_positive , "ATTACK"}, // KM_ATTACK {keypads_positive , "ATTACK"}, // KM_ATTACK
#ifdef TINYSA4 #ifdef TINYSA4
{keypads_freq , "ULTRA\nSTART"}, // KM_LPF #34 {keypads_freq , "ULTRA\nSTART"}, // KM_LPF
#endif #endif
}; };
#if 0 // Not used #if 0 // Not used

Loading…
Cancel
Save

Powered by TurnKey Linux.