Skip to content

Commit

Permalink
Sole F63 doesn't work with qz #597
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed Oct 27, 2023
1 parent e8031f5 commit ba92532
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions src/solef80treadmill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,21 @@ void solef80treadmill::update() {
writeCharacteristic(noop2, sizeof(noop2), QStringLiteral("noop2"), false, true);
}

int max_speed_loop = 0;
if(requestSpeed != -1) {
max_speed_loop = (fabs(requestSpeed - currentSpeed().value()) * 10.0) - 1;
}

do {
if (requestSpeed != -1) {
if (requestSpeed != currentSpeed().value() && requestSpeed >= 0 && requestSpeed <= 22) {
emit debug(QStringLiteral("writing speed ") + QString::number(requestSpeed));
emit debug(QStringLiteral("writing speed ") + QString::number(requestSpeed) + " " + QString::number(max_speed_loop));
forceSpeed(requestSpeed);
}
// i have to do the reset on when the speed is equal to the current
// requestSpeed = -1;
}
} while (requestSpeed != -1 && sole_treadmill_inclination_fast);
} while (requestSpeed != -1 && sole_treadmill_inclination_fast && max_speed_loop);

do {
if (requestInclination != -100) {
Expand Down Expand Up @@ -364,18 +369,32 @@ void solef80treadmill::update() {
if (requestStop != -1) {
emit debug(QStringLiteral("stopping..."));

uint8_t stop[] = {0x5b, 0x02, 0x03, 0x06, 0x5d};
uint8_t stop1[] = {0x5b, 0x02, 0x03, 0x07, 0x5d};
uint8_t stop2[] = {0x5b, 0x04, 0x00, 0x32, 0x4f, 0x4b, 0x5d};

if (gattCustomService) {
writeCharacteristic(stop, sizeof(stop), QStringLiteral("stop"), false, true);
writeCharacteristic(stop, sizeof(stop), QStringLiteral("stop"), false, true);
writeCharacteristic(stop, sizeof(stop), QStringLiteral("stop"), false, true);
writeCharacteristic(stop2, sizeof(stop2), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
if(treadmill_type == F63) {
uint8_t stop[] = {0x5b, 0x02, 0xf1, 0x06, 0x5d};
uint8_t stop1[] = {0x5b, 0x02, 0x03, 0x06, 0x5d};

if (gattCustomService) {
writeCharacteristic(stop, sizeof(stop), QStringLiteral("stop"), false, true);
writeCharacteristic(stop, sizeof(stop), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
}
} else {
uint8_t stop[] = {0x5b, 0x02, 0x03, 0x06, 0x5d};
uint8_t stop1[] = {0x5b, 0x02, 0x03, 0x07, 0x5d};
uint8_t stop2[] = {0x5b, 0x04, 0x00, 0x32, 0x4f, 0x4b, 0x5d};

if (gattCustomService) {
writeCharacteristic(stop, sizeof(stop), QStringLiteral("stop"), false, true);
writeCharacteristic(stop, sizeof(stop), QStringLiteral("stop"), false, true);
writeCharacteristic(stop, sizeof(stop), QStringLiteral("stop"), false, true);
writeCharacteristic(stop2, sizeof(stop2), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
writeCharacteristic(stop1, sizeof(stop1), QStringLiteral("stop"), false, true);
}
}

requestStop = -1;
Expand Down

0 comments on commit ba92532

Please sign in to comment.