Fixed probleb with copy assignment of settings in LEDRunner and DisplayHelper classes. Cleaned code up a bit.

This commit is contained in:
Author glitchrain
2024-12-15 03:30:30 -08:00
committed by s.aydarov
parent 031a19b107
commit 11b4909f39
8 changed files with 246 additions and 294 deletions

44
WrapHelper.h Normal file
View File

@@ -0,0 +1,44 @@
#ifndef EYE_TRAINER_WRAPHELPER
#define EYE_TRAINER_WRAPHELPER 0
int wrapInt(int _Num, int _Max)
{
if(_Num < 0)
{
return (_Max + _Num % _Max);
}
if(_Num >= _Max)
{
return _Num % _Max;
}
return _Num;
}
//Fix upper bounce (all LEDs are off)
int pingPong(int _Num, int _Max)
{
if(_Num < 0)
{
return (_Max + _Num % _Max);
}
if(_Num > _Max * 2)
{
return _Num % _Max;
}
if(_Num > _Max)
{
return _Max - _Num % _Max;
}
return _Num;
}
int wrapInt(int _Num, int _Min, int _Max)
{
int num = _Num - _Min;
int max = _Max - _Min;
return wrapInt(num, max) + _Min;
}
#endif