some cleanup

This commit is contained in:
Dorian Zedler 2020-10-15 00:02:48 +02:00
parent d74da783b3
commit 40a190e324
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
3 changed files with 14 additions and 14 deletions

View file

@ -5,8 +5,8 @@
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include "esp_task_wdt.h"
#include <EEPROM.h>
#include "esp_task_wdt.h"
class LedDisplayController
{
@ -32,7 +32,7 @@ public:
ScrollSpeedParameter,
ScrollCountParameter,
IndexParameter,
DisplayTextSetParameterCount
DisplayTextSetParameterCount /*!< Just for helping purposes */
};
enum GetSetTextSetParameterExitCode
@ -46,8 +46,8 @@ public:
InternalError
};
static const uint16_t MaximumTextSets = 6;
static const uint16_t MaximumTextLength = 256;
static const uint16_t maximumTextSets = 6;
static const uint16_t maximumTextLength = 256;
void loop();
@ -84,19 +84,19 @@ private:
// storage structs
typedef struct text_set_t
{
char text[MaximumTextLength];
char text[maximumTextLength];
bool active;
uint16_t runtime;
char color[7];
text_align_t alignment;
bool scroll;
int scrollSpeed;
int scrollSpeed; /*!< Between 0 and 10 */
uint16_t scrollCount;
} text_set_t;
typedef struct sets_t
{
text_set_t sets[MaximumTextSets];
text_set_t sets[maximumTextSets];
char valid[3];
} sets_t;

View file

@ -49,7 +49,7 @@ void LedDisplayController::loop()
String LedDisplayController::getTextSetParameter(int index, DisplayTextSetParameter parameter)
{
if (index < 0 || index > this->MaximumTextSets || parameter < 0 || parameter >= DisplayTextSetParameterCount)
if (index < 0 || index > this->maximumTextSets || parameter < 0 || parameter >= DisplayTextSetParameterCount)
return "";
String value = "";
@ -101,7 +101,7 @@ void LedDisplayController::disp_start_set()
//Serial.printf("[%lu] Meet start set condition. Curr set is %d. \n", millis(), text_curr_nr);
if (0 < text_set_starttime || text_sets.sets[text_curr_nr].text == '\0' || text_sets.sets[text_curr_nr].active == false)
text_curr_nr++;
if (text_curr_nr == MaximumTextSets)
if (text_curr_nr == maximumTextSets)
text_curr_nr = 0;
text_pass = 0;
if (text_sets.sets[text_curr_nr].text != '\0' && text_sets.sets[text_curr_nr].active == true)
@ -181,7 +181,7 @@ LedDisplayController::GetSetTextSetParameterExitCode LedDisplayController::getSe
{
if (parameter < 0 || parameter >= DisplayTextSetParameterCount)
return InvalidParameterError;
else if (index < 0 || index >= this->MaximumTextSets)
else if (index < 0 || index >= this->maximumTextSets)
return IndexOutOfRangeError;
else if (value == nullptr)
return ValueIsNullptrError;
@ -318,7 +318,7 @@ bool LedDisplayController::loadTextSets()
strncpy(defaultTextSets.valid, "OK", sizeof(defaultTextSets.valid));
for (int i = 0; i < this->MaximumTextSets; i++)
for (int i = 0; i < this->maximumTextSets; i++)
{
text_set_t defaultTextSet{
"",

View file

@ -45,7 +45,7 @@ void OmobiLedDisplay::onDataReceived(String dataString)
case GetAllTextSetsCommand:
{
// cycle through all text sets
for (int textSetIndex = 0; textSetIndex < LedDisplayController::MaximumTextSets; textSetIndex++)
for (int textSetIndex = 0; textSetIndex < LedDisplayController::maximumTextSets; textSetIndex++)
{
if (this->ledDisplayController->getTextSetParameter(textSetIndex, LedDisplayController::TextParameter) == "")
continue;
@ -75,8 +75,8 @@ void OmobiLedDisplay::onDataReceived(String dataString)
}
replyStatus = Success;
replyData["maximumTextSets"] = LedDisplayController::MaximumTextSets;
replyData["maximumTextLength"] = LedDisplayController::MaximumTextLength;
replyData["maximumTextSets"] = LedDisplayController::maximumTextSets;
replyData["maximumTextLength"] = LedDisplayController::maximumTextLength;
break;
}