You are here

set current with custom app

3 posts / 0 new
Last post
sirAnton
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-10 09:44
Posts: 8
set current with custom app

Hello, i have tried to write a custom app to set the max batt current (or better wattage) in runtime. My custom app started and can debug writes in the VESC Terminal.
Which function should i used to do that?   mc_interface_set_current_rel(10); does not work.

Edit: I used hw 4.12, und start the ADC app for speed control + My custom app

sirAnton
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-10 09:44
Posts: 8

Hello, now i set the variable in my code and this works.

                mcconf = *mc_interface_get_configuration();
                mcconf.l_in_current_max = 2;
                mcconf.lo_in_current_max = 2;
                mc_interface_set_configuration(&mcconf);

Is this OK for the VESC to change the variable under full load?

benjamin
Offline
Last seen: 1 month 1 week ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

That will re-init a lot of stuff, so it is probably not a good idea. I will implement support for updating limits in run time, but for now I think you can do something like this:

mc_configuration *conf = (mc_configuration*)mc_interface_get_configuration();
conf->l_in_current_max = 2.0;
conf->lo_in_current_max = 2.0;