Something went wrong. Try again.
A fork of https://github.com/crosspoint-reader/crosspoint-reader
Something went wrong. Try again.
1.1 kB · 38 lines
C
at master
123456789101112131415161718192021222324252627282930313233343536373839#pragma once#include <cstdint>#include <string>
class CrossPointState { // Static instance static CrossPointState instance;
public: static constexpr uint8_t SLEEP_RECENT_COUNT = 16;
std::string openEpubPath; uint16_t recentSleepImages[SLEEP_RECENT_COUNT] = {}; // circular buffer of recent wallpaper indices uint8_t recentSleepPos = 0; // next write slot uint8_t recentSleepFill = 0; // valid entries (0..SLEEP_RECENT_COUNT) uint8_t readerActivityLoadCount = 0; bool lastSleepFromReader = false;
// Returns true if idx was shown within the last checkCount picks. // Walks backwards from the most recently written slot. bool isRecentSleep(uint16_t idx, uint8_t checkCount) const;
void pushRecentSleep(uint16_t idx); ~CrossPointState() = default;
// Get singleton instance static CrossPointState& getInstance() { return instance; }
bool saveToFile() const;
bool loadFromFile();
private: bool loadFromBinaryFile();};
// Helper macro to access settings#define APP_STATE CrossPointState::getInstance()