Simplify can sending routine and perf check

This commit is contained in:
Daniel Öster 2025-04-26 23:43:51 +03:00
parent c49912df36
commit c8de168435
62 changed files with 98 additions and 301 deletions

View file

@ -513,14 +513,9 @@ void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
}
}
void transmit_can_battery() {
unsigned long currentMillis = millis();
void transmit_can_battery(unsigned long currentMillis) {
// Send 10ms CAN Message
if (currentMillis - previousMillis10ms >= INTERVAL_10_MS) {
// Check if sending of CAN messages has been delayed too much.
if ((currentMillis - previousMillis10ms >= INTERVAL_10_MS_DELAYED) && (currentMillis > BOOTUP_TIME)) {
set_event(EVENT_CAN_OVERRUN, (currentMillis - previousMillis10ms));
}
previousMillis10ms = currentMillis;
transmit_can_frame(&CMFA_1EA, can_config.battery);
transmit_can_frame(&CMFA_135, can_config.battery);