Skip to content

Commit

Permalink
Bugfix release of foxBMS 2 (v1.1.1)
Browse files Browse the repository at this point in the history
fixed a CAN message decoding bug
added missing CAN messages

For a detailed list of changes, please refer to the documentation
at
https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.1.1/general/changelog.html
  • Loading branch information
foxBMS committed Aug 6, 2021
1 parent aa1ce62 commit 329216a
Show file tree
Hide file tree
Showing 44 changed files with 1,478 additions and 291 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ __pycache__
# ignore JabRef - https://www.jabref.org/
*.bak
*.sav

# Temporary Office files

*.~*
*.~$*
26 changes: 26 additions & 0 deletions conf/fmt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Formatting Configurations

This directory contains the configurations for the formatting rules applied to
the foxBMS 2 repository.

## C

foxBMS 2 uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to
automatically format the code correctly.

The formatting configuration file ``.clang-format`` is not in the directory as
clang-format has a different way of searching the configuration file
(closest configuration file to the to-be-formatted-source file is chosen).
The ``.clang-format`` is therefore stored in the repository root.

Directories that should not be automatically formatted must include a
``.clang-format`` file to disable automatic formatting:

**``.clang-format``**
```yaml
DisableFormat: true
SortIncludes: false
```

## Python
All Python formatting rules are defined in ``pyproject.toml``.
1 change: 1 addition & 0 deletions conf/fmt/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exclude = '''
| tools/waf3-2.0.22-1241519b19b496207abef1f72bbf61c2
)/
| docs/conf.py
| tests/axivion
| tools/vendor
| tools/waf-tools/why.py
)
Expand Down
4 changes: 3 additions & 1 deletion conf/guidelines/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"tools/vendor/**",
"tools/waf",
"tools/waf-verify-sig.py",
"tests/axivion/**",
"tests/scripts/waf-tools/f_guidelines/tests/**",
"tests/scripts/waf-core/general/**",
"tests/scripts/waf-core/init/**",
Expand Down Expand Up @@ -79,7 +80,8 @@
"**/.dummy",
"**/README.md",
"**/wscript",
"**/__init__.py"
"**/__init__.py",
"**/.clang-format"
]
},
"encoding": {
Expand Down
13 changes: 8 additions & 5 deletions conf/spa/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# Static Program Analysis

Do not use the cppcheck configuration in this directory for the Cppcheck GUI. Instead after running
``waf build_static_analysis`` goto build/static_analysis and use the cppcheck configuration there.
Do not use the cppcheck configuration in this directory for the Cppcheck GUI.
Instead after running ``waf build_static_analysis`` goto
``build/static_analysis`` and use the cppcheck configuration there.

## Usage in CI

The CI job uses the waf task which is intended to be a pass/fail criterion.
We are masking out quite a few rules (with the intention to reduce this number).
We are masking out quite a few rules (with the intention to reduce this
number).
The waf task prints only the failing rules that are NOT masked.

## Usage on your machine

For using cppcheck on your local machine, please take the cppcheck-GUI.
Together with the configuration file that is generated in build/static_analysis
you should be able to comfortably have a complete list of all rule violations.
Together with the configuration file that is generated in
``build/static_analysis`` you should be able to comfortably have a complete
list of all rule violations.
The GUI allows you to filter rule violations.

You can configure cppcheck to send you directly into the editor of your choice
Expand Down
31 changes: 31 additions & 0 deletions docs/general/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ Changelog

..
Comments:
Axivion is the company that builds the Axivion Bauhaus suite
slaveplausibility is the old name of a plausibility module
JUnit is a test system (originally for Java)
.. spelling::
Axivion
slaveplausibility
JUnit

Expand All @@ -31,6 +33,35 @@ Versioning follows then these rules:
- increasing ``MINOR`` adds functionality in a backwards compatible manner
- increasing ``PATCH`` fixes bugs in a backwards compatible manner

********************
[1.1.1] - 2021-08-06
********************

Added
=====

- All measurement values are now invalidated after startup to prevent invalid
data on CAN.
- Add a script for VS Code detection.
- Added signal data for string related CAN messages

Changed
=======

Deprecated
==========

Removed
=======

Fixed
=====

- fixed bug, that multiplexed cell voltages 2+3 were transmitted incorrectly via
CAN (``foxBMS_CellVoltage``)
- fixed bug, that current limits were transmitted incorrectly via CAN
(``foxBMS_LimitValues``)

********************
[1.1.0] - 2021-07-29
********************
Expand Down
1 change: 1 addition & 0 deletions docs/general/releases.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
foxBMS 2; Release Date; Permanent link to documentation
v1.1.1; 2021-08-06; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.1.1/
v1.1.0; 2021-07-29; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.1.0/
v1.0.2; 2021-04-30; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.0.2/
v1.0.1; 2021-04-16; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.0.1/
Expand Down
10 changes: 5 additions & 5 deletions docs/getting-started/software-installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ later steps of this manual.
:caption: Downloading a release
:name: download-foxbms-2
C:\Users\vulpes\Documents>curl -Ss -L -o foxbms-2-v1.1.0.zip https://github.com/foxBMS/foxbms-2/archive/v1.1.0.zip
C:\Users\vulpes\Documents>tar -x -f foxbms-2-v1.1.0.zip
C:\Users\vulpes\Documents>ren foxbms-2-1.1.0 foxbms-2
C:\Users\vulpes\Documents>curl -Ss -L -o foxbms-2-v1.1.1.zip https://github.com/foxBMS/foxbms-2/archive/v1.1.1.zip
C:\Users\vulpes\Documents>tar -x -f foxbms-2-v1.1.1.zip
C:\Users\vulpes\Documents>ren foxbms-2-1.1.1 foxbms-2
C:\Users\vulpes\Documents>cd foxbms-2
.. note::
Expand Down Expand Up @@ -107,7 +107,7 @@ Software Prerequisites
No software installation here should alter the ``PATH`` environment
variable. When an installer asks during the setup to add something to
``PATH``, always remove that option, wether it is explicitly mentioned in
that step or not. The only exception to that rule is ``VS Code``.
that step or not. The only exception to that rule **MAY** be ``VS Code``.

.. _css_install:

Expand Down Expand Up @@ -268,7 +268,7 @@ Installing VS Code and Extensions
#. Download |code| from the project website at `Visual Studio Code`_.
#. Install code: |foxbms| recommends installing |code| with the
``User Installer``, which does not require elevated rights.
#. **Let the installer add code to the PATH variable.**
#. *Optional:* Let the installer add code to the PATH variable.
#. Install extensions: To get the best development experience the following
extensions are recommended. |code| will list these among the recommended
extensions after you have run ``waf configure``.
Expand Down
5 changes: 2 additions & 3 deletions docs/hardware/design-resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
Design Resources
################

The hardware design packages for the |BMS-Master|, the |BMS-Extension|, the
|BMS-Interface| and the |BMS-Slaves| are available from the
The hardware design packages for the |bms-master|, the |bms-extension|, the
|bms-interface| and the |bms-slaves| are available from the
|foxbms_repository|. The packages include:

* Altium Designer Source Files
Expand All @@ -33,7 +33,6 @@ The hardware design packages for the |BMS-Master|, the |BMS-Extension|, the
To open the schematic and layout files, please use
`Altium Designer <https://www.altium.com/altium-designer>`_.


.. note::

To manufacture the printed circuit boards, the BOM (Microsoft Excel file)
Expand Down
2 changes: 1 addition & 1 deletion docs/macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.. |timestamp| date:: %Y-%m-%d %H:%M:%S

.. |foxbms| replace:: foxBMS 2
.. |version_foxbms| replace:: ``1.1.0``
.. |version_foxbms| replace:: ``1.1.1``
.. |github_foxbms| replace:: https://github.com/foxBMS/
.. |foxbms_repository| replace:: https://github.com/foxBMS/foxbms-2
.. _Fraunhofer IISB: https://www.iisb.fraunhofer.de
Expand Down
2 changes: 2 additions & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Altium
armcl
armnm
asm
axivion
Axivion
BMS
boolean
bugfix
Expand Down
17 changes: 16 additions & 1 deletion ide.bat
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,23 @@

@CALL %CONDA_BASE_ENVIRONMENT_ACTIVATE_SCRIPT% %CONDA_DEVELOPMENT_ENVIRONMENT_NAME%

@REM Check for VS Code
@CALL %~dp0\tools\utils\cmd\find_vs-code.bat
@IF NOT DEFINED VS_CODE @(
@ECHO Could not find VS Code.
@ECHO VS Code can be downloaded at https://code.visualstudio.com/.
@PAUSE
@EXIT /b 2
)
@IF %VS_CODE%=="" @(
@ECHO Could not find VS Code.
@ECHO VS Code can be downloaded at https://code.visualstudio.com/.
@PAUSE
@EXIT /b 1
)

@PUSHD %~dp0
@start "foxBMS Development" /b code .
@start "foxBMS Development" /b %VS_CODE% .
@IF %ERRORLEVEL% NEQ 0 (
@EXIT /b %ERRORLEVEL%
) ELSE (
Expand Down
10 changes: 5 additions & 5 deletions src/app/application/bms/bms.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static BMS_STATE_s bms_state = {
.counter = 0u,
.OscillationTimeout = 0u,
.PrechargeTryCounter = 0u,
.powerline = BMS_PL_OPEN,
.powerPath = BMS_POWER_PATH_OPEN,
.closedStrings = {0u},
.closedPrechargeContactors = {0u},
.numberOfClosedStrings = 0u,
Expand Down Expand Up @@ -327,11 +327,11 @@ static uint8_t BMS_CheckCanRequests(void) {
retVal = BMS_REQ_ID_NORMAL;
}

#if BS_SEPARATE_POWERLINES == 1
#if BS_SEPARATE_POWER_PATHS == 1
else if (request.stateRequestViaCan == BMS_REQ_ID_CHARGE) { /* NOLINT(readability/braces) */
retVal = BMS_REQ_ID_CHARGE;
}
#endif /* BS_SEPARATE_POWERLINES == 1 */
#endif /* BS_SEPARATE_POWER_PATHS == 1 */

return retVal;
}
Expand Down Expand Up @@ -879,15 +879,15 @@ void BMS_Trigger(void) {
}
} else if (bms_state.substate == BMS_CHECK_STATE_REQUESTS) {
if (BMS_CheckCanRequests() == BMS_REQ_ID_NORMAL) {
bms_state.powerline = BMS_PL_0;
bms_state.powerPath = BMS_POWER_PATH_0;
bms_state.nextstate = BMS_STATEMACH_DISCHARGE;
bms_state.timer = BMS_STATEMACH_SHORTTIME;
bms_state.state = BMS_STATEMACH_PRECHARGE;
bms_state.substate = BMS_ENTRY;
break;
}
if (BMS_CheckCanRequests() == BMS_REQ_ID_CHARGE) {
bms_state.powerline = BMS_PL_1;
bms_state.powerPath = BMS_POWER_PATH_1;
bms_state.nextstate = BMS_STATEMACH_CHARGE;
bms_state.timer = BMS_STATEMACH_SHORTTIME;
bms_state.state = BMS_STATEMACH_PRECHARGE;
Expand Down
14 changes: 7 additions & 7 deletions src/app/application/bms/bms.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ typedef enum BMS_RETURN_TYPE {
BMS_ILLEGAL_TASK_TYPE, /*!< Illegal */
} BMS_RETURN_TYPE_e;

/** Powerline type (discharge or charge) */
typedef enum BMS_POWERLINE_TYPE {
BMS_PL_OPEN, /* contactors open */
BMS_PL_0, /* discharge */
BMS_PL_1, /* charge */
} BMS_POWERLINE_TYPE_e;
/** Power path type (discharge or charge) */
typedef enum BMS_POWER_PATH_TYPE {
BMS_POWER_PATH_OPEN, /* contactors open */
BMS_POWER_PATH_0, /* power path */
BMS_POWER_PATH_1, /* second power path */
} BMS_POWER_PATH_TYPE_e;

/**
* This structure contains all the variables relevant for the CONT state
Expand All @@ -197,7 +197,7 @@ typedef struct BMS_STATE {
uint32_t restTimer_10ms; /*!< timer until battery system is at rest */
uint16_t OscillationTimeout; /*!< timeout to prevent oscillation of contactors */
uint8_t PrechargeTryCounter; /*!< timeout to prevent oscillation of contactors */
BMS_POWERLINE_TYPE_e powerline; /*!< powerline type (discharge or charge) */
BMS_POWER_PATH_TYPE_e powerPath; /*!< power path type (discharge or charge) */
uint8_t numberOfClosedStrings; /*!< number of closed strings */
uint16_t stringOpenTimeout; /*!< timeout to abort if string opening takes too long */
uint32_t nextstringclosedtimer; /*!< timer to wait if the next string was closed */
Expand Down
10 changes: 5 additions & 5 deletions src/app/application/config/battery_system_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,14 @@ typedef enum BS_STRING_ID {
* @brief separation of charge and discharge power line
* @ptype select(2)
*/
#define BS_SEPARATE_POWERLINES (1)
#define BS_SEPARATE_POWER_PATHS (1)

#if (BS_NR_OF_CONTACTORS > 3) && (BS_SEPARATE_POWERLINES == 0)
#error "Configuration mismatch: Can't use only one powerline with more than 3 contactors"
#if (BS_NR_OF_CONTACTORS > 3) && (BS_SEPARATE_POWER_PATHS == 0)
#error "Configuration mismatch: Can't use only one power path with more than 3 contactors"
#endif /* */

#if (BS_NR_OF_CONTACTORS < 4) && (BS_SEPARATE_POWERLINES == 1)
#error "Configuration mismatch: Can't use separate powerlines with less than 4 contactors"
#if (BS_NR_OF_CONTACTORS < 4) && (BS_SEPARATE_POWER_PATHS == 1)
#error "Configuration mismatch: Can't use separate power path with less than 4 contactors"
#endif /* */

/**
Expand Down
25 changes: 25 additions & 0 deletions src/app/application/redundancy/redundancy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,31 @@ static STD_RETURN_TYPE_e MRC_UpdateCellTemperatureValidation(
}

/*========== Extern Function Implementations ================================*/
extern STD_RETURN_TYPE_e MRC_Initialize(void) {
STD_RETURN_TYPE_e retval = STD_NOT_OK;
for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) {
for (uint8_t m = 0u; m < BS_NR_OF_MODULES; m++) {
/* Invalidate cell voltage values */
mrc_tableCellVoltages.invalidCellVoltage[s][m] = 0xFFFFFFFFFFFFFFFFULL;
mrc_tableCellVoltages.validModuleVoltage[s][m] = false;
/* Invalidate cell temperature values */
mrc_tableCellTemperatures.invalidCellTemperature[s][m] = 0xFFFF;
}
/* Invalidate string values */
mrc_tablePackValues.invalidStringVoltage[s] = 0x01;
mrc_tablePackValues.invalidStringCurrent[s] = 0x01;
mrc_tablePackValues.invalidStringPower[s] = 0x01;
}
/* Invalidate pack values */
mrc_tablePackValues.invalidPackCurrent = 0x01; /*!< bitmask if current is valid. 0->valid, 1->invalid */
mrc_tablePackValues.invalidBatteryVoltage = 0x01; /*!< bitmask if voltage is valid. 0->valid, 1->invalid */
mrc_tablePackValues.invalidHvBusVoltage = 0x01; /*!< bitmask if voltage is valid. 0->valid, 1->invalid */
mrc_tablePackValues.invalidPackPower = 0x01; /*!< bitmask if power is valid. 0->valid, 1->invalid */

retval = DATA_WRITE_DATA(&mrc_tableCellVoltages, &mrc_tableCellTemperatures, &mrc_tablePackValues);
return retval;
}

extern STD_RETURN_TYPE_e MRC_ValidateMicMeasurement(void) {
STD_RETURN_TYPE_e retval = STD_OK;

Expand Down
7 changes: 7 additions & 0 deletions src/app/application/redundancy/redundancy.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ typedef struct MRC_STATE {
} MRC_STATE_s;

/*========== Extern Function Prototypes =====================================*/
/**
* @brief Function to initalize redundancy module
*
* @return #STD_OK if module has been initialized successfully, otherwise #STD_NOT_OK
*/
extern STD_RETURN_TYPE_e MRC_Initialize(void);

/**
* @brief Function to validate the measurement between redundant measurement
* values for cell voltage and cell temperature
Expand Down

0 comments on commit 329216a

Please sign in to comment.