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

New feature: Test fake battery #94

Merged
merged 9 commits into from
Nov 15, 2023
Merged

New feature: Test fake battery #94

merged 9 commits into from
Nov 15, 2023

Conversation

dalathegreat
Copy link
Owner

@dalathegreat dalathegreat commented Nov 13, 2023

What

This pull request adds a new feature, which lets you test your system with a fake battery!

Why

This new test mode can be very useful when testing a new inverter, or testing the inverter before the battery setup is complete, or doing isolation testing for troubleshooting. This means you no longer have to have a working battery on the CAN bus. The user "f1racr" on the Discord had great progress with this test mode!

How

There is now a new define, #define TEST_FAKE_BATTERY that can be enabled in the USER_SETTINGS.h file. When enabled, the values set in TEST-FAKE-BATTERY.cpp will be sent towards your inverter of choice. While in this test mode, the LED on the board will cycle thru all RGB values, letting you know you are in a special mode.

@lenvm
Copy link
Collaborator

lenvm commented Nov 13, 2023

@dalathegreat, to ensure that someone doesn't accidentally break the code for the fake battery in the future, please consider adding a line with TEST_FAKE_BATTERY to the workflows compiling the batteries: https://github.com/dalathegreat/BYD-Battery-Emulator-For-Gen24/blob/271fc8744cedab3b54da1df2180d5f0f33c2cdb9/.github/workflows/compile-all-batteries.yml#L42 and https://github.com/dalathegreat/BYD-Battery-Emulator-For-Gen24/blob/271fc8744cedab3b54da1df2180d5f0f33c2cdb9/.github/workflows/compile-all-combinations.yml#L45

@@ -79,6 +79,7 @@ uint16_t cell_min_voltage = 3700; // Stores the minimum cell voltage value in t
#define YELLOW 1
#define RED 2
#define BLUE 3
#define TEST_ALL_COLORS 10
Copy link
Collaborator

Choose a reason for hiding this comment

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

To me it seems a bit strange that the led states are defined twice: once in Software.ino, and once in the battery file. Perhaps not blocking for this PR, but for the future it may be useful to define these states once in a separate header file, which can then be included by both Software.ino and the battery file.

Copy link
Owner Author

@dalathegreat dalathegreat Nov 14, 2023

Choose a reason for hiding this comment

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

Great suggestion, I refactored this and put it in a header in commit 2621e29 EDIT: and fixed a typo in d4290cc

@dalathegreat dalathegreat merged commit 179b8ee into main Nov 15, 2023
32 checks passed
@dalathegreat dalathegreat deleted the feature/test-mode branch November 15, 2023 16:44
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