Rewrote the AI slop
This commit is contained in:
+13
-15
@@ -4,28 +4,26 @@
|
||||
#include <Arduino.h>
|
||||
#include <U8g2lib.h>
|
||||
|
||||
#include "screens.h"
|
||||
struct Screen
|
||||
{
|
||||
void (*draw)(U8G2 &u8g2);
|
||||
};
|
||||
|
||||
class Carousel {
|
||||
public:
|
||||
class Carousel
|
||||
{
|
||||
public:
|
||||
Carousel(Screen *screens, size_t screenCount);
|
||||
|
||||
void begin(unsigned long now);
|
||||
void update(unsigned long now);
|
||||
void next(unsigned long now);
|
||||
void render(U8X8 &display) const;
|
||||
void draw(U8G2 &u8g2);
|
||||
bool consumeDirty();
|
||||
void nextScreen();
|
||||
void update(unsigned long now);
|
||||
|
||||
private:
|
||||
private:
|
||||
Screen *screens_;
|
||||
size_t screenCount_;
|
||||
size_t currentIndex_;
|
||||
unsigned long nextAutoAdvanceAt_;
|
||||
unsigned long manualModeUntil_;
|
||||
unsigned long nextUpdate_;
|
||||
bool dirty_;
|
||||
|
||||
void scheduleNextAdvance(unsigned long now);
|
||||
void drawIndicators(U8X8 &display) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef DISPLAY_CONFIG_H
|
||||
#define DISPLAY_CONFIG_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
namespace display_config {
|
||||
|
||||
constexpr uint8_t kNextButtonPin = A4;
|
||||
|
||||
constexpr unsigned long kAutoAdvanceIntervalMs = 10000;
|
||||
constexpr unsigned long kManualHoldIntervalMs = 60000;
|
||||
constexpr unsigned long kButtonDebounceMs = 150;
|
||||
constexpr unsigned long kDebugLogIntervalMs = 500;
|
||||
|
||||
constexpr uint8_t kDisplayColumns = 16;
|
||||
constexpr uint8_t kDisplayRows = 8;
|
||||
constexpr uint8_t kIndicatorRow = 7;
|
||||
constexpr uint8_t kIndicatorSpacing = 2;
|
||||
|
||||
} // namespace display_config
|
||||
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef SCREENS_H
|
||||
#define SCREENS_H
|
||||
|
||||
#include <U8g2lib.h>
|
||||
|
||||
struct Screen {
|
||||
const char *title;
|
||||
void (*render)(U8X8 &display);
|
||||
};
|
||||
|
||||
void renderTimeScreen(U8X8 &display);
|
||||
void renderWeatherScreen(U8X8 &display);
|
||||
void renderTemperatureScreen(U8X8 &display);
|
||||
void renderHumidityScreen(U8X8 &display);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user