implemented scroll direction
This commit is contained in:
parent
1b28fe84b8
commit
bd3deb2b7f
7 changed files with 37 additions and 6 deletions
|
@ -157,7 +157,7 @@ void LedDisplayBackend::sendBluetoothKeepAlive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedDisplayBackend::handleBluetoothDataReceived(QString s){
|
void LedDisplayBackend::handleBluetoothDataReceived(QString s){
|
||||||
//qDebug() << "New data: \n" << qPrintable(s);
|
qDebug() << "New data: \n" << qPrintable(s);
|
||||||
|
|
||||||
QJsonParseError parseError;
|
QJsonParseError parseError;
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(s.toUtf8(), &parseError);
|
QJsonDocument doc = QJsonDocument::fromJson(s.toUtf8(), &parseError);
|
||||||
|
@ -199,6 +199,8 @@ void LedDisplayBackend::handleBluetoothDataReceived(QString s){
|
||||||
this->displayTextModel->maximumTextLength = data["maximumTextLength"].toInt();
|
this->displayTextModel->maximumTextLength = data["maximumTextLength"].toInt();
|
||||||
this->displayTextModel->maximumTextSets = data["maximumTextSets"].toInt();
|
this->displayTextModel->maximumTextSets = data["maximumTextSets"].toInt();
|
||||||
|
|
||||||
|
qDebug() << "text sets are: " << this->textSetsBuffer;
|
||||||
|
|
||||||
this->displayTextModel->setTexts(this->textSetsBuffer);
|
this->displayTextModel->setTexts(this->textSetsBuffer);
|
||||||
this->textSetsBuffer.clear();
|
this->textSetsBuffer.clear();
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ QHash<int, QByteArray> LedDisplayTextModel::roleNames() const
|
||||||
{ ColorRole, "color" },
|
{ ColorRole, "color" },
|
||||||
{ AlignmentRole, "alignment" },
|
{ AlignmentRole, "alignment" },
|
||||||
{ ScrollRole, "scroll" },
|
{ ScrollRole, "scroll" },
|
||||||
|
{ ScrollDirectionRole, "scrollDirection" },
|
||||||
{ ScrollSpeedRole, "scrollSpeed" },
|
{ ScrollSpeedRole, "scrollSpeed" },
|
||||||
{ ScrollCountRole, "scrollCount" },
|
{ ScrollCountRole, "scrollCount" },
|
||||||
{ IndexRole, "index" }
|
{ IndexRole, "index" }
|
||||||
|
@ -54,8 +55,9 @@ void LedDisplayTextModel::append(
|
||||||
bool active,
|
bool active,
|
||||||
unsigned int runtime,
|
unsigned int runtime,
|
||||||
QString color,
|
QString color,
|
||||||
QString alignment,
|
unsigned int alignment,
|
||||||
bool scroll,
|
bool scroll,
|
||||||
|
unsigned int scrollDirection,
|
||||||
unsigned int scrollSpeed,
|
unsigned int scrollSpeed,
|
||||||
unsigned int scrollCount
|
unsigned int scrollCount
|
||||||
) {
|
) {
|
||||||
|
@ -74,6 +76,7 @@ void LedDisplayTextModel::append(
|
||||||
{ ColorRole, color },
|
{ ColorRole, color },
|
||||||
{ AlignmentRole, alignment },
|
{ AlignmentRole, alignment },
|
||||||
{ ScrollRole, scroll },
|
{ ScrollRole, scroll },
|
||||||
|
{ ScrollDirectionRole, scrollDirection},
|
||||||
{ ScrollSpeedRole, scrollSpeed },
|
{ ScrollSpeedRole, scrollSpeed },
|
||||||
{ ScrollCountRole, scrollCount }
|
{ ScrollCountRole, scrollCount }
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
ColorRole,
|
ColorRole,
|
||||||
AlignmentRole,
|
AlignmentRole,
|
||||||
ScrollRole,
|
ScrollRole,
|
||||||
|
ScrollDirectionRole,
|
||||||
ScrollSpeedRole,
|
ScrollSpeedRole,
|
||||||
ScrollCountRole,
|
ScrollCountRole,
|
||||||
IndexRole,
|
IndexRole,
|
||||||
|
@ -46,8 +47,9 @@ public:
|
||||||
bool active,
|
bool active,
|
||||||
unsigned int runtime,
|
unsigned int runtime,
|
||||||
QString color,
|
QString color,
|
||||||
QString alignment,
|
unsigned int alignment,
|
||||||
bool scroll,
|
bool scroll,
|
||||||
|
unsigned int scrollDirection,
|
||||||
unsigned int scrollSpeed,
|
unsigned int scrollSpeed,
|
||||||
unsigned int scrollCount
|
unsigned int scrollCount
|
||||||
);
|
);
|
||||||
|
@ -81,6 +83,7 @@ private:
|
||||||
{ColorRole, QVariant::String},
|
{ColorRole, QVariant::String},
|
||||||
{AlignmentRole, QVariant::Int},
|
{AlignmentRole, QVariant::Int},
|
||||||
{ScrollRole, QVariant::Bool},
|
{ScrollRole, QVariant::Bool},
|
||||||
|
{ScrollDirectionRole, QVariant::Int},
|
||||||
{ScrollSpeedRole, QVariant::Int},
|
{ScrollSpeedRole, QVariant::Int},
|
||||||
{ScrollCountRole, QVariant::Int},
|
{ScrollCountRole, QVariant::Int},
|
||||||
{IndexRole, QVariant::Int}
|
{IndexRole, QVariant::Int}
|
||||||
|
|
|
@ -31,6 +31,7 @@ Dialog {
|
||||||
editingModel.color = colorColorPicker.value
|
editingModel.color = colorColorPicker.value
|
||||||
editingModel.alignment = alignmentComboBox.currentIndex
|
editingModel.alignment = alignmentComboBox.currentIndex
|
||||||
editingModel.scroll = scrollSwitch.checked
|
editingModel.scroll = scrollSwitch.checked
|
||||||
|
editingModel.scrollDirection = scrollDirectionComboBox.currentIndex
|
||||||
editingModel.scrollSpeed = scrollSpeedSpinBox.value
|
editingModel.scrollSpeed = scrollSpeedSpinBox.value
|
||||||
editingModel.scrollCount = scrollCountSpinBox.value
|
editingModel.scrollCount = scrollCountSpinBox.value
|
||||||
}
|
}
|
||||||
|
@ -39,8 +40,9 @@ Dialog {
|
||||||
activeSwitch.checked,
|
activeSwitch.checked,
|
||||||
runtimeSpinBox.value,
|
runtimeSpinBox.value,
|
||||||
colorColorPicker.value,
|
colorColorPicker.value,
|
||||||
alignmentComboBox.currentText,
|
alignmentComboBox.currentIndex,
|
||||||
scrollSwitch.checked,
|
scrollSwitch.checked,
|
||||||
|
scrollDirectionComboBox.currentIndex,
|
||||||
scrollSpeedSpinBox.value,
|
scrollSpeedSpinBox.value,
|
||||||
scrollCountSpinBox.value
|
scrollCountSpinBox.value
|
||||||
)
|
)
|
||||||
|
@ -97,7 +99,7 @@ Dialog {
|
||||||
ComboBoxDelegate {
|
ComboBoxDelegate {
|
||||||
id: alignmentComboBox
|
id: alignmentComboBox
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
model: ["left", "center", "right"]
|
model: [qsTr("left"), qsTr("center"), qsTr("right")]
|
||||||
text: qsTr("Alignment")
|
text: qsTr("Alignment")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +109,13 @@ Dialog {
|
||||||
text: qsTr("Scroll")
|
text: qsTr("Scroll")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComboBoxDelegate {
|
||||||
|
id: scrollDirectionComboBox
|
||||||
|
Layout.fillWidth: true
|
||||||
|
model: [qsTr("right to left"), qsTr("left to right")]
|
||||||
|
text: qsTr("Scroll direction")
|
||||||
|
}
|
||||||
|
|
||||||
SpinBoxDelegate {
|
SpinBoxDelegate {
|
||||||
id: scrollSpeedSpinBox
|
id: scrollSpeedSpinBox
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -166,6 +175,7 @@ Dialog {
|
||||||
colorColorPicker.value = editingModel.color
|
colorColorPicker.value = editingModel.color
|
||||||
alignmentComboBox.currentIndex = editingModel.alignment
|
alignmentComboBox.currentIndex = editingModel.alignment
|
||||||
scrollSwitch.checked = editingModel.scroll
|
scrollSwitch.checked = editingModel.scroll
|
||||||
|
scrollDirectionComboBox.currentIndex = editingModel.scrollDirection
|
||||||
scrollSpeedSpinBox.value = editingModel.scrollSpeed
|
scrollSpeedSpinBox.value = editingModel.scrollSpeed
|
||||||
scrollCountSpinBox.value = editingModel.scrollCount
|
scrollCountSpinBox.value = editingModel.scrollCount
|
||||||
|
|
||||||
|
@ -186,6 +196,7 @@ Dialog {
|
||||||
colorColorPicker.value = "#ffffff"
|
colorColorPicker.value = "#ffffff"
|
||||||
alignmentComboBox.currentIndex = 0
|
alignmentComboBox.currentIndex = 0
|
||||||
scrollSwitch.checked = false
|
scrollSwitch.checked = false
|
||||||
|
scrollDirectionComboBox.currentIndex = 0
|
||||||
scrollSpeedSpinBox.value = 5
|
scrollSpeedSpinBox.value = 5
|
||||||
scrollCountSpinBox.value = 1
|
scrollCountSpinBox.value = 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ public:
|
||||||
ColorParameter,
|
ColorParameter,
|
||||||
AlignmentParameter,
|
AlignmentParameter,
|
||||||
ScrollParameter,
|
ScrollParameter,
|
||||||
|
ScrollDirectionParameter,
|
||||||
ScrollSpeedParameter,
|
ScrollSpeedParameter,
|
||||||
ScrollCountParameter,
|
ScrollCountParameter,
|
||||||
IndexParameter,
|
IndexParameter,
|
||||||
|
@ -125,6 +126,7 @@ private:
|
||||||
char color[7];
|
char color[7];
|
||||||
text_align_t alignment;
|
text_align_t alignment;
|
||||||
bool scroll;
|
bool scroll;
|
||||||
|
int scrollDirection;
|
||||||
int scrollSpeed; /*!< Between 0 and 10 */
|
int scrollSpeed; /*!< Between 0 and 10 */
|
||||||
uint16_t scrollCount;
|
uint16_t scrollCount;
|
||||||
} text_set_t;
|
} text_set_t;
|
||||||
|
@ -137,7 +139,7 @@ private:
|
||||||
} sets_t;
|
} sets_t;
|
||||||
|
|
||||||
// storage variables
|
// storage variables
|
||||||
const text_set_t defaultTextSet {"", false, 0, "", AlignCenter, false, 0, 0};
|
const text_set_t defaultTextSet {"", false, 0, "", AlignCenter, false, 0, 0, 0};
|
||||||
sets_t text_sets;
|
sets_t text_sets;
|
||||||
|
|
||||||
// storage control
|
// storage control
|
||||||
|
|
|
@ -291,6 +291,12 @@ LedDisplayController::GetSetTextSetParameterExitCode LedDisplayController::getSe
|
||||||
returnValue = currentTextSet->scroll ? "true" : "false";
|
returnValue = currentTextSet->scroll ? "true" : "false";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ScrollDirectionParameter:
|
||||||
|
if(set)
|
||||||
|
currentTextSet->scrollDirection = value->toInt();
|
||||||
|
else
|
||||||
|
returnValue = currentTextSet->scrollDirection;
|
||||||
|
break;
|
||||||
case ScrollSpeedParameter:
|
case ScrollSpeedParameter:
|
||||||
if (set)
|
if (set)
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,6 +110,10 @@ void OmobiLedDisplay::onDataReceived(String dataString)
|
||||||
textSetIndex,
|
textSetIndex,
|
||||||
LedDisplayController::DisplayTextSetParameter(textSetParameter));
|
LedDisplayController::DisplayTextSetParameter(textSetParameter));
|
||||||
|
|
||||||
|
Serial.println("sending parameter: " + String(textSetParameter) + " with value: " + this->ledDisplayController->getTextSetParameter(
|
||||||
|
textSetIndex,
|
||||||
|
LedDisplayController::DisplayTextSetParameter(textSetParameter)));
|
||||||
|
|
||||||
String json;
|
String json;
|
||||||
serializeJson(doc, json);
|
serializeJson(doc, json);
|
||||||
this->bleServer->sendData(json);
|
this->bleServer->sendData(json);
|
||||||
|
|
Loading…
Reference in a new issue