Files
Juli 33089b95ab Wheel side setting: rotate the display 180° for left-handed use
Hardware mirror in the ST7789 (rotation 3 <-> rotation 1); the 35-px
window offset is the same both ways. Stored in settings v3.
2026-09-17 15:52:56 +02:00

40 lines
1.6 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_POPULAR } source_pref_t;
typedef enum { PROVIDER_PREF_INSECAM = 0, PROVIDER_PREF_OPENTOPIA, PROVIDER_PREF_MIXED } provider_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
uint8_t provider; // provider_pref_t (appended; older blobs load with the default)
uint8_t version; // SETTINGS_VERSION; lets us tell a pre-provider blob apart
uint8_t theme; // ui theme index
uint8_t flip; // 1 = screen rotated 180° (knob on the left)
} settings_t;
#define SETTINGS_VERSION 3
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 100
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);