change the priority of a task in FreeRTOS at runtime using STM32CubeIDE and STM32 HAL libraries

How can I change the priority of a task in FreeRTOS at runtime using STM32CubeIDE and STM32 HAL libraries? My task priority isn't updating. Here's my code:
vTaskPrioritySet(xTaskHandle, 2);
vTaskPrioritySet(xTaskHandle, 2);
What could be the issue? @Middleware & OS
Solution:
If you table is in a form of matrix u can use the example below 👇 ``` replace with your 2d table 👇 lookup_table = [ [10, 20, 30],...
Jump to solution
3 Replies
Enthernet Code
Enthernet Code•5mo ago
Hi @Boss lady , make sure that xTaskHandle is the correct handle to the task whose priority you want to change. This handle should have been obtained when creating the task or by using a function like xTaskCreate(), also add error handling to aid easy debugging of your code.
Solution
Enthernet Code
Enthernet Code•5mo ago
If you table is in a form of matrix u can use the example below 👇
# replace with your 2d table 👇
lookup_table = [
[10, 20, 30],
[40, 50, 60],
[70, 80, 90]
]

(transpose) the table
def invert_table(table):
return [list(row) for row in zip(*table)]

inverted_table = invert_table(lookup_table)

print("Original Table:")
for row in lookup_table:
print(row)

print("\n")

print("Inverted Table:")
for row in inverted_table:
print(row)
# replace with your 2d table 👇
lookup_table = [
[10, 20, 30],
[40, 50, 60],
[70, 80, 90]
]

(transpose) the table
def invert_table(table):
return [list(row) for row in zip(*table)]

inverted_table = invert_table(lookup_table)

print("Original Table:")
for row in lookup_table:
print(row)

print("\n")

print("Inverted Table:")
for row in inverted_table:
print(row)
Boss lady
Boss lady•5mo ago
Okay, I have verified that the xTaskHandle is correct based on the priority I want to change, for the error handling can you give me a code snippet or guide to follow
Want results from more Discord servers?
Add your server