Refresh app slots during UV Studio updates

This commit is contained in:
Armel FAUVEAU committed 2026-09-18 04:59:17 +02:00
1 parent 7d0f2646f4
commit fd437ec015
4 files changed
+49 -7

No files matched your search

+2
View File
@@ -1304,6 +1304,8 @@ void UART_HandleCommand(uint32_t Port)
gSerialConfigCountDown_500ms = 12; // keep serial mode alive (6 s)
uint8_t slot = pUART_Command->Data[0];
uint8_t status = APP_ValidateSlot(slot, NULL);
if (status == APP_OK)
APP_NotifySlotChanged();
struct __attribute__((packed)) {
Header_t Header;
uint8_t Slot;
+29 -6
View File
@@ -21,6 +21,7 @@
#include <string.h>
#include "apps/app_menu.h"
#include "app/app.h"
#include "app/uart.h"
#include "driver/backlight.h"
#include "driver/st7565.h"
#include "driver/keyboard.h"
@@ -80,12 +81,21 @@ static void app_invert_name(uint8_t line)
/* Debounced blocking key read, then wait for release (mirrors mb_get_key). */
static KEY_Code_t app_get_key(void)
{
#if defined(ENABLE_UART) || defined(ENABLE_USB)
const uint8_t slot_revision = APP_SlotRevision();
#endif
for (;;)
{
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
/* APP_MenuOpen() is modal and does not return to APP_Update(). Keep
* serial key injection and the viewer connection alive while waiting. */
K5VIEWER_ParseInput();
#endif
#if defined(ENABLE_UART) || defined(ENABLE_USB)
UART_ServiceCommands();
if (APP_SlotRevision() != slot_revision)
return KEY_INVALID;
#endif
APP_ModalBacklightTick(true);
@@ -219,6 +229,16 @@ static void app_show_error(const app_header_t *header, uint8_t rc)
_Static_assert(APP_MENU_SLOT_COUNT <= APP_SLOT_COUNT,
"APP_MENU_SLOT_COUNT exceeds the physical app slot count");
static void app_scan_slots(app_header_t hdr[APP_MENU_SLOT_COUNT],
bool installed[APP_MENU_SLOT_COUNT])
{
for (uint8_t slot = 0; slot < APP_MENU_SLOT_COUNT; slot++)
{
installed[slot] = APP_SlotInfo(slot, &hdr[slot]) == APP_OK &&
(hdr[slot].flags & APP_FLAG_COMMITTED);
}
}
void APP_MenuOpen(void)
{
APP_ModalScreenSaverExit();
@@ -238,12 +258,8 @@ void APP_MenuOpen(void)
* visible and selectable while scrolling. */
app_header_t hdr[APP_MENU_SLOT_COUNT];
bool installed[APP_MENU_SLOT_COUNT];
for (uint8_t slot = 0; slot < APP_MENU_SLOT_COUNT; slot++)
{
installed[slot] = APP_SlotInfo(slot, &hdr[slot]) == APP_OK &&
(hdr[slot].flags & APP_FLAG_COMMITTED);
}
uint8_t slot_revision = APP_SlotRevision();
app_scan_slots(hdr, installed);
/* Remember the physical slot and scrolling window across menu openings. */
static uint8_t sel = 0;
@@ -254,6 +270,13 @@ void APP_MenuOpen(void)
for (;;)
{
const uint8_t current_revision = APP_SlotRevision();
if (current_revision != slot_revision)
{
app_scan_slots(hdr, installed);
slot_revision = current_revision;
}
UI_DisplayClear();
app_status_bar(); /* also wipes the VFO status line (DW, battery, ...) */
+13 -1
View File
@@ -937,6 +937,18 @@ uint8_t APP_ValidateSlot(uint8_t slot, app_header_t *out_header)
static bool app_shortcuts_cached;
static uint8_t app_shortcut_mask;
static uint8_t app_shortcut_slots[4];
static uint8_t app_slot_revision;
uint8_t APP_SlotRevision(void)
{
return app_slot_revision;
}
void APP_NotifySlotChanged(void)
{
app_shortcuts_cached = false;
app_slot_revision++;
}
static int8_t app_shortcut_index(uint8_t shortcut)
{
@@ -1238,7 +1250,7 @@ uint8_t APP_SlotErase(uint8_t slot)
for (uint32_t off = 0; off < APP_SLOT_STRIDE; off += APP_SECTOR_SIZE)
PY25Q16_SectorErase(base + off);
PY25Q16_InvalidateCache();
app_shortcuts_cached = false;
APP_NotifySlotChanged();
return APP_OK;
}
+5
View File
@@ -131,5 +131,10 @@ uint8_t APP_SlotInfo(uint8_t slot, app_header_t *out_header);
uint8_t APP_SlotErase(uint8_t slot);
uint8_t APP_SlotWrite(uint8_t slot, uint32_t offset, const uint8_t *data, uint32_t len);
/* Change token used by the modal Apps selector. A completed host install is
* published after validation; erasing a slot publishes directly. */
uint8_t APP_SlotRevision(void);
void APP_NotifySlotChanged(void);
#endif /* APPS_APP_OVERLAY_H */