Compare commits
2 Commits
11a2121fd8
...
48a06b87ae
Author | SHA1 | Date | |
---|---|---|---|
48a06b87ae | |||
44c012082b |
1
AMS_Master_Code/.vscode/launch.json
vendored
1
AMS_Master_Code/.vscode/launch.json
vendored
@ -36,7 +36,6 @@
|
|||||||
"request": "attach",
|
"request": "attach",
|
||||||
"type": "cortex-debug",
|
"type": "cortex-debug",
|
||||||
"servertype": "openocd",
|
"servertype": "openocd",
|
||||||
"preLaunchTask": "Build STM",
|
|
||||||
"device": "stm32h7a3xxq.s",
|
"device": "stm32h7a3xxq.s",
|
||||||
"configFiles": [
|
"configFiles": [
|
||||||
"openocd.cfg"
|
"openocd.cfg"
|
||||||
|
@ -104,7 +104,7 @@ static inline void debug_clear_console() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[gnu::format(printf, 2, 3)]]
|
[[gnu::format(printf, 2, 3)]]
|
||||||
static inline void debug_log(unsigned int level, const char *msg, ...) {
|
static inline void debug_log(enum log_level_t level, const char *msg, ...) {
|
||||||
if (!DEBUG_CHANNEL_ENABLED(level)) {
|
if (!DEBUG_CHANNEL_ENABLED(level)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ static inline void debug_log(unsigned int level, const char *msg, ...) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[gnu::format(printf, 2, 3)]]
|
[[gnu::format(printf, 2, 3)]]
|
||||||
static inline void debug_log_cont(unsigned int level, const char *msg, ...) {
|
static inline void debug_log_cont(enum log_level_t level, const char *msg, ...) {
|
||||||
if (!DEBUG_CHANNEL_ENABLED(level)) {
|
if (!DEBUG_CHANNEL_ENABLED(level)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -248,6 +248,10 @@ HAL_StatusTypeDef ___readCMD(uint16_t command, uint8_t * buffer, size_t arglen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arglen == 0) {
|
||||||
|
return HAL_OK; //no data to check
|
||||||
|
}
|
||||||
|
|
||||||
//check data PEC
|
//check data PEC
|
||||||
for (size_t i = 0; i < N_BMS; i++) {
|
for (size_t i = 0; i < N_BMS; i++) {
|
||||||
size_t offset = BUFFER_BMS_OFFSET(i, arglen);
|
size_t offset = BUFFER_BMS_OFFSET(i, arglen);
|
||||||
@ -257,13 +261,14 @@ HAL_StatusTypeDef ___readCMD(uint16_t command, uint8_t * buffer, size_t arglen)
|
|||||||
for (size_t j = 0; j < arglen + 2; j++) {
|
for (size_t j = 0; j < arglen + 2; j++) {
|
||||||
debug_log_cont(LOG_LEVEL_ERROR, "%02X ", buffer[offset + j]);
|
debug_log_cont(LOG_LEVEL_ERROR, "%02X ", buffer[offset + j]);
|
||||||
}
|
}
|
||||||
debug_log_cont(LOG_LEVEL_ERROR, " | %02X %02X ", buffer[offset + arglen], buffer[offset + arglen + 1]); //print out the DPEC
|
debug_log_cont(LOG_LEVEL_ERROR, "| %02X %02X ", buffer[offset + arglen], buffer[offset + arglen + 1]); //print out the DPEC
|
||||||
debug_log(LOG_LEVEL_ERROR, "^ DATA");
|
debug_log(LOG_LEVEL_ERROR, " DATA ^");
|
||||||
//print out spaces until start of DPEC
|
//print out spaces until start of DPEC
|
||||||
for (size_t j = 0; j < arglen; j++) {
|
for (size_t j = 0; j < arglen - 1; j++) {
|
||||||
debug_log_cont(LOG_LEVEL_ERROR, (arglen < 2) ? "" : " ");
|
debug_log_cont(LOG_LEVEL_ERROR, (arglen < 2) ? "" : "^^^");
|
||||||
}
|
}
|
||||||
debug_log(LOG_LEVEL_ERROR, " ^ DPEC");
|
debug_log_cont(LOG_LEVEL_ERROR, "^^ ");
|
||||||
|
debug_log_cont(LOG_LEVEL_ERROR, " PEC ^");
|
||||||
return HAL_ERROR;
|
return HAL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user