qdomyos-zwift icon indicating copy to clipboard operation
qdomyos-zwift copied to clipboard

Initial implement start/stop control of KingSmith R2 when press start/pause/stop buttons

Open d3m3vilurr opened this issue 2 years ago • 10 comments

This patch is not perfect. If a user doesn't do workout, treadmill will stop automatically, but an UI of the application couldn't update anything.

Also in the timing issue, sometimes changeing ControlMode or runState command just return Error packet. I think, sending message too early (before finishing handshake) could make the problem.

Fully implement needs passing the signal to homeform or MainApp. And also it needs more complex state machine for handling buttons. (eg; press the start button & press the pause button before finish start treadmill action, pause action never call)

d3m3vilurr avatar May 24 '22 18:05 d3m3vilurr

ok before merging i will wait a more complete implementation. Let me know if I can help you on this somehow

cagnulein avatar May 25 '22 06:05 cagnulein

@cagnulein imo, patchset is dirty hack. but it could explain the concept.

d3m3vilurr avatar May 28 '22 16:05 d3m3vilurr

@d3m3vilurr just to understand: which is the main purpose of this patch? I mean I already managed the pause/stop button of others treadmill using the speed as a control for homeform. all the mechanism specific to the treadmill should be in the treadmill module. Am I missing something?

cagnulein avatar May 30 '22 13:05 cagnulein

Is it possiable that QZ UI receive running status from treadmill? (I mean, is it possible that treadmill update UI buttons? I thought it can't, because a bluetoothdevice doesn't have homeform instance.)

before the patch, homeform's start/pause and stop button will works independently and it's maintained by UI itself. after the patch, homeform's buttons will be coupled to treadmill's current status. (so before; treadmill can be running mode even if UI shown pause. but after patch pause button only can be shown treadmill is running)

  • first commit has just control part when press the buttons (but it has mistake. props ControlMode 0 command is not a manual mode. it's automatic speed control mode and it only works in the walk mode of the treadmill)
  • 561d569 commit will fix the first commit's mistake and sending the current status to homeform
  • a55fb43 will make the coupling between UI buttons and current on/off status of the treadmill

d3m3vilurr avatar May 30 '22 17:05 d3m3vilurr

@d3m3vilurr did you see this https://github.com/cagnulein/qdomyos-zwift/blob/bfb7b747792a73314cc439ed9eb3950b92d2959f/src/homeform.cpp#L2262 ? maybe you should use the same interface inside your module so no changes on the homeform module will be required. What do you think?

cagnulein avatar May 31 '22 07:05 cagnulein

I'm not sure that is perfect or not. because button clicking will make the problem. these actions will change own status (of homeform instance) then just change the request flag variable of the bluetoothdevice but if device couldn't send the message (unimplement start/stop handling) or returned error message(not finished initializing step or other reason), an application shows wrong buttons.

idk why kingsmith r2 doesn't have the these auto methods. (maybe timing problem when i copied from r1 pro) I'll make the another pr of it

and also, if you want it, i'll split the pr to implement handling start/stop message (maybe mix first and third patch) and others

d3m3vilurr avatar Jun 01 '22 04:06 d3m3vilurr

@d3m3vilurr hah ok, now I got your point, it makes sense. I will try on my treadmill too. The start/pause/stop state machine on the homeform is kind of crucial point, so we have to be very safe on this. That's why I'm a little worried about changing it :)

cagnulein avatar Jun 01 '22 07:06 cagnulein

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 16 '22 11:06 stale[bot]

argh I didn't test this yet :(

cagnulein avatar Jun 16 '22 12:06 cagnulein

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 01 '22 12:07 stale[bot]