diff --git a/main.c b/main.c index 82d04a6..a9688dd 100644 --- a/main.c +++ b/main.c @@ -2208,13 +2208,13 @@ VNA_SHELL_FUNCTION(cmd_color) #if CH_CFG_USE_REGISTRY == FALSE #error "Threads Requite enabled CH_CFG_USE_REGISTRY in chconf.h" #endif +static const char *states[] = {CH_STATE_NAMES}; VNA_SHELL_FUNCTION(cmd_threads) { - static const char *states[] = {CH_STATE_NAMES}; thread_t *tp; (void)argc; (void)argv; - shell_printf("stklimit| |stk free| addr|refs|prio| state| name"VNA_SHELL_NEWLINE_STR); + shell_printf("stklimit| |stk free| addr|refs|prio| state| name"VNA_SHELL_NEWLINE_STR); tp = chRegFirstThread(); do { uint32_t max_stack_use = 0U; @@ -2783,8 +2783,8 @@ void hard_fault_handler_c(uint32_t *sp) uint32_t pc = sp[6]; uint32_t psr = sp[7]; int y = 0; - int x = 20; - static char buf[16]; + int x = OFFSETX + 1; + static char buf[96]; ili9341_set_background(0x0000); ili9341_set_foreground(0xFFFF); @@ -2805,7 +2805,27 @@ void hard_fault_handler_c(uint32_t *sp) plot_printf(buf, sizeof(buf), "LR 0x%08x", lr);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); plot_printf(buf, sizeof(buf), "PC 0x%08x", pc);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); plot_printf(buf, sizeof(buf), "PSR 0x%08x", psr);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - +#ifdef ENABLE_THREADS_COMMAND + thread_t *tp; + tp = chRegFirstThread(); + do { + uint32_t max_stack_use = 0U; +#if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || (CH_CFG_USE_DYNAMIC == TRUE) + uint32_t stklimit = (uint32_t)tp->wabase; +#if CH_DBG_FILL_THREADS == TRUE + uint8_t *p = (uint8_t *)tp->wabase; while(p[max_stack_use]==CH_DBG_STACK_FILL_VALUE) max_stack_use++; +#endif +#else + uint32_t stklimit = 0U; +#endif + plot_printf(buf, sizeof(buf), "%08x|%08x|%08x|%08x|%4u|%4u|%9s|%12s", + stklimit, (uint32_t)tp->ctx.sp, max_stack_use, (uint32_t)tp, + (uint32_t)tp->refs - 1, (uint32_t)tp->prio, states[tp->state], + tp->name == NULL ? "" : tp->name); + ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); + tp = chRegNextThread(tp); + } while (tp != NULL); +#endif shell_printf("===================================\r\n"); #else (void)sp; diff --git a/sa_core.c b/sa_core.c index 202c935..7eb5704 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1322,40 +1322,22 @@ float perform(bool break_on_operation, int i, uint32_t f, int tracking) // M // ----------------------------------------------------- modulation for output modes --------------------------------------- if (MODE_OUTPUT(setting.mode)){ if (setting.modulation == MO_AM_1kHz || setting.modulation == MO_AM_10Hz) { // AM modulation - int p = setting.attenuate * 2 + am_modulation[modulation_counter]; - if (p>63) - p = 63; - if (p<0) - p = 0; + int p = setting.attenuate * 2 + am_modulation[modulation_counter++]; + if (p>63) p = 63; + else if (p< 0) p = 0; PE4302_Write_Byte(p); - if (modulation_counter == 4) { // 3dB modulation depth + if (modulation_counter == 5) // 3dB modulation depth modulation_counter = 0; - } else { - modulation_counter++; - } - if (setting.modulation == MO_AM_10Hz) - my_microsecond_delay(20000); - else - my_microsecond_delay(180); -// chThdSleepMicroseconds(200); + my_microsecond_delay(setting.modulation == MO_AM_10Hz ? 20000 : 180); } else if (setting.modulation == MO_NFM || setting.modulation == MO_WFM ) { //FM modulation SI4432_Sel = 1; - int offset; - if (setting.modulation == MO_NFM ) { - offset = nfm_modulation[modulation_counter] ; - SI4432_Write_Byte(SI4432_FREQ_OFFSET1, (offset & 0xff )); // Use frequency hopping channel for FM modulation - SI4432_Write_Byte(SI4432_FREQ_OFFSET2, ((offset >> 8) & 0x03 )); // Use frequency hopping channel for FM modulation - } - else { - offset = wfm_modulation[modulation_counter] ; - SI4432_Write_Byte(SI4432_FREQ_OFFSET1, (offset & 0xff )); // Use frequency hopping channel for FM modulation - SI4432_Write_Byte(SI4432_FREQ_OFFSET2, ((offset >> 8) & 0x03 )); // Use frequency hopping channel for FM modulation - } - if (modulation_counter == 4) + int offset = setting.modulation == MO_NFM ? nfm_modulation[modulation_counter] : wfm_modulation[modulation_counter] ; + SI4432_Write_Byte(SI4432_FREQ_OFFSET1, (offset & 0xff )); // Use frequency hopping channel for FM modulation + SI4432_Write_Byte(SI4432_FREQ_OFFSET2, ((offset >> 8) & 0x03 )); // Use frequency hopping channel for FM modulation + modulation_counter++; + if (modulation_counter == 5) // 3dB modulation depth modulation_counter = 0; - else - modulation_counter++; my_microsecond_delay(200); // chThdSleepMicroseconds(200); } diff --git a/ui.c b/ui.c index 0f49589..8483d3a 100644 --- a/ui.c +++ b/ui.c @@ -1907,29 +1907,22 @@ ui_mode_normal(void) static void lever_move_marker(int status) { - int step = 1; - int count = 0; + uint16_t step = 1<<2; do { if (active_marker >= 0 && markers[active_marker].enabled) { - if ((status & EVT_DOWN) && markers[active_marker].index > 0) { - markers[active_marker].index -= step; + if (status & EVT_DOWN) { + markers[active_marker].index -= step>>2; if (markers[active_marker].index < 0) markers[active_marker].index = 0 ; - markers[active_marker].frequency = frequencies[markers[active_marker].index]; - redraw_marker(active_marker); } - if ((status & EVT_UP) && markers[active_marker].index < sweep_points-1) { - markers[active_marker].index += step; + if (status & EVT_UP) { + markers[active_marker].index += step>>2; if (markers[active_marker].index > sweep_points-1) markers[active_marker].index = sweep_points-1 ; - markers[active_marker].frequency = frequencies[markers[active_marker].index]; - redraw_marker(active_marker); - } - count++; - if (count > 10) { - step *= 2; - count = 0; } + markers[active_marker].frequency = frequencies[markers[active_marker].index]; + redraw_marker(active_marker); + step++; } status = btn_wait_release(); } while (status != 0); diff --git a/ui_sa.c b/ui_sa.c index 9faf6a1..425c356 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1679,11 +1679,6 @@ static void menu_item_modify_attribute( if (item == 5 && get_waterfall()){ mark = true; } -#ifdef __SPUR__ - if (item == 5 && setting.spur) { - mark = true; - } -#endif } else if (menu == menu_settings) { if (item ==0 && setting.tracking_output){ mark = true;