-
-
Notifications
You must be signed in to change notification settings - Fork 48
Add Eggrider compatibility option #284
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
base: master
Are you sure you want to change the base?
Conversation
|
My IDE's auto-formatter seems to have done its job, to the detriment of diff readability. Apologies for that, especially in Let me know if it's an issue and I'll try to fix it up. For extcom.c, just focus on the @danielnilsson9 if you're available, I would really appreciate some background info on how far you got with implementing the display speed limit functionality (and ultimately why you disabled it), and any tips on how to debug the display communication. I uncommented some of the code in |
|
Do you want to be able to change the motor configuration using eggrider or just switch between modes. I'm not familiar with the eggrider so I probably should just stay quiet. I suspect the eggrider just has two copies of standard bafang configuration and when you switch modes it writes the selected config just like the standard bafang config tool does. If so you could implement a dummy read and write function in extcom and use it to trigger the mode change function. Daniel has already created the placeholder for the read and write functions for this. It's never as simple as I think things are though. Also note that display speed is in wheel rpm, not mph or kph. I haven't looked at your code as I just have my phone now. |
|
Just a quick look at your code. I think you should leave this code in process_bafang_display_write_speed_limit() even though it may receive the extra bytes in one go otherwise you are going to have mismatch between buffer and msg_len. |
Just switch between modes. I think attempting to implement functionality for dummy reads/writes might be more complicated as the Eggrider will be expecting certain responses for all fields that I would need to implement. Instead, Eggrider has an alternative mode that just changes the display speed limit between 2 preset values, and I think that method will be more versatile (and possibly also usable by other displays!)
Accounted for this already. The config value in kph is converted to RPM before it is compared against the display value. To try and isolate the problem a bit, I removed all the comparison logic and just tried to make it switch to sport mode when the display attempts to set the speed limit to any value. I've got both an Eggrider V2 and a C965 display, so tried it on both. No bueno.
Good catch, I thought that the code was just there as a dummy return, so removed it and replaced it with the commented code. I'll add it back in and see if there's any difference! |
|
Thanks again @dav0000000 for catching my mistake, adding back in the KEEP makes it work like a charm. The only other part was to make sure the Eggrider's wheel size matches the bbs-fw wheel size, so the RPM value matches. I added extra instructions to the comments of fwconfig on how to set this up. I've tested it on a motor sitting on my desk, seems to work as expected. Hopefully will be able to test it on a real bike in a couple weeks. PR is ready for prime time. |
I've been experimenting with trying to get my Eggrider V2 working with bbs-fw. The eggrider has 2 ways in which it can switch between "road" and "offroad" profiles:
Neither of these methods work with bbs-fw. For 1, the protocol is different, and for 2, bbs-fw ignores the command from the display, instead only using the global limit programmed by the tool.
This PR attempts to implement functionality where when the display limit is set to a certain value, the controller will switch to sport mode. The Eggrider can then be set to have that speed limit value in off-road mode, therefore switching between the profiles in bbs-fw.
Note that this does not attempt to implement any ability for the Eggrider to program the firmware, that would be impractical as the Eggrider would not support the same parameters exposed by bbs-fw. That would be something for the Eggrider folks to work on; I emailed them a month ago to ask, here's the response:
This PR is in draft as it's my first time really getting this deep on a BBS02, and I'm currently a little stuck on how to debug this. All I can confirm right now is that it compiles and the motor works as normal, but the new functionality does not work at all yet.