BotoX / xiaomi-m365-firmware-patcher

Automatize patching of Xiaomi Mijia M365 electric scooter firmware
https://m365.botox.bz
406 stars 107 forks source link

Add import and export #37

Closed Yaty closed 5 years ago

Yaty commented 5 years ago

36

I also added some constants and minor improvements.

Yaty commented 5 years ago

We could allow users to save firmware parameters in the browser local storage to be able to switch quickly between them. We could also allow users to share firmware parameters with a link. What do you think ?

BotoX commented 5 years ago

When you generate the firmware you download it from a link like: http://m365.botox.bz/cfw?version=DRV138&kers_min_speed=40.0&normal_max_speed=30&eco_max_speed=26&motor_start_speed=3.0&motor_power_constant=38000&instant_eco_switch=on&voltage_limit=52.00&remove_hard_speed_limit=on This link is also in the generated ZIP file description.

However if you want you could make this work on the main page (simple javascript in the HTML) so it sets the fields in the HTML.

Yaty commented 5 years ago

Oh nice ! I can add that in the PR if you're ok with it :)

BotoX commented 5 years ago

Yep, that sounds like a good feature and probably also not too hard to implement.

And maybe make a link or button under / next to the Patch button that is called 'Share' which can be used to generate/copy that link?

Yaty commented 5 years ago

Sounds good !

Yaty commented 5 years ago

I added the share button. So now in this PR there are :

  1. Share button that copy into the clipboard a link to download a custom firmware
  2. Export button to export parameters into a json file
  3. Import button to import from a json file

I think it could also be nice to be able to copy a link that will launch the web app with pre-filled parameters (from query strings per example).

So there would be :

  1. Import/Export
  2. Share download link in clipboard
  3. Share web link

Maybe the Import/Export feature is now useless, I can remove it.

BotoX commented 5 years ago

I was actually thinking that the share button would not share the download thing but act like the import/export feature. So if you hit share you get https://m365.botox.bz/?version=DRV138&kers_min_speed=40.0&normal_max_speed=30 etc. without the /cfw part. And the javascript on the page takes those URL params to fill the forms. This is much easier to share than a json file

Yaty commented 5 years ago

Done !

roeebloch commented 5 years ago

Can I ask question - is this good for ES2 (ninebot) ?

BotoX commented 5 years ago

Wrong place to ask. And no I am not planning on supporting the Ninebot ES2 as I only have a Xiaomi M365 and it's the better scooter anyways :p But I've seen somebody else work on ES2 support, I don't know any details however or who it is.

nopbxlr commented 5 years ago

My fork supports the ES2 It is accessible at https://ninebot.scooterhacking.org/ Also, Yaty, we graduated from the same high school, funny ;)

Adorfer commented 5 years ago

@scooterhacking what is actually the link between your fork and the import/export function?