Skip to content

Commit

Permalink
Fix for CGP1W
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Nov 10, 2022
1 parent ab32c75 commit 11a8a8c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions qml/DeviceWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -958,14 +958,14 @@ Item {
limitMin = 850
limitMax = 1500
gaugeValue.value = boxDevice.co2
} else if (primary === "pm25") {
} else if (primaryValue === "pm25") {
gaugeLegend.text = qsTr("PM2.5")
gaugeValue.from = 0
gaugeValue.to = 240
limitMin = 60
limitMax = 120
gaugeValue.value = boxDevice.pm25
} else if (primary === "pm10") {
} else if (primaryValue === "pm10") {
gaugeLegend.text = qsTr("PM10")
gaugeValue.from = 0
gaugeValue.to = 500
Expand Down
24 changes: 23 additions & 1 deletion src/DeviceManager_theengs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,18 @@ void DeviceManager::fakeTheengsDevices()
qDebug() << "* Device added (from FAKER): " << deviceName << "/" << deviceAddr;
}
}
{
QString deviceName = "CGP1W";
QString deviceModel_theengs = "CGP1W";
QString deviceAddr = "11:57:43:01:5C:3C";

Device *d = createTheengsDevice_fromDb(deviceName, deviceModel_theengs, deviceAddr);
if (d)
{
m_devices_model->addDevice(d);
qDebug() << "* Device added (from FAKER): " << deviceName << "/" << deviceAddr;
}
}


{
Expand Down Expand Up @@ -734,7 +746,7 @@ void DeviceManager::fakeTheengsDevices()
void DeviceManager::fakeTheengsData()
{
QBluetoothDeviceInfo info;
int rrdd = (rand() % 23);
int rrdd = (rand() % 24);

if (rrdd == 0) // JQJCY01YM
{
Expand All @@ -757,6 +769,16 @@ void DeviceManager::fakeTheengsData()
else if (rrrr == 2) info.setServiceData(QBluetoothUuid(quint32(0xfdcd)), QByteArray::fromHex("880eaabbccddeeff0104f600ab011204a400d7001302c702"));
else qWarning() << "RAND ERROR";
}
if (rrdd == 23) // CGP1W
{
info = QBluetoothDeviceInfo(QBluetoothAddress("11:57:43:01:5C:3C"), "CGP1W", 0);

int rrrr = (rand() % 3);
if (rrrr == 0) info.setServiceData(QBluetoothUuid(quint32(0xfdcd)), QByteArray::fromHex("08094c0140342d5801040801870207024f2702015c"));
else if (rrrr == 1) info.setServiceData(QBluetoothUuid(quint32(0xfdcd)), QByteArray::fromHex("08094c0140342d5801040f01880207024f2702015c"));
else if (rrrr == 2) info.setServiceData(QBluetoothUuid(quint32(0xfdcd)), QByteArray::fromHex("08094c0140342d580104fc004a0207026627020120"));
else qWarning() << "RAND ERROR";
}


if (rrdd == 1) // TPMS
Expand Down

0 comments on commit 11a8a8c

Please sign in to comment.