Hold the knob to open a six-row menu: save/remove the playing camera as a favourite (12 NVS slots), play or forget favourites, choose the source (random insecam or favourites), time per camera, listing, screen and ring brightness, caption, and reboot into Wi-Fi setup. Settings live in NVS and override the Kconfig first-boot defaults. Camera URLs are stored with their COUNTER placeholder so favourites get a fresh cache-buster on every visit.
34 lines
1.1 KiB
C
34 lines
1.1 KiB
C
#pragma once
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include "insecam.h"
|
|
|
|
// Persistent settings (NVS namespace "widget"); Kconfig supplies first-boot defaults.
|
|
typedef enum { LISTING_MIXED = 0, LISTING_RATING, LISTING_NEW } listing_pref_t;
|
|
typedef enum { SOURCE_RANDOM = 0, SOURCE_FAVORITES } source_pref_t;
|
|
|
|
typedef struct {
|
|
uint16_t interval_s; // 5..300
|
|
uint8_t lcd_brightness; // 0..100
|
|
uint8_t led_brightness; // 0..255
|
|
uint8_t listing; // listing_pref_t
|
|
uint8_t source; // source_pref_t
|
|
uint8_t caption; // 1 = caption shown
|
|
} settings_t;
|
|
|
|
extern settings_t settings;
|
|
|
|
void settings_init(void); // nvs_flash_init + load settings and favourites
|
|
void settings_save(void);
|
|
|
|
// One-shot flag: reboot into the Wi-Fi setup hotspot.
|
|
void settings_request_portal(void);
|
|
bool settings_take_portal_request(void);
|
|
|
|
#define FAV_SLOTS 12
|
|
const cam_info_t *fav_get(int slot); // NULL when empty
|
|
void fav_set(int slot, const cam_info_t *cam);
|
|
void fav_clear(int slot);
|
|
int fav_find(const cam_info_t *cam); // slot holding this camera (by id), or -1
|
|
int fav_count(void);
|