Hi,
ich muss eine BLE-Schnittstelle mit ProtocolBuffers implementieren. Die Schnittstelle ist hier
https://www.makinolo.com/blog/2024/1...iner-protocol/ in dem Kapitel "Trainer Control (0x04)" beschrieben.
// The command code prepending this message is 0x04
message HubCommand {
optional uint32 PowerTarget = 3;
optional SimulationParam Simulation = 4;
optional PhysicalParam Physical = 5;
}
message SimulationParam {
optional sint32 Wind = 1; // Wind in m/s * 100. Zwift fixes to 0. Negative is backwind
optional sint32 InclineX100 = 2; // Incline value * 100
optional uint32 CWa = 3; // Aero coefficient CW * a * 10000. Zwift fixes to 0.51 (5100)
optional uint32 Crr = 4; // Rolling resistance Crr * 100000. Zwift fixes to 0.004 (400)
}
message PhysicalParam {
optional uint32 GearRatioX10000 = 2;
optional uint32 BikeWeightx100 = 4;
optional uint32 RiderWeightx100 = 5;
}
Und das Beispiel
04 2a 08 10 00 20 81 05 28 c4 3b
müsste nun folgendes ergeben:
{
"Physical": {
"BikeWeightx100": 641,
"RiderWeightx100": 7620
}
}
Irgendwie will mir dies aber nicht gelingen, wenn ich es encodiere, kommt
04 2a 0a 25 81 02 00 00 2d c4 1d 00 00
raus.
Kann mir jemand auf die Sprünge helfen, was ich hier falsch mache? Bei Beispielprojekt ist angehängt.
Grüße, Philipp