Large buttons and mode switching improvements

tinySA
erikkaashoek 6 years ago
parent 8dcf6a6b59
commit bab7701458

@ -592,6 +592,16 @@ void ili9341_drawstring(const char *str, int x, int y)
} }
} }
void ili9341_drawstring_7x13(const char *str, int x, int y)
{
while (*str) {
uint8_t ch = *str++;
const uint16_t *char_buf = &x7x13b_bits[(ch * 13)];
blit16BitWidthBitmap(x, y, 7, 11, char_buf);
x += 7;
}
}
void ili9341_drawstringV(const char *str, int x, int y) void ili9341_drawstringV(const char *str, int x, int y)
{ {
ili9341_set_rotation(DISPLAY_ROTATION_270); ili9341_set_rotation(DISPLAY_ROTATION_270);

@ -75,7 +75,7 @@ int settingSpur = 0;
int settingAverage = 0; int settingAverage = 0;
int settingShowStorage = 0; int settingShowStorage = 0;
int settingSubtractStorage = 0; int settingSubtractStorage = 0;
int settingMode = -1; // Initialize to unknown state int settingMode = M_LOW;
int settingDrive=0; // 0-3 , 3=+20dBm int settingDrive=0; // 0-3 , 3=+20dBm
int settingAGC = true; int settingAGC = true;
int settingLNA = false; int settingLNA = false;
@ -309,31 +309,35 @@ void SetMode(int m)
settingMode = m; settingMode = m;
switch(m) { switch(m) {
case M_LOW: case M_LOW:
minFreq = 0;
maxFreq = 520000000;
set_sweep_frequency(ST_START, (int32_t) 0); set_sweep_frequency(ST_START, (int32_t) 0);
set_sweep_frequency(ST_STOP, (int32_t) 300000000); set_sweep_frequency(ST_STOP, (int32_t) 300000000);
SetRefpos(-10); SetRefpos(-10);
goto min_max_low; settingSpur = 0; // Not for output mode
break;
case M_GENLOW: case M_GENLOW:
minFreq = 0;
maxFreq = 520000000;
set_sweep_frequency(ST_CENTER, (int32_t) 10000000); set_sweep_frequency(ST_CENTER, (int32_t) 10000000);
set_sweep_frequency(ST_SPAN, 0); set_sweep_frequency(ST_SPAN, 0);
settingSpur = 0; // Not for output mode settingSpur = 0; // Not for output mode
settingRefer = -1; // No refer output in output mode settingRefer = -1; // No refer output in output mode
min_max_low:
minFreq = 0;
maxFreq = 520000000;
break; break;
case M_HIGH: case M_HIGH:
minFreq = 240000000;
maxFreq = 960000000;
set_sweep_frequency(ST_START, (int32_t) 300000000); set_sweep_frequency(ST_START, (int32_t) 300000000);
set_sweep_frequency(ST_STOP, (int32_t) 960000000); set_sweep_frequency(ST_STOP, (int32_t) 960000000);
SetRefpos(-30); SetRefpos(-30);
goto min_max_high; goto common_high;
case M_GENHIGH: case M_GENHIGH:
minFreq = 240000000;
maxFreq = 960000000;
set_sweep_frequency(ST_CENTER, (int32_t) 300000000); set_sweep_frequency(ST_CENTER, (int32_t) 300000000);
set_sweep_frequency(ST_SPAN, 0); set_sweep_frequency(ST_SPAN, 0);
settingRefer = -1; // No refer output in output mode settingRefer = -1; // No refer output in output mode
min_max_high: common_high:
minFreq = 240000000;
maxFreq = 960000000;
extraVFO = false; // Not possible in high mode extraVFO = false; // Not possible in high mode
settingSpur = 0; // Not possible in high mode settingSpur = 0; // Not possible in high mode
break; break;
@ -506,13 +510,14 @@ float perform(bool break_on_operation, int i, int32_t f, int extraV)
} }
SetRX(settingMode); SetRX(settingMode);
SI4432_SetReference(settingRefer); SI4432_SetReference(settingRefer);
if (local_IF)
setFreq (0, local_IF);
// if (dirty) { // if (dirty) {
scandirty = true; scandirty = true;
dirty = false; dirty = false;
// } // }
} }
if (i == 0 && ( scandirty || settingSpur) && local_IF)
setFreq (0, local_IF);
if (settingModulation == MO_AM) { if (settingModulation == MO_AM) {
int p = settingAttenuate * 2 + modulation_counter; int p = settingAttenuate * 2 + modulation_counter;
PE4302_Write_Byte(p); PE4302_Write_Byte(p);
@ -561,6 +566,10 @@ static bool sweep(bool break_on_operation)
again: again:
for (int i = 0; i < sweep_points; i++) { for (int i = 0; i < sweep_points; i++) {
RSSI = perform(break_on_operation, i, frequencies[i], extraVFO); RSSI = perform(break_on_operation, i, frequencies[i], extraVFO);
// back to toplevel to handle ui operation
if (operation_requested && break_on_operation)
return false;
if (settingSpur == 1) { // First pass if (settingSpur == 1) { // First pass
temp_t[i] = RSSI; temp_t[i] = RSSI;
continue; // Skip all other processing continue; // Skip all other processing
@ -590,29 +599,27 @@ again:
} }
} }
if (i == sweep_points -1) { if (i == sweep_points -1) {
if (scandirty) {
scandirty = false;
}
peakIndex = temppeakIndex;
peakLevel = actual_t[peakIndex];
peakFreq = frequencies[peakIndex];
settingSpur = -settingSpur;
int peak_marker = 0;
markers[peak_marker].enabled = true;
markers[peak_marker].index = peakIndex;
markers[peak_marker].frequency = frequencies[markers[peak_marker].index];
// redraw_marker(peak_marker, FALSE);
} }
// back to toplevel to handle ui operation
if (operation_requested && break_on_operation)
return false;
} }
if (settingSpur == 1) { if (settingSpur == 1) {
settingSpur = -1; settingSpur = -1;
goto again; goto again;
} else if (settingSpur == -1)
settingSpur = 1;
if (scandirty) {
scandirty = false;
} }
peakIndex = temppeakIndex;
peakLevel = actual_t[peakIndex];
peakFreq = frequencies[peakIndex];
int peak_marker = 0;
markers[peak_marker].enabled = true;
markers[peak_marker].index = peakIndex;
markers[peak_marker].frequency = frequencies[markers[peak_marker].index];
// redraw_marker(peak_marker, FALSE);
palSetPad(GPIOC, GPIOC_LED); palSetPad(GPIOC, GPIOC_LED);
return true; return true;
} }

14
ui.c

@ -1488,12 +1488,26 @@ draw_menu_buttons(const menuitem_t *menu)
ili9341_drawstring_size(text, active_button_start+5, y+8, 2); ili9341_drawstring_size(text, active_button_start+5, y+8, 2);
} 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
#ifdef BIG_BUTTON_FONT
#undef FONT_HEIGHT
#define FONT_HEIGHT 13
ili9341_fill(active_button_start+1, y+1, active_button_width-2, 13+13 -2, bg);
ili9341_drawstring_7x13(l1, active_button_start+2, y+1);
ili9341_drawstring_7x13(l2, active_button_start+2, y+1+13-1);
#else
ili9341_fill(active_button_start+3, y+5, active_button_width-6, 2+FONT_GET_HEIGHT+1+FONT_GET_HEIGHT+2, bg); ili9341_fill(active_button_start+3, y+5, active_button_width-6, 2+FONT_GET_HEIGHT+1+FONT_GET_HEIGHT+2, bg);
ili9341_drawstring(l1, active_button_start+5, y+7); ili9341_drawstring(l1, active_button_start+5, y+7);
ili9341_drawstring(l2, active_button_start+5, y+7+FONT_GET_HEIGHT+1); ili9341_drawstring(l2, active_button_start+5, y+7+FONT_GET_HEIGHT+1);
#endif
} else { } else {
#ifdef BIG_BUTTON_FONT
ili9341_fill(active_button_start+1, y+1, active_button_width-2, 13+13 -2, bg);
ili9341_drawstring_7x13(menu[i].label, active_button_start+2, y+6);
#else
ili9341_fill(active_button_start+3, y+8, active_button_width-6, 2+FONT_GET_HEIGHT+2, bg); ili9341_fill(active_button_start+3, y+8, active_button_width-6, 2+FONT_GET_HEIGHT+2, bg);
ili9341_drawstring(menu[i].label, active_button_start+5, y+10); ili9341_drawstring(menu[i].label, active_button_start+5, y+10);
#endif
} }
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.