hytech-racing / MCU

https://hytech-racing.github.io/MCU/index.html
GNU General Public License v3.0
0 stars 0 forks source link

handle rate limiting for CAN msg sending #8

Closed RCMast3r closed 7 months ago

RCMast3r commented 7 months ago

in order to handle the rate limiting for message sending I am thinking that we use the time the interface was commanded the first time and there is a minimum required time period for the successive sending of the messages.

RCMast3r commented 7 months ago
void DrivetrainSystem::enable_drivetrain_hv(current_time_ms)
{

    if( ( (current_time_ms - prev_time_) > required_period_ms_) || (prev_time_ ==0 ) )
    {
        for(auto inv : inv_pointers_)
        {
            inv->enable_inverter_hv();
        }
    }
    prev_time_ = current_time_ms;
}
RCMast3r commented 7 months ago