Skip to content

Commit

Permalink
Merge pull request #730 from dalathegreat/bugfix/freeRTOS-task-assert
Browse files Browse the repository at this point in the history
Assert failure: Add task priority setting for CAN addons
  • Loading branch information
dalathegreat authored Jan 1, 2025
2 parents 53b0e1a + bcfb41e commit 608b082
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Software/src/lib/pierremolinaro-ACAN2517FD/ACAN2517FD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//----------------------------------------------------------------------------------------------------------------------

#include "ACAN2517FD.h"
#include "../../system_settings.h" //Contains task priority

//----------------------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -506,7 +507,7 @@ uint32_t ACAN2517FD::begin (const ACAN2517FDSettings & inSettings,
}
}
#ifdef ARDUINO_ARCH_ESP32
xTaskCreate (myESP32Task, "ACAN2517Handler", 1024, this, 256, &mESP32TaskHandle) ;
xTaskCreate (myESP32Task, "ACAN2517Handler", 1024, this, TASK_ACAN2517FD_PRIORITY, &mESP32TaskHandle) ;
#endif
if (mINT != 255) { // 255 means interrupt is not used
#ifdef ARDUINO_ARCH_ESP32
Expand Down
3 changes: 2 additions & 1 deletion Software/src/lib/pierremolinaro-acan2515/ACAN2515.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//··································································································

#include "ACAN2515.h"
#include "../../system_settings.h" //Contains task priority

//··································································································
// MCP2515 COMMANDS
Expand Down Expand Up @@ -225,7 +226,7 @@ uint16_t ACAN2515::beginWithoutFilterCheck (const ACAN2515Settings & inSettings,
#endif
}
#ifdef ARDUINO_ARCH_ESP32
xTaskCreate (myESP32Task, "ACAN2515Handler", 1024, this, 256, NULL) ;
xTaskCreate (myESP32Task, "ACAN2515Handler", 1024, this, TASK_ACAN2515_PRIORITY, NULL) ;
#endif
}
//----------------------------------- Return
Expand Down
11 changes: 11 additions & 0 deletions Software/src/system_settings.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef SYSTEM_SETTINGS_H_
#define SYSTEM_SETTINGS_H_
/** TASKS
* Higher number equals higher priority. Max 25 per core
*
* Parameter: TASK_CORE_PRIO
* Description:
Expand All @@ -13,10 +14,20 @@
* Parameter: TASK_MODBUS_PRIO
* Description:
* Defines the priority of MODBUS handling
*
* Parameter: TASK_ACAN2515_PRIORITY
* Description:
* Defines the priority of ACAN2515 CAN handling
*
* Parameter: TASK_ACAN2515_PRIORITY
* Description:
* Defines the priority of ACAN2517FD CAN-FD handling
*/
#define TASK_CORE_PRIO 4
#define TASK_CONNECTIVITY_PRIO 3
#define TASK_MODBUS_PRIO 8
#define TASK_ACAN2515_PRIORITY 10
#define TASK_ACAN2517FD_PRIORITY 10

/** MAX AMOUNT OF CELLS
*
Expand Down

0 comments on commit 608b082

Please sign in to comment.