From b3e8065857bb771b367ce2c05d52c42eb9616a90 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Tue, 31 Mar 2020 12:28:17 +0200 Subject: [PATCH] Small memory optim --- STM32F072xB.ld | 4 ++-- nanovna.h | 14 +++++++------- ui_sa.c | 49 +++++++++++++++++-------------------------------- 3 files changed, 26 insertions(+), 41 deletions(-) diff --git a/STM32F072xB.ld b/STM32F072xB.ld index 577e87f..b1f2ea2 100644 --- a/STM32F072xB.ld +++ b/STM32F072xB.ld @@ -19,14 +19,14 @@ */ MEMORY { - flash0 : org = 0x08000000, len = 96k + flash0 : org = 0x08000000, len = 104k flash1 : org = 0x00000000, len = 0 flash2 : org = 0x00000000, len = 0 flash3 : org = 0x00000000, len = 0 flash4 : org = 0x00000000, len = 0 flash5 : org = 0x00000000, len = 0 flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x08018000, len = 32k + flash7 : org = 0x0801C000, len = 16k ram0 : org = 0x20000000, len = 16k ram1 : org = 0x00000000, len = 0 ram2 : org = 0x00000000, len = 0 diff --git a/nanovna.h b/nanovna.h index 276df10..fd34c62 100644 --- a/nanovna.h +++ b/nanovna.h @@ -427,15 +427,15 @@ void show_logo(void); #if 1 #define SAVEAREA_MAX 5 // Begin addr 0x08018000 -#define SAVE_CONFIG_AREA_SIZE 0x00008000 +#define SAVE_CONFIG_AREA_SIZE 0x00000800 // config save area -#define SAVE_CONFIG_ADDR 0x08018000 +#define SAVE_CONFIG_ADDR 0x0801C000 // properties_t save area -#define SAVE_PROP_CONFIG_0_ADDR 0x08018800 -#define SAVE_PROP_CONFIG_1_ADDR 0x0801a000 -#define SAVE_PROP_CONFIG_2_ADDR 0x0801b800 -#define SAVE_PROP_CONFIG_3_ADDR 0x0801d000 -#define SAVE_PROP_CONFIG_4_ADDR 0x0801e800 +#define SAVE_PROP_CONFIG_0_ADDR 0x0801C800 +#define SAVE_PROP_CONFIG_1_ADDR 0x0801D000 +#define SAVE_PROP_CONFIG_2_ADDR 0x0801D800 +#define SAVE_PROP_CONFIG_3_ADDR 0x0801E000 +#define SAVE_PROP_CONFIG_4_ADDR 0x0801E800 #else #define SAVEAREA_MAX 4 // Begin addr 0x0801C000 diff --git a/ui_sa.c b/ui_sa.c index 7d479e8..1b3d87a 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -780,8 +780,7 @@ static void menu_item_modify_attribute( int mark = false; if (menu == menu_mode) { if (item == GetMode()+1) { - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } else if (item == 5) { plot_printf(uistat.text, sizeof uistat.text, menu_reffer_text[get_refer_output()+1]); } @@ -793,73 +792,59 @@ static void menu_item_modify_attribute( } } else if (menu == menu_reffer) { if (item < 5 && item == get_refer_output() + 1){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; - } + mark = true; + } } else if (menu == menu_reffer2) { if (item == get_refer_output() - 4){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } } else if (menu == menu_stimulus) { if (item == 5 /* PAUSE */ && !(sweep_mode&SWEEP_ENABLE)) { - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } } else if (menu == menu_scale) { #if 0 if (item == 4 /* Spur reduction */ && GetSpur()) { - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; - } + mark = true; + } #endif } else if (menu == menu_average) { if (item == GetAverage()){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } } else if (menu == menu_dBper) { if (menu_dBper_value[item] == get_trace_scale(1)){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } } else if (menu == menu_rbw) { if (rbwsel[item] == GetRBW()){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } } else if (menu == menu_drive || menu == menu_drive_wide) { if (item == setting_drive){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } } else if (menu == menu_storage) { if (item ==0 && GetStorage()){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } if (item == 2 && GetSubtractStorage()){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } if (item == 3 && get_waterfall()){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } } else if (menu == menu_settings2 || menu == menu_settingshigh2) { if (item ==0 && setting_agc){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } if (item == 1 && setting_lna){ - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } if (item == 2 && setting_tracking){ // should not happen in high mode - *bg = DEFAULT_MENU_TEXT_COLOR; - *fg = config.menu_normal_color; + mark = true; } } if (mark) {