Hangup in offset keypad solved

tinySA
erikkaashoek 6 years ago
parent ca8d1382f5
commit 5b661b9093

@ -6,7 +6,7 @@
# Compiler options here. # Compiler options here.
ifeq ($(USE_OPT),) ifeq ($(USE_OPT),)
USE_OPT = -Og -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage USE_OPT = -Og -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
# USE_OPT = -fdce -fdse -fmerge-constants -fstore-merging -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage # USE_OPT = -O2 -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
endif endif
# C specific options here (added to USE_OPT). # C specific options here (added to USE_OPT).

@ -26,6 +26,10 @@
//#define __SIMULATION__ //#define __SIMULATION__
//#define __PIPELINE__ //#define __PIPELINE__
#define __SCROLL__ #define __SCROLL__
#define __ICONS__
#define __MEASURE__
#define __SELFTEST__
/* /*
* main.c * main.c
*/ */

@ -1429,7 +1429,9 @@ draw_cell(int m, int n)
if (n == 0) if (n == 0)
cell_draw_marker_info(x0, y0); cell_draw_marker_info(x0, y0);
#endif #endif
#ifdef __SELFTEST__
cell_draw_test_info(x0, y0); cell_draw_test_info(x0, y0);
#endif
// PULSE; // PULSE;
// Draw reference position (<10 system ticks for all screen calls) // Draw reference position (<10 system ticks for all screen calls)
for (t = 0; t < TRACES_MAX; t++) { for (t = 0; t < TRACES_MAX; t++) {

@ -1045,6 +1045,7 @@ static bool sweep(bool break_on_operation)
} }
m++; // Try next marker m++; // Try next marker
} }
#ifdef __MEASURE__
if (setting_measurement == M_IMD && markers[0].index > 10) { if (setting_measurement == M_IMD && markers[0].index > 10) {
markers[1].enabled = search_maximum(1, frequencies[markers[0].index]*2, 8); markers[1].enabled = search_maximum(1, frequencies[markers[0].index]*2, 8);
markers[2].enabled = search_maximum(2, frequencies[markers[0].index]*3, 12); markers[2].enabled = search_maximum(2, frequencies[markers[0].index]*3, 12);
@ -1059,6 +1060,7 @@ static bool sweep(bool break_on_operation)
} else if (setting_measurement == M_PHASE_NOISE && markers[0].index > 10) { } else if (setting_measurement == M_PHASE_NOISE && markers[0].index > 10) {
markers[1].index = markers[0].index + (setting_mode == M_LOW ? 290/4 : -290/4); // Position phase noise marker at requested offset markers[1].index = markers[0].index + (setting_mode == M_LOW ? 290/4 : -290/4); // Position phase noise marker at requested offset
} }
#endif
peakIndex = max_index[0]; peakIndex = max_index[0];
peakLevel = actual_t[peakIndex]; peakLevel = actual_t[peakIndex];
peakFreq = frequencies[peakIndex]; peakFreq = frequencies[peakIndex];
@ -1249,6 +1251,7 @@ void draw_cal_status(void)
} }
// -------------------- Self testing ------------------------------------------------- // -------------------- Self testing -------------------------------------------------
#ifdef __SELFTEST__
enum { enum {
TC_SIGNAL, TC_BELOW, TC_ABOVE, TC_FLAT, TC_MEASURE, TC_SET, TC_END, TC_SIGNAL, TC_BELOW, TC_ABOVE, TC_FLAT, TC_MEASURE, TC_SET, TC_END,
@ -1569,10 +1572,13 @@ int add_spur(int f)
} }
return 1; return 1;
} }
#endif
void self_test(void) void self_test(void)
{ {
#if 0 #ifdef __SELFTEST__
#if 0
in_selftest = true; in_selftest = true;
reset_settings(M_LOW); reset_settings(M_LOW);
test_prepare(4); test_prepare(4);
@ -1698,6 +1704,8 @@ void self_test(void)
reset_settings(M_LOW); reset_settings(M_LOW);
in_selftest = false; in_selftest = false;
#endif #endif
#endif
} }
void reset_calibration(void) void reset_calibration(void)
@ -1710,6 +1718,7 @@ const int power_rbw [5] = { 100, 300, 30, 10, 3 };
void calibrate(void) void calibrate(void)
{ {
#ifdef __CALIBRATE__
int local_test_status; int local_test_status;
float last_peak_level; float last_peak_level;
in_selftest = true; in_selftest = true;
@ -1766,6 +1775,7 @@ quit:
sweep_mode = SWEEP_ENABLE; sweep_mode = SWEEP_ENABLE;
set_refer_output(0); set_refer_output(0);
reset_settings(M_LOW); reset_settings(M_LOW);
#endif
} }

@ -1567,10 +1567,12 @@ draw_menu_buttons(const menuitem_t *menu)
if (menu[i].type & MT_FORM) { if (menu[i].type & MT_FORM) {
ili9341_fill(active_button_start+2, y+2, active_button_width-4, FONT_GET_HEIGHT*2+8, bg); ili9341_fill(active_button_start+2, y+2, active_button_width-4, FONT_GET_HEIGHT*2+8, bg);
ili9341_drawstring_size(text, active_button_start+6, y+6, 2); ili9341_drawstring_size(text, active_button_start+6, y+6, 2);
#ifdef __ICONS__
if (menu[i].type & MT_ICON) { if (menu[i].type & MT_ICON) {
blit16BitWidthBitmap(240,y+6,16,16,&left_icons[((menu[i].data >>4)&0xf)*16]); blit16BitWidthBitmap(240,y+6,16,16,&left_icons[((menu[i].data >>4)&0xf)*16]);
blit16BitWidthBitmap(256,y+6,16,16,&right_icons[((menu[i].data >>0)&0xf)*16]); blit16BitWidthBitmap(256,y+6,16,16,&right_icons[((menu[i].data >>0)&0xf)*16]);
} }
#endif
} else { } else {
if (menu_is_multiline(menu[i].label, &l1, &l2)) { if (menu_is_multiline(menu[i].label, &l1, &l2)) {
#define BIG_BUTTON_FONT 1 #define BIG_BUTTON_FONT 1
@ -1841,11 +1843,15 @@ lever_move_marker(int status)
if (active_marker >= 0 && markers[active_marker].enabled) { if (active_marker >= 0 && markers[active_marker].enabled) {
if ((status & EVT_DOWN) && markers[active_marker].index > 0) { if ((status & EVT_DOWN) && markers[active_marker].index > 0) {
markers[active_marker].index -= step; markers[active_marker].index -= step;
if (markers[active_marker].index < 5)
markers[active_marker].index = 5 ;
markers[active_marker].frequency = frequencies[markers[active_marker].index]; markers[active_marker].frequency = frequencies[markers[active_marker].index];
redraw_marker(active_marker); redraw_marker(active_marker);
} }
if ((status & EVT_UP) && markers[active_marker].index < sweep_points-1) { if ((status & EVT_UP) && markers[active_marker].index < sweep_points-1) {
markers[active_marker].index += step; markers[active_marker].index += step;
if (markers[active_marker].index > POINTS_COUNT-5)
markers[active_marker].index = POINTS_COUNT-5 ;
markers[active_marker].frequency = frequencies[markers[active_marker].index]; markers[active_marker].frequency = frequencies[markers[active_marker].index];
redraw_marker(active_marker); redraw_marker(active_marker);
} }

@ -65,6 +65,7 @@ extern int setting_step_delay;
void blit16BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, void blit16BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
const uint16_t *bitmap); const uint16_t *bitmap);
const uint16_t left_icons [] = const uint16_t left_icons [] =
{ {
#define I_EMPTY 0*16 #define I_EMPTY 0*16
@ -333,7 +334,6 @@ const uint16_t right_icons [] =
0b0000000000000000, 0b0000000000000000,
}; };
enum { enum {
KM_START=1, KM_STOP, KM_CENTER, KM_SPAN, KM_CW, KM_REFPOS, KM_SCALE, KM_ATTENUATION, KM_START=1, KM_STOP, KM_CENTER, KM_SPAN, KM_CW, KM_REFPOS, KM_SCALE, KM_ATTENUATION,
KM_ACTUALPOWER, KM_IF, KM_SAMPLETIME, KM_DRIVE, KM_LOWOUTLEVEL, KM_DECAY, KM_NOISE, KM_10MHZ KM_ACTUALPOWER, KM_IF, KM_SAMPLETIME, KM_DRIVE, KM_LOWOUTLEVEL, KM_DECAY, KM_NOISE, KM_10MHZ
@ -454,7 +454,8 @@ static const char * const keypad_mode_label[] = {
#endif #endif
#ifdef __SA__ #ifdef __SA__
static const char * const keypad_mode_label[] = { static const char * const keypad_mode_label[] = {
"error", "START", "STOP", "CENTER", "SPAN", "CW FREQ", "REFPOS", "SCALE", "\2ATTENUATE\0 0-31dB", "ACTUALPOWER", "IF", "SAMPLE TIME", "DRIVE", "LEVEL", "LEVEL", "LEVEL" "error", "START", "STOP", "CENTER", "SPAN", "CW FREQ", "REFPOS", "SCALE", // 0-7
"\2ATTENUATE\0 0-31dB", "ACTUALPOWER", "IF", "SAMPLE TIME", "DRIVE", "LEVEL", "LEVEL", "LEVEL", "OFFSET" // 8-16
}; };
#endif #endif
@ -630,6 +631,7 @@ static void menu_measure_cb(int item, uint8_t data)
{ {
(void)item; (void)item;
menu_move_back(); menu_move_back();
#ifdef __MEASURE__
switch(data) { switch(data) {
case M_OFF: // Off case M_OFF: // Off
reset_settings(GetMode()); reset_settings(GetMode());
@ -682,6 +684,7 @@ static void menu_measure_cb(int item, uint8_t data)
break; break;
} }
#endif
// selection = -1; // selection = -1;
ui_mode_normal(); ui_mode_normal();
// draw_cal_status(); // draw_cal_status();

Loading…
Cancel
Save

Powered by TurnKey Linux.