2026-10-13 01:52:34 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "logic/bitmap_format.h"
|
|
|
|
|
|
|
|
|
|
// Full screen bitmaps (84 x 19, see logic/bitmap_format.h): built-in ones from
|
|
|
|
|
// display/bitmaps.h and the ones uploaded in the web UI, stored on LittleFS
|
2026-10-15 19:43:59 +02:00
|
|
|
// (partition "spiffs" in partitions.csv) as /bitmaps/<name>.bin. Bitmaps and dynamic
|
|
|
|
|
// pages share one namespace: app.cpp checks that a new name is not taken.
|
2026-10-13 01:52:34 +02:00
|
|
|
|
|
|
|
|
struct BitmapInfo
|
|
|
|
|
{
|
|
|
|
|
String name;
|
|
|
|
|
bool builtin;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const int MAX_BITMAPS = 200;
|
|
|
|
|
|
|
|
|
|
// Mounts LittleFS (formats it the first time). False without the partition (old flash
|
|
|
|
|
// layout): only the built-in bitmaps are available then.
|
|
|
|
|
bool bitmapStoreBegin();
|
2026-10-15 19:43:59 +02:00
|
|
|
// (LittleFS is shared with display/page_store and display/font_store)
|
2026-10-13 01:52:34 +02:00
|
|
|
bool bitmapStorageAvailable();
|
|
|
|
|
void bitmapStorageUsage(size_t &used, size_t &total);
|
2026-10-15 19:43:59 +02:00
|
|
|
// The valid names of the files with this extension in a LittleFS directory
|
|
|
|
|
std::vector<String> storedNames(const char *dir, const char *extension);
|
2026-10-13 01:52:34 +02:00
|
|
|
|
|
|
|
|
std::vector<BitmapInfo> listBitmaps();
|
2026-10-15 01:29:01 +02:00
|
|
|
// Changes each time a bitmap is saved or deleted
|
|
|
|
|
uint32_t bitmapListRevision();
|
2026-10-13 01:52:34 +02:00
|
|
|
bool bitmapExists(const char *name);
|
2026-10-16 22:03:18 +02:00
|
|
|
// Without reading the storage
|
|
|
|
|
bool builtinBitmap(const char *name);
|
2026-10-13 01:52:34 +02:00
|
|
|
bool loadBitmap(const char *name, uint8_t *bitmap);
|
|
|
|
|
|
|
|
|
|
// Return nullptr on success, otherwise a message for the user
|
|
|
|
|
const char *saveBitmap(const char *name, const uint8_t *bitmap);
|
|
|
|
|
const char *deleteBitmap(const char *name);
|