Code Monkey home page Code Monkey logo

Comments (6)

nitrousnrg avatar nitrousnrg commented on July 21, 2024

Hi Benjamin, bump about this one. We need a way to support different current sensor gains, I just would need to know how should I move forward, if with many binaries or with user config.
Thanks

from bldc.

vedderb avatar vedderb commented on July 21, 2024

I thought about it a bit, and one simple way would be to add a terminal command to configure the gain and store it in a hw-specific place in emulated EEPROM. I just added the following functions to the code:

/**
 * Read hw-specific variable from emulated EEPROM.
 *
 * @param v
 * The variable to read the result from.
 *
 * @param address
 * Mapped address in EEPROM. Range 0 to 63.
 *
 * @return
 * true for success, false if variable was not found.
 */
bool conf_general_read_eeprom_var_hw(eeprom_var *v, int address);

/**
 * Store hw-specific variable to emulated EEPROM.
 *
 * @param v
 * The variable to store the result in.
 *
 * @param address
 * Mapped address in EEPROM. Range 0 to 63.
 *
 * @return
 * true for success, false if something went wrong.
 */
bool conf_general_store_eeprom_var_hw(eeprom_var *v, int address);

I haven't tested the code, so there might be some errors.

The idea would be that you try to load the variable at boot, and if it fails use a default value. Then you can update the variables with terminal commands. The advantage of this is that you can add custom features to hardware without impacting the rest of the code base. The disadvantage is that the terminal interface might be less intuitive.

Can you give it a try and see if it works?

from bldc.

nitrousnrg avatar nitrousnrg commented on July 21, 2024

Thanks Benjamin, I get it and its a promising feature to implement many other things. I can see a user forgetting to send the command after upgrading the firmware so I hope in the future we can expose the current gain to vesc tool. Perhaps a way to hide settings from vesc tool. Anyway, wishlist stuff.

I will give it a test ride right after finishing the PR I'm working on.

from bldc.

vedderb avatar vedderb commented on July 21, 2024

Persistent settings between updates would be useful if they are a bit hidden. I will look into storing the settings in RAM before the reboot at the firmware update, and attempt to load them back from there if reading the emulated eeprom fails. Then the function can have an argument that tells if the parameter is loaded from ram, and what the firmware version was when it was stored. Then your hardware file can decide if it is still compatible and store it back if it is. I can probably do something similar for the motor and app settings, and decide if they are compatible based on the signature.

from bldc.

nitrousnrg avatar nitrousnrg commented on July 21, 2024

Persistent settings would be great for all users, saves some clicks on the GUI :)

from bldc.

nitrousnrg avatar nitrousnrg commented on July 21, 2024

I tested it today and the store/read functions work well. I have a terminal command that sets the current sensor gain, thanks! This commit is sitting on top of a branch not yet merged, it has to wait for a couple of pull requests.

from bldc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.