Skip to content

Commit

Permalink
Fix lever button work
Browse files Browse the repository at this point in the history
Remove double usage
  • Loading branch information
DiSlord committed May 31, 2021
1 parent 6ad86e1 commit 7435245
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
11 changes: 6 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static float kaiser_data[FFT_SIZE];
#endif

#undef VERSION
#define VERSION "1.0.63"
#define VERSION "1.0.64"

// Version text, displayed in Config->Version menu, also send by info command
const char *info_about[]={
Expand Down Expand Up @@ -549,14 +549,15 @@ VNA_SHELL_FUNCTION(cmd_reset)
{
(void)argc;
(void)argv;

#ifdef __DFU_SOFTWARE_MODE__
if (argc == 1) {
if (get_str_index(argv[0], "dfu") == 0) {
shell_printf("Performing reset to DFU mode\r\n");
enter_dfu();
return;
}
}
#endif
shell_printf("Performing reset\r\n");

rccEnableWWDG(FALSE);
Expand Down Expand Up @@ -622,14 +623,14 @@ my_atof(const char *p)
neg = TRUE;
if (*p == '-' || *p == '+')
p++;
double x = my_atoi(p);
float x = my_atoi(p);
while (_isdigit((int)*p))
p++;
if (*p == '.') {
double d = 1.0f;
float d = 1.0f;
p++;
while (_isdigit((int)*p)) {
d /= 10;
d /= 10.0f;
x += d * (*p - '0');
p++;
}
Expand Down
7 changes: 3 additions & 4 deletions ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,11 @@ show_version(void)
}
}

#ifdef __DFU_SOFTWARE_MODE__
void
enter_dfu(void)
{
#ifdef __DFU_SOFTWARE_MODE__
touch_stop_watchdog();

int x = 5, y = 20;
lcd_set_foreground(LCD_FG_COLOR);
lcd_set_background(LCD_BG_COLOR);
Expand All @@ -547,8 +546,8 @@ enter_dfu(void)
// see __early_init in ./NANOVNA_STM32_F072/board.c
*((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) = BOOT_FROM_SYTEM_MEMORY_MAGIC;
NVIC_SystemReset();
#endif
}
#endif

static bool
select_lever_mode(int mode)
Expand Down Expand Up @@ -2721,7 +2720,7 @@ normal_apply_touch(int touch_x, int touch_y){
static void
ui_process_lever(void)
{
last_button = 0;
// last_button = 0;
uint16_t status = btn_check();
if (status == 0) return;
switch (ui_mode) {
Expand Down

0 comments on commit 7435245

Please sign in to comment.