Refactoring: created Display class.
This commit is contained in:
40
src/Display.h
Normal file
40
src/Display.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef DISPLAY_h_included
|
||||
#define DISPLAY_h_included
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "Clock.h"
|
||||
|
||||
class Display {
|
||||
public:
|
||||
Display(Clock *real, Clock *model):
|
||||
last_reinit_ts(0),
|
||||
realTime(real),
|
||||
modelTime(model),
|
||||
displayClockNameEvery_ms(16000),
|
||||
clockNameDurationTime_ms(1200),
|
||||
doNotShowClockNameBeforeAndAfterMinuteChange_s(2),
|
||||
displayRefresh_ms(200)
|
||||
{
|
||||
showRealTime();
|
||||
};
|
||||
void begin();
|
||||
void loop();
|
||||
void loopEyeAnimation();
|
||||
void reInitializeDisplay();
|
||||
void showRealTime() { showRealTimeFlag=true; currentTime = realTime; };
|
||||
void showModelTime() { showRealTimeFlag=false; currentTime = modelTime; };
|
||||
void setClockNameDurationTime_ms(unsigned long val) { clockNameDurationTime_ms=val; };
|
||||
void setClockNameDisplayEvery_ms(unsigned long val) { displayClockNameEvery_ms=val; };
|
||||
void print(const char *s);
|
||||
void print(const String s);
|
||||
protected:
|
||||
unsigned long last_reinit_ts;
|
||||
Clock *realTime, *modelTime, *currentTime;
|
||||
boolean showRealTimeFlag;
|
||||
unsigned long displayClockNameEvery_ms;
|
||||
unsigned long clockNameDurationTime_ms;
|
||||
unsigned int doNotShowClockNameBeforeAndAfterMinuteChange_s;
|
||||
unsigned long displayRefresh_ms;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user