19 bool operator()(uint32_t a, uint32_t b)
const {
return a < b; }
32 bool draw(uint32_t adjustable_time,
Frame *dst);
33 bool draw(uint32_t adjustable_time,
CRGB *leds);
34 bool insert(uint32_t frameNumber, FramePtr frame) {
36 mFrames.insert(frameNumber, frame, &result);
37 return result != InsertResult::kMaxSize;
41 void clear() { mFrames.clear(); }
43 bool empty()
const {
return mFrames.empty(); }
45 bool has(uint32_t frameNum)
const {
return mFrames.has(frameNum); }
47 FramePtr erase(uint32_t frameNum) {
49 auto it = mFrames.find(frameNum);
50 if (it == mFrames.end()) {
58 FramePtr get(uint32_t frameNum)
const {
59 auto it = mFrames.find(frameNum);
60 if (it != mFrames.end()) {
66 bool full()
const {
return mFrames.full(); }
67 size_t capacity()
const {
return mFrames.capacity(); }
71 bool needsFrame(uint32_t now, uint32_t *currentFrameNumber,
72 uint32_t *nextFrameNumber)
const {
73 mFrameTracker.get_interval_frames(now, currentFrameNumber,
75 return !has(*currentFrameNumber) || !has(*nextFrameNumber);
78 bool get_newest_frame_number(uint32_t *frameNumber)
const {
79 if (mFrames.empty()) {
82 auto &front = mFrames.back();
83 *frameNumber = front.first;
87 bool get_oldest_frame_number(uint32_t *frameNumber)
const {
88 if (mFrames.empty()) {
91 auto &front = mFrames.front();
92 *frameNumber = front.first;
96 uint32_t get_exact_timestamp_ms(uint32_t frameNumber)
const {
97 return mFrameTracker.get_exact_timestamp_ms(frameNumber);
100 FrameTracker &getFrameTracker() {
return mFrameTracker; }
104 FrameTracker mFrameTracker;