joncox123 / MotoButtons

Low cost, waterproof controller for motorcycle navigation, phone and media control
GNU General Public License v3.0
22 stars 4 forks source link

Additional Mode #3

Closed Joergen57 closed 1 year ago

Joergen57 commented 1 year ago

Hi Jon,

thanks for the project. I ordered the parts and cant wait to test is with my Oukitel Android tablet, I am using MyRouteApp (MRA) for navigation and hope that the Motobuttons work with MRA as well. MRA will support BarButtons, WunderLINQ and SilverFox, but these are more expensive. As suggested in another issue, BarButtons mode would be nice to have as well. If it works with MRA, there will be a lot of request, for this controller. I will let you know. Is there a plan to offer final products for none DIY people? PS: I send you a message via FB, you can ignore it. Regards Jörgen

joncox123 commented 1 year ago

I will look into MRA and add support if possible. The only challenge would be if MRA has a whitelist of controllers like the DMD2 non-beta app does.

joncox123 commented 1 year ago

Hi Jorgen, I researched adding support for MyRoute app. It will be easy to do. The key mapping uses up/down/left/right arrows, like DMD2, but also 'c' (center), +/- (zoom in/out), and 'n' to activate the menu. Since Motobuttons Lite only has 7 total buttons, my idea is for 'n' to be sent via a long press of one of the other buttons.

joncox123 commented 1 year ago

Hello, I reworked the code to support multiple modes, including a mode for MRA. I also made many other improvements. Please give it a try with MRA and let me know if you have suggetions. I will also test it out, but it seems to work OK.

Joergen57 commented 1 year ago

Hi, you read my suggestion, and you have it already implemented.

That is great, thank you very much. 👍

My parts will arrive tomorrow and I hope I can finish the MotoButtons over the weekend. I will let you know the result.

joncox123 commented 1 year ago

By the way, there is a bug in the microcontroller that requires double tapping the tiny reset button to put it in software upload mode. Therefore, make sure you can access the top of the microcontroller to reset it after you complete construction.

Also, as a result, I'm not sure it makes sense to mill a slot for the USB C port. It's better to drill a hole for a USB cable to provide power. Just make sure it's long enough in the case that you can reset the microcontroller to update.

Joergen57 commented 1 year ago

Hi, yes, I read this already. Do you think it is possible to turn the PCB around to get to the reset button? Will it fit then? Maybe a hole in bottom gives access to reset. I will take a look when the parts arrive.

joncox123 commented 1 year ago

Yes, it would be better to solder the wires from the opposite side so that the top of the microcontroller faces out from the enclosure.

I think it should fit, but I haven't tried it yet.

joncox123 commented 1 year ago

Hello, I believe I found a solution for the software update bug. There is a function, enterSerialDfu() which calls NVIC_SystemReset() after setting the bootloader to Device Firmware Update (DFU) mode. This seems to work to reset the device to allow new software to be uploaded without requiring you to open the case and hit the world's smallest reset button twice.

Therefore, assuming this is reliable, what you can do to update the software is to hold down both buttons A and B (as if you were changing the mode) for 5 seconds. This will immediately reset the microcontroller and should allow you to upload firmware. No need to open the case or touch the microcontroller.

Joergen57 commented 1 year ago

You are still hardworking, very good effort! :-)

Isn't dangerous to reset the MC by hold down both buttons? Is the controller than empty? Just assume if your helmet hits the button during a brake, then will it still work?

joncox123 commented 1 year ago

Haha, if your helmet hits both buttons for 10 seconds during a hard brake, you have bigger worries than a $28 device! However, I don't think its possible to accidentally hold down both buttons for 10 seconds. But this could be increased to 30 seconds, for example.

Joergen57 commented 1 year ago

No, no, during a brake I sometimes place the helmet over the mirror. If the switch is close to that...

joncox123 commented 1 year ago

OK, that makes more sense. I think the reset procedure can be changed to holding down three buttons for 15 or 20 seconds. I don't think a helmet can do that.

Joergen57 commented 1 year ago

Some questions (I started the build). Power supply can be via the USB-C Port or an attached cable? Do you know the power consumption of the circuit? I think about a battery (maybe with switch) Is it necessary to reconnect the BT after power of? Thanks

joncox123 commented 1 year ago

The MCU has a built in battery manager circuit with dedicated battery pads and charging circuit. I don't know the power consumption, but the software isn't designed for saving power.

Bluetooth automatically reconnects after power cycling within a few seconds with my Android OnePlus 5 phone.

You can power the MCU via either 5V to the pad or a USB-C cable in the USB port. I think soldering an old USB cable 5V wire to the 5V pad is the easiest way to build and waterproof the enclosure.

The 3V3 pad is NOT a power input.

Joergen57 commented 1 year ago

Thanks for the answer, I understand.

diagram.pdf

Maybe useful, helps me to attach the wires. Fell free to use it.

joncox123 commented 1 year ago

Thanks, nice diagram. Let me know what you think of the current software. I have some work to do this weekend, so I won't have much time to work on it until next week. However, I think it needs multimedia functions (volume, change track) and a bit more work on the button logic with respect to preventing spurious key presses when changing modes.