## Summary * Fix issue with 2-bit bmp rendering * Add support generate book cover BMP from JPG and use as sleep screen ## Additional Context * It does not support other image formats beyond JPG at this point * Something is cooked with my JpegToBmpConverter logic, it generates weird interlaced looking images for some JPGs | Book 1 | Book 2| | --- | --- | |  |  |
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#pragma once
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/semphr.h>
|
|
#include <freertos/task.h>
|
|
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "../Activity.h"
|
|
|
|
class CrossPointSettings;
|
|
|
|
enum class SettingType { TOGGLE, ENUM };
|
|
|
|
// Structure to hold setting information
|
|
struct SettingInfo {
|
|
const char* name; // Display name of the setting
|
|
SettingType type; // Type of setting
|
|
uint8_t CrossPointSettings::* valuePtr; // Pointer to member in CrossPointSettings (for TOGGLE/ENUM)
|
|
std::vector<std::string> enumValues;
|
|
};
|
|
|
|
class SettingsActivity final : public Activity {
|
|
TaskHandle_t displayTaskHandle = nullptr;
|
|
SemaphoreHandle_t renderingMutex = nullptr;
|
|
bool updateRequired = false;
|
|
int selectedSettingIndex = 0; // Currently selected setting
|
|
const std::function<void()> onGoHome;
|
|
|
|
static void taskTrampoline(void* param);
|
|
[[noreturn]] void displayTaskLoop();
|
|
void render() const;
|
|
void toggleCurrentSetting();
|
|
|
|
public:
|
|
explicit SettingsActivity(GfxRenderer& renderer, InputManager& inputManager, const std::function<void()>& onGoHome)
|
|
: Activity(renderer, inputManager), onGoHome(onGoHome) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
};
|