mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
move enter dfu to submenu of config
This commit is contained in:
parent
5e9756e4e0
commit
73e0c19e8e
|
|
@ -73,12 +73,16 @@ void __early_init(void) {
|
||||||
if ( *((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) == BOOT_FROM_SYTEM_MEMORY_MAGIC ) {
|
if ( *((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) == BOOT_FROM_SYTEM_MEMORY_MAGIC ) {
|
||||||
// require irq
|
// require irq
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
|
// reset magic bytes
|
||||||
*((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) = 0;
|
*((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) = 0;
|
||||||
// remap memory. unneeded for F072?
|
// remap memory. unneeded for F072?
|
||||||
// RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
|
// RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
|
||||||
// SYSCFG->CFGR1 = 0x01;
|
// SYSCFG->CFGR1 = 0x01;
|
||||||
|
// set msp for system memory
|
||||||
__set_MSP(SYSTEM_BOOT_MSP);
|
__set_MSP(SYSTEM_BOOT_MSP);
|
||||||
|
// jump to system memory
|
||||||
( (void (*)(void)) (*((uint32_t *)(STM32F072xB_SYSTEM_MEMORY+4))) )();
|
( (void (*)(void)) (*((uint32_t *)(STM32F072xB_SYSTEM_MEMORY+4))) )();
|
||||||
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//si5351_setup();
|
//si5351_setup();
|
||||||
|
|
|
||||||
22
ui.c
22
ui.c
|
|
@ -421,11 +421,12 @@ enter_dfu(void)
|
||||||
|
|
||||||
int x = 5, y = 5;
|
int x = 5, y = 5;
|
||||||
|
|
||||||
|
// leave a last message
|
||||||
ili9341_fill(0, 0, 320, 240, 0);
|
ili9341_fill(0, 0, 320, 240, 0);
|
||||||
ili9341_drawstring_5x7("DFU: Device Firmware Update Mode", x, y += 10, 0xffff, 0x0000);
|
ili9341_drawstring_5x7("DFU: Device Firmware Update Mode", x, y += 10, 0xffff, 0x0000);
|
||||||
ili9341_drawstring_5x7("To exit DFU, please reset device yourself.", x, y += 10, 0xffff, 0x0000);
|
ili9341_drawstring_5x7("To exit DFU mode, please reset device yourself.", x, y += 10, 0xffff, 0x0000);
|
||||||
|
|
||||||
// see __early_init in NANOVNA_STM32_F072/board.c
|
// see __early_init in ./NANOVNA_STM32_F072/board.c
|
||||||
*((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) = BOOT_FROM_SYTEM_MEMORY_MAGIC;
|
*((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) = BOOT_FROM_SYTEM_MEMORY_MAGIC;
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
|
|
@ -541,7 +542,14 @@ menu_config_cb(int item)
|
||||||
redraw_frame();
|
redraw_frame();
|
||||||
request_to_redraw_grid();
|
request_to_redraw_grid();
|
||||||
draw_menu();
|
draw_menu();
|
||||||
case 4:
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
menu_dfu_cb(int item)
|
||||||
|
{
|
||||||
|
switch (item) {
|
||||||
|
case 0:
|
||||||
enter_dfu();
|
enter_dfu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -916,12 +924,18 @@ const menuitem_t menu_recall[] = {
|
||||||
{ MT_NONE, NULL, NULL } // sentinel
|
{ MT_NONE, NULL, NULL } // sentinel
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const menuitem_t menu_dfu[] = {
|
||||||
|
{ MT_CALLBACK, "\2RESET AND\0ENTER DFU", menu_dfu_cb },
|
||||||
|
{ MT_CANCEL, S_LARROW"CANCEL", NULL },
|
||||||
|
{ MT_NONE, NULL, NULL } // sentinel
|
||||||
|
};
|
||||||
|
|
||||||
const menuitem_t menu_config[] = {
|
const menuitem_t menu_config[] = {
|
||||||
{ MT_CALLBACK, "TOUCH CAL", menu_config_cb },
|
{ MT_CALLBACK, "TOUCH CAL", menu_config_cb },
|
||||||
{ MT_CALLBACK, "TOUCH TEST", menu_config_cb },
|
{ MT_CALLBACK, "TOUCH TEST", menu_config_cb },
|
||||||
{ MT_CALLBACK, "SAVE", menu_config_cb },
|
{ MT_CALLBACK, "SAVE", menu_config_cb },
|
||||||
{ MT_CALLBACK, "VERSION", menu_config_cb },
|
{ MT_CALLBACK, "VERSION", menu_config_cb },
|
||||||
{ MT_CALLBACK, "ENTER DFU", menu_config_cb },
|
{ MT_SUBMENU, S_RARROW"DFU", menu_dfu },
|
||||||
{ MT_CANCEL, S_LARROW" BACK", NULL },
|
{ MT_CANCEL, S_LARROW" BACK", NULL },
|
||||||
{ MT_NONE, NULL, NULL } // sentinel
|
{ MT_NONE, NULL, NULL } // sentinel
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue