some debugger-commands added
This commit is contained in:
@@ -26,6 +26,7 @@ void Debug_dumpPersistance();
|
||||
void Debug_ShowDTCs();
|
||||
void Debug_dumpGlobals();
|
||||
void Debug_printHelp();
|
||||
void Debug_Purge();
|
||||
const char *uint32_to_binary_string(uint32_t num);
|
||||
|
||||
/**
|
||||
@@ -273,6 +274,10 @@ void processCmdDebug(String command)
|
||||
Websocket_PushNotification("Debug Success Notification", success);
|
||||
else if (command == "notify_info")
|
||||
Websocket_PushNotification("Debug Info Notification", info);
|
||||
else if (command == "purge")
|
||||
Debug_Purge();
|
||||
else if (command == "toggle_wifi")
|
||||
globals.toggle_wifi = true;
|
||||
else
|
||||
Debug_pushMessage("unknown Command\n");
|
||||
}
|
||||
@@ -488,6 +493,18 @@ void Debug_printHelp()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start purging for 10 pulses.
|
||||
*/
|
||||
void Debug_Purge()
|
||||
{
|
||||
globals.purgePulses = 10;
|
||||
globals.resumeStatus = globals.systemStatus;
|
||||
globals.systemStatus = sysStat_Purge;
|
||||
|
||||
Debug_pushMessage("Purging 10 pulses\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a uint32_t value to a binary string with nibbles separated by a space.
|
||||
*
|
||||
@@ -501,12 +518,15 @@ void Debug_printHelp()
|
||||
* @return A pointer to a const char string containing the binary representation
|
||||
* of the input number with nibbles separated by a space.
|
||||
*/
|
||||
const char* uint32_to_binary_string(uint32_t num) {
|
||||
const char *uint32_to_binary_string(uint32_t num)
|
||||
{
|
||||
static char binary_str[65]; // 32 bits + 31 spaces + null terminator
|
||||
int i, j;
|
||||
for (i = 31, j = 0; i >= 0; i--, j++) {
|
||||
for (i = 31, j = 0; i >= 0; i--, j++)
|
||||
{
|
||||
binary_str[j] = ((num >> i) & 1) ? '1' : '0';
|
||||
if (i % 4 == 0 && i != 0) {
|
||||
if (i % 4 == 0 && i != 0)
|
||||
{
|
||||
binary_str[++j] = ' '; // Insert space after every nibble
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user