Fixed probleb with copy assignment of settings in LEDRunner and DisplayHelper classes. Cleaned code up a bit.
This commit is contained in:
committed by
s.aydarov
parent
031a19b107
commit
11b4909f39
21
Settings.h
21
Settings.h
@@ -12,10 +12,24 @@ public:
|
||||
int SwitchTime = 3000; //In milliseconds
|
||||
float Brightness = MAX_BRIGHTNESS / 2;
|
||||
|
||||
Settings()
|
||||
//=======================================
|
||||
//Singleton. AVOID COPY ASSIGNMENTS
|
||||
//=======================================
|
||||
|
||||
static Settings& getInstance()
|
||||
{
|
||||
static Settings instance; // Guaranteed to be destroyed. Instantiated on first use.
|
||||
return instance;
|
||||
}
|
||||
|
||||
Settings() {}
|
||||
Settings(Settings const&) = delete;
|
||||
void operator = (Settings const&) = delete;
|
||||
|
||||
//=======================================
|
||||
//Singleton. AVOID COPY ASSIGNMENTS
|
||||
//=======================================
|
||||
|
||||
void setSwitchTime(int _SwitchTime)
|
||||
{
|
||||
if(_SwitchTime > 15000)
|
||||
@@ -67,6 +81,11 @@ public:
|
||||
TimeModeState = static_cast<TimeMode>(wrapInt(static_cast<int>(TimeModeState) + _ModeIncrement, 3));
|
||||
}
|
||||
|
||||
int getDisplaySwitchTime()
|
||||
{
|
||||
return SwitchTime / 10;
|
||||
}
|
||||
|
||||
private:
|
||||
int wrapInt(int _Num, int _Max)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user