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

Event handling! Unit tests! #170

Merged
merged 26 commits into from
Feb 12, 2024
Merged

Event handling! Unit tests! #170

merged 26 commits into from
Feb 12, 2024

Conversation

Cabooman
Copy link
Collaborator

@Cabooman Cabooman commented Feb 11, 2024

WHAT

Events: More complete event handling, that also handles system reactions and handles event logging to EEPROM
Unit tests: A simple unit test framework.

WHY

Events: Easier to add events and handle events in a more deterministic manner
Unit tests: A way to more easily verify functionality, and use for regression testing

HOW

Events: Centralization of bms_status handling, led_color, event message handling, etc etc., plus an EEPROM log
Unit tests: Adding a header-only unit test framework and unit-test Github Action

@Cabooman
Copy link
Collaborator Author

One thing to fix, hopefully soon: The ERROR level has priority over DEBUG, so OTA updates do not change the color to blue at the moment. Will see if I can make a quickfix

Software/USER_SETTINGS.h Outdated Show resolved Hide resolved
Software/Software.ino Outdated Show resolved Hide resolved
Software/Software.ino Outdated Show resolved Hide resolved
@@ -12,13 +13,14 @@ int ESP32CAN::CANWriteFrame(const CAN_frame_t* p_frame) {
tx_ok = (result == 0) ? true : false;
if (tx_ok == false) {
Serial.println("CAN failure! Check wires");
LEDcolor = 3;
set_event(EVENT_CAN_FAILURE, 0);
Copy link
Owner

@dalathegreat dalathegreat Feb 12, 2024

Choose a reason for hiding this comment

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

This CAN failure is not the same as the other ones. This means nobody is acking messages on the bus, wires might be disconnected or termination resistance not good. This is more of a complete CAN failure. The other ones are more battery missing on CAN. We should have separate events for these two

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can add an event and split RX/TX, no probs

@Cabooman Cabooman merged commit 8f61883 into main Feb 12, 2024
36 checks passed
@dalathegreat dalathegreat deleted the feature/event-log branch February 26, 2024 20:05
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.

2 participants