mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 09:39:33 +00:00
Add sys command
Show ESP32 model and free heap Show tasks table with stack and cpu usage
This commit is contained in:
parent
21dc47c472
commit
94c2d399b3
19
flix/cli.ino
19
flix/cli.ino
@ -36,6 +36,7 @@ const char* motd =
|
|||||||
"cr - calibrate RC\n"
|
"cr - calibrate RC\n"
|
||||||
"ca - calibrate accel\n"
|
"ca - calibrate accel\n"
|
||||||
"mfr, mfl, mrr, mrl - test motor (remove props)\n"
|
"mfr, mfl, mrr, mrl - test motor (remove props)\n"
|
||||||
|
"sys - show system information\n"
|
||||||
"reset - reset drone's state\n"
|
"reset - reset drone's state\n"
|
||||||
"reboot - reboot the drone\n";
|
"reboot - reboot the drone\n";
|
||||||
|
|
||||||
@ -134,6 +135,24 @@ void doCommand(String str, bool echo = false) {
|
|||||||
testMotor(MOTOR_REAR_RIGHT);
|
testMotor(MOTOR_REAR_RIGHT);
|
||||||
} else if (command == "mrl") {
|
} else if (command == "mrl") {
|
||||||
testMotor(MOTOR_REAR_LEFT);
|
testMotor(MOTOR_REAR_LEFT);
|
||||||
|
} else if (command == "sys") {
|
||||||
|
#ifdef ESP32
|
||||||
|
print("Chip: %s\n", ESP.getChipModel());
|
||||||
|
print("Free heap: %d\n", ESP.getFreeHeap());
|
||||||
|
// Print tasks table
|
||||||
|
print("Num Task Stack Prio Core CPU%%\n");
|
||||||
|
int taskCount = uxTaskGetNumberOfTasks();
|
||||||
|
TaskStatus_t *systemState = new TaskStatus_t[taskCount];
|
||||||
|
uint32_t totalRunTime;
|
||||||
|
uxTaskGetSystemState(systemState, taskCount, &totalRunTime);
|
||||||
|
for (int i = 0; i < taskCount; i++) {
|
||||||
|
int core = systemState[i].xCoreID == tskNO_AFFINITY ? -1 : systemState[i].xCoreID;
|
||||||
|
int cpuPercentage = systemState[i].ulRunTimeCounter / (totalRunTime / 100);
|
||||||
|
print("%-5d%-20s%-7d%-6d%-6d%d\n",systemState[i].xTaskNumber, systemState[i].pcTaskName,
|
||||||
|
systemState[i].usStackHighWaterMark, systemState[i].uxCurrentPriority, core, cpuPercentage);
|
||||||
|
}
|
||||||
|
delete[] systemState;
|
||||||
|
#endif
|
||||||
} else if (command == "reset") {
|
} else if (command == "reset") {
|
||||||
attitude = Quaternion();
|
attitude = Quaternion();
|
||||||
} else if (command == "reboot") {
|
} else if (command == "reboot") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user