Fixed compiling with DEBUG=ON

This commit is contained in:
Raphael Coeffic
2021-11-21 11:18:35 +01:00
committed by Raphael Coeffic
parent c8a4a80ffd
commit ffd537a28b
3 changed files with 42 additions and 4 deletions
+14 -4
View File
@@ -25,6 +25,8 @@
#include <malloc.h>
#include <new>
#include "cli_traces.h"
#define CLI_COMMAND_MAX_ARGS 8
#define CLI_COMMAND_MAX_LEN 256
@@ -837,10 +839,13 @@ int cliSet(const char **argv)
return -1;
}
if (level)
if (level) {
GPIO_SetBits(INTMODULE_BOOTCMD_GPIO, INTMODULE_BOOTCMD_GPIO_PIN);
else
serialPrint("%s: bootpin set", argv[0]);
} else {
GPIO_ResetBits(INTMODULE_BOOTCMD_GPIO, INTMODULE_BOOTCMD_GPIO_PIN);
serialPrint("%s: bootpin reset", argv[0]);
}
}
#endif
@@ -1187,9 +1192,11 @@ int cliDisplay(const char ** argv)
printDebugTimers();
}
#endif
#if defined(DEBUG_AUDIO)
else if (!strcmp(argv[1], "audio")) {
printAudioVars();
}
#endif
#if defined(DISK_CACHE)
else if (!strcmp(argv[1], "dc")) {
DiskCacheStats stats = diskCache.getStats();
@@ -1234,9 +1241,12 @@ int cliRepeat(const char ** argv)
if (toInt(argv, 1, &interval) > 0 && argv[2]) {
interval *= 50;
counter = interval;
uint8_t c;
while (!cliRxFifo.pop(c) || !(c == '\r' || c == '\n' || c == ' ')) {
RTOS_WAIT_MS(20); // 20ms
const TickType_t xTimeout = 20 / RTOS_MS_PER_TICK;
while (!xStreamBufferReceive(cliRxBuffer, &c, 1, xTimeout)
|| !(c == '\r' || c == '\n' || c == ' ')) {
if (++counter >= interval) {
cliExecCommand(&argv[2]);
counter = 0;
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#pragma once
#include <stdint.h>
// Allows for switchable debug prints via CLI
extern uint8_t cliTracesEnabled;
+1
View File
@@ -44,6 +44,7 @@ uint8_t aux2SerialTracesEnabled();
#include <stdio.h>
#define debugPrintf(...) printf(__VA_ARGS__)
#elif defined(DEBUG) && defined(CLI)
#include "cli_traces.h"
#define debugPrintf(...) do { if (cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
#elif defined(DEBUG)
#define debugPrintf(...) do { serialPrintf(__VA_ARGS__); } while(0)