Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 11 crash connecting #2764

Closed
wants to merge 55 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
05d598f
first raw version
cagnulein Oct 21, 2024
49c7a96
Merge branch 'master' into Custom-gearing-ranges/ratios-(Discussion-#…
cagnulein Oct 22, 2024
cc7757b
Update project.pbxproj
cagnulein Oct 22, 2024
2d13644
Update virtualbike_zwift.swift
cagnulein Oct 22, 2024
1c06260
Merge branch 'master' into Custom-gearing-ranges/ratios-(Discussion-#…
cagnulein Oct 23, 2024
d712621
fixing formula
cagnulein Oct 23, 2024
2da194f
Merge branch 'master' into Custom-gearing-ranges/ratios-(Discussion-#…
cagnulein Oct 24, 2024
89808ae
fixing casting to double
cagnulein Oct 24, 2024
ed1599c
need to center the values in the table
cagnulein Oct 24, 2024
0f14944
Update gears.qml
cagnulein Oct 25, 2024
527396e
Revert "Update gears.qml"
cagnulein Oct 28, 2024
74c37f5
Update gears.qml
cagnulein Oct 28, 2024
f85f743
i need to save the first 3 static objects and use it in the wahoo module
cagnulein Oct 28, 2024
8d07d7c
Merge branch 'master' into Custom-gearing-ranges/ratios-(Discussion-#…
cagnulein Oct 28, 2024
6fac977
qml finally saves the settings correctly
cagnulein Oct 28, 2024
2f2989f
completed?
cagnulein Oct 28, 2024
379cf8d
Update project.pbxproj
cagnulein Oct 29, 2024
64b9ec9
fixing gear conversion
cagnulein Oct 29, 2024
d7c3a84
adding max and minGears
cagnulein Oct 29, 2024
a7b8e63
fixing UI and settings
cagnulein Oct 29, 2024
82a6afe
kickr core to wahookickr class
cagnulein Oct 29, 2024
9cc02de
ftms wheel circumference for gears
cagnulein Oct 30, 2024
ad802f7
Merge branch 'master' into tacx_wheel_diameter
cagnulein Nov 4, 2024
dbb9ba3
implementing
cagnulein Nov 4, 2024
0625399
Update wahookickrsnapbike.cpp
cagnulein Nov 4, 2024
f3d8b39
Merge branch 'master' into tacx_wheel_diameter
cagnulein Nov 9, 2024
8b60b56
Update ftmsbike.cpp
cagnulein Nov 9, 2024
0337c08
first custom gear test
cagnulein Nov 9, 2024
bd0e703
Merge branch 'master' into zwift-hub-gear-custom
cagnulein Nov 9, 2024
07606fa
adding inclination custom message too
cagnulein Nov 9, 2024
095d8bc
Update ftmsbike.cpp
cagnulein Nov 9, 2024
9ca3fca
implemented protobuf
cagnulein Nov 11, 2024
e349ca9
protobuf also for the gears
cagnulein Nov 11, 2024
839213e
Update ftmsbike.cpp
cagnulein Nov 11, 2024
159f96d
Update project.pbxproj
cagnulein Nov 11, 2024
190011a
reverting tacxneo wheel diameter and ftms standard wheel diamater in …
cagnulein Nov 12, 2024
797ae5f
fixing mingears and maxgears
cagnulein Nov 12, 2024
9bb016f
adding android part
cagnulein Nov 12, 2024
7c52e92
Update main.cpp
cagnulein Nov 12, 2024
eafe75e
Update main.cpp
cagnulein Nov 12, 2024
f737e1b
Merge branch 'master' into zwift-hub-gear-custom
cagnulein Nov 12, 2024
a2e7218
Update main.cpp
cagnulein Nov 12, 2024
c5cfb1c
Update project.pbxproj
cagnulein Nov 12, 2024
12f77be
Merge branch 'zwift-hub-gear-custom' of https://github.com/cagnulein/…
cagnulein Nov 12, 2024
f602563
fixing android build
cagnulein Nov 12, 2024
79ba8ea
Update horizontreadmill.cpp
cagnulein Nov 12, 2024
c76195a
Update ftmsbike.cpp
cagnulein Nov 12, 2024
9939471
Update homeform.cpp
cagnulein Nov 12, 2024
cc4a5be
Merge branch 'master' into windows-11-crash-connecting
cagnulein Nov 13, 2024
e8faa3e
Update horizontreadmill.cpp
cagnulein Nov 13, 2024
df3e64e
Revert "Update horizontreadmill.cpp"
cagnulein Nov 14, 2024
e6efe0f
trying to use win11 api for discovery
cagnulein Nov 21, 2024
721f6d4
Update horizontreadmill.cpp
cagnulein Nov 21, 2024
b573442
Update qdomyos-zwift.pri
cagnulein Nov 21, 2024
f8aa63d
Update horizontreadmill.cpp
cagnulein Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
first raw version
cagnulein committed Oct 21, 2024
commit 05d598ffcfc36f94e60f54e69637a5d1a55c7c66
24 changes: 21 additions & 3 deletions src/devices/wahookickrsnapbike/wahookickrsnapbike.cpp
Original file line number Diff line number Diff line change
@@ -192,10 +192,16 @@ void wahookickrsnapbike::update() {
}
QThread::msleep(700);

QByteArray d = setWheelCircumference(gearsToWheelDiameter(gears()));
uint8_t e[20];
setGears(1);
memcpy(e, d.constData(), d.length());
writeCharacteristic(e, d.length(), "setWheelCircumference", false, true);

// required to the SS2K only one time
Resistance = 0;
emit resistanceRead(Resistance.value());
initRequest = false;
initRequest = false;
} else if (bluetoothDevice.isValid() &&
m_control->state() == QLowEnergyController::DiscoveredState //&&
// gattCommunicationChannelService &&
@@ -259,7 +265,10 @@ void wahookickrsnapbike::update() {
memcpy(b, a.constData(), a.length());
writeCharacteristic(b, a.length(), "setResistance", false, true);
} else if (virtualBike && virtualBike->ftmsDeviceConnected() && lastGearValue != gears()) {
inclinationChanged(lastGrade, lastGrade);
QByteArray a = setWheelCircumference(gearsToWheelDiameter(gears()));
uint8_t b[20];
memcpy(b, a.constData(), a.length());
writeCharacteristic(b, a.length(), "setWheelCircumference", false, true);
}
lastGearValue = gears();
requestResistance = -1;
@@ -280,6 +289,16 @@ void wahookickrsnapbike::update() {
}
}

double wahookickrsnapbike::gearsToWheelDiameter(double gear) {
GearTable table;
if(gear < 1) gear = 1;
else if(gear > 12) gear = 12;
double original_ratio = crankset / rear_cog_size;
GearTable::GearInfo g = table.getGear((int)gear);
double current_ratio = g.crankset / g.rearCog;
return (wheel_size / current_ratio) * original_ratio;
}

void wahookickrsnapbike::serviceDiscovered(const QBluetoothUuid &gatt) {
emit debug(QStringLiteral("serviceDiscovered ") + gatt.toString());
}
@@ -823,7 +842,6 @@ void wahookickrsnapbike::inclinationChanged(double grade, double percentage) {
emit debug(QStringLiteral("writing inclination ") + QString::number(grade));
QSettings settings;
double g = grade;
g += gears();
QByteArray a = setSimGrade(g);
uint8_t b[20];
memcpy(b, a.constData(), a.length());
67 changes: 66 additions & 1 deletion src/devices/wahookickrsnapbike/wahookickrsnapbike.h
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ class wahookickrsnapbike : public bike {
_setWheelCircumference = 72,
};

private:
private:
QByteArray unlockCommand();
QByteArray setResistanceMode(double resistance);
QByteArray setStandardMode(uint8_t level);
@@ -109,6 +109,71 @@ class wahookickrsnapbike : public bike {

resistance_t lastForcedResistance = -1;

// cranks & co.
double crankset = 40;
double rear_cog_size = 14;
double wheel_size = 2230; // mm 700x44
double gearsToWheelDiameter(double gear);

class GearTable {
public:
struct GearInfo {
int gear;
int crankset;
int rearCog;
};

GearTable() {
gears = {
{1, 38, 44},
{2, 38, 38},
{3, 38, 32},
{4, 38, 28},
{5, 38, 24},
{6, 38, 21},
{7, 38, 19},
{8, 38, 17},
{9, 38, 15},
{10, 38, 13},
{11, 38, 11},
{12, 38, 10}
};
}

void addGear(int gear, int crankset, int rearCog) {
gears.push_back({gear, crankset, rearCog});
}

void removeGear(int gear) {
gears.erase(std::remove_if(gears.begin(), gears.end(),
[gear](const GearInfo& info) { return info.gear == gear; }),
gears.end());
}

void printTable() const {
qDebug() << "| Gear | Crankset | Rear Cog |\n";
qDebug() << "|------|----------|----------|\n";
for (const auto& gear : gears) {
qDebug() << "| " << gear.gear << " | " << gear.crankset
<< " | " << gear.rearCog << " |\n";
}
}

GearInfo getGear(int gearNumber) const {
auto it = std::find_if(gears.begin(), gears.end(),
[gearNumber](const GearInfo& info) { return info.gear == gearNumber; });

if (it != gears.end()) {
return *it;
}
return GearInfo();
}

private:
std::vector<GearInfo> gears;
};


#ifdef Q_OS_IOS
lockscreen *h = 0;
#endif