Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MEB max 1A issue / Add automatic precharge / Add basic OBD functionality #791

Merged
merged 42 commits into from
Jan 15, 2025

Conversation

mvgalen
Copy link
Collaborator

@mvgalen mvgalen commented Jan 14, 2025

What

  • Fix MEB battery issue where battery would open contactors if current would exceed 1A.
  • Add automatic external precharge voltage generation functionality
  • Add a minimal implementation of OBD frame/sending receiving to get DTC's from batteries that support it over OBD.
  • Startup batteries in bms_status INACTIVE and change to STANDBY (MEB) or ACTIVE (all other batteries) when messages have been received, switch to ACTIVE when contactors have been closed (MEB).

Why

This branch started out as just adding precharge control, but during development the max 1A issue was encountered. To try to diagnose it, the OBD queries were added. This PR closes #762 and #658.

mvgalen added 30 commits January 2, 2025 11:44
- Split index_html string in header and footer part
- Use header and footer for index html template page
- Fix missing html and head tags in minified index html.
- Do not use templating engine for debug and can log pages, by using index html header and footer directly in generated content.
This reverts commit 04a68fc.
The commit only fixed the symptoms not the cause.
This reverts commit af05f28.
The original commit only fixed the symptoms, the cause has been fixed,
now we ran revert these.
…IVE upon reception of SOC from battery.

- Change default state of bms_Status to INACTIVE
- switch to ACTIVE upon reception of SOC from battery.
- Do not change bms_mode to ACTIVE upon reception of info/warning/debug event.
- Reset bms_mode to INACTIVE and CAN_battery_still_alive when resetting all events
- Fix printf end of line detection
- Fix overwriting of timestamp in printf path
- Add version + build date/time to log
Move logging of version/data/time to setup() to ensure it is also printed to serial.
- Add DTC request every second.
- Add log entry for unknown CAN messages.
- Addition of transmit_obd_can_frame and handle_obd_frame functions
- Use dump_can_frame function in comm_can.cpp as well.
- Fix code formatting of dump_can_frame function
- Start polling frame earlier.
- Prevent false positive on delayed can sending.
- Add log message for first CAN received from battery.
- Add log message for timeout of CAN reception from battery.
Software/Software.ino Outdated Show resolved Hide resolved
@@ -341,10 +343,12 @@ void emulator_pause_state_transmit_can_battery() {
allowed_to_send_CAN = (!emulator_pause_CAN_send_ON || emulator_pause_status == NORMAL);

if (previous_allowed_to_send_CAN && !allowed_to_send_CAN) {
logging.printf("Safety: Pausing CAN sending");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging should be wrapped in #ifdef DEBUG LOG

Software/src/devboard/safety/safety.cpp Show resolved Hide resolved
Software/src/devboard/utils/events.cpp Outdated Show resolved Hide resolved
Software/src/devboard/utils/events.cpp Outdated Show resolved Hide resolved
Software/src/battery/BMW-I3-BATTERY.cpp Outdated Show resolved Hide resolved
…h to ACTIVE upon reception of SOC from battery."

This reverts commit f6c73e9.
- Split bms_status (system status) to real_bms_status (bms status)
- Put #ifdef DEBUG_LOG around all log calls.
- Do not update bms_status (system status) directly, fire event instead from automatic precharge control
- Add Battery BMS status to webserver for MEB battery type only
@mvgalen mvgalen requested a review from dalathegreat January 15, 2025 05:41
@dalathegreat dalathegreat merged commit cb3713c into main Jan 15, 2025
110 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add generic OBD support
2 participants