fix text set deletion
This commit is contained in:
parent
ef9c0c9261
commit
ac7659614b
3 changed files with 15 additions and 17 deletions
|
@ -89,10 +89,6 @@ private:
|
||||||
class BluetoothLeUartServerCallbacks
|
class BluetoothLeUartServerCallbacks
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~BluetoothLeUartServerCallbacks(){};
|
|
||||||
|
|
||||||
const char *test = "testlol";
|
|
||||||
|
|
||||||
virtual void onDeviceConnectedChanged(bool deviceConnected);
|
virtual void onDeviceConnectedChanged(bool deviceConnected);
|
||||||
virtual void onDataReceived(String data);
|
virtual void onDataReceived(String data);
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,6 +101,7 @@ private:
|
||||||
} sets_t;
|
} sets_t;
|
||||||
|
|
||||||
// storage variables
|
// storage variables
|
||||||
|
const text_set_t defaultTextSet {"", false, 0, "", AlignCenter, false, 0, 0};
|
||||||
sets_t text_sets;
|
sets_t text_sets;
|
||||||
|
|
||||||
// storage control
|
// storage control
|
||||||
|
|
|
@ -194,8 +194,19 @@ LedDisplayController::GetSetTextSetParameterExitCode LedDisplayController::getSe
|
||||||
switch (parameter)
|
switch (parameter)
|
||||||
{
|
{
|
||||||
case TextParameter:
|
case TextParameter:
|
||||||
if (set)
|
if (set) {
|
||||||
strncpy(currentTextSet->text, value->c_str(), sizeof(currentTextSet->text));
|
if(*value == "")
|
||||||
|
// delete the index
|
||||||
|
for (int i = index; i < this->maximumTextSets; i++)
|
||||||
|
{
|
||||||
|
if(i > this->maximumTextSets - 1)
|
||||||
|
this->text_sets.sets[i] = this->text_sets.sets[i+1];
|
||||||
|
else
|
||||||
|
this->text_sets.sets[i] = this->defaultTextSet;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strncpy(currentTextSet->text, value->c_str(), sizeof(currentTextSet->text));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
returnValue = String(currentTextSet->text);
|
returnValue = String(currentTextSet->text);
|
||||||
break;
|
break;
|
||||||
|
@ -320,17 +331,7 @@ bool LedDisplayController::loadTextSets()
|
||||||
|
|
||||||
for (int i = 0; i < this->maximumTextSets; i++)
|
for (int i = 0; i < this->maximumTextSets; i++)
|
||||||
{
|
{
|
||||||
text_set_t defaultTextSet{
|
defaultTextSets.sets[i] = this->defaultTextSet;
|
||||||
"",
|
|
||||||
false,
|
|
||||||
0,
|
|
||||||
"",
|
|
||||||
AlignCenter,
|
|
||||||
false,
|
|
||||||
0,
|
|
||||||
0};
|
|
||||||
|
|
||||||
defaultTextSets.sets[i] = defaultTextSet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->text_sets = defaultTextSets;
|
this->text_sets = defaultTextSets;
|
||||||
|
|
Loading…
Reference in a new issue