replace print/printMsg with scheduleMsg (#2497)
* start cleaning * disabled feature means don't print that it's disabled * cli * usages * printMsg -> scheduleMsg * this is alllll dead now * no crlf please * all hope is lost if you manage to hit this line * tests * tests * ok we did actually need that part * sim * d * kinetis * it did ifdef, not if Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
0f0d8f6339
commit
4e3e95db2d
|
@ -12,9 +12,6 @@
|
|||
void chDbgPanic3(const char* /*msg*/, const char* /*file*/, int /*line*/) {
|
||||
}
|
||||
|
||||
void print(const char* /*format*/, ...) {
|
||||
}
|
||||
|
||||
void scheduleMsg(Logging* /*logging*/, const char* /*fmt*/, ...) {
|
||||
}
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@
|
|||
#define CCM_UNUSED_SIZE 1
|
||||
|
||||
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
|
||||
#define EFI_PRINT_MESSAGES_TO_TERMINAL TRUE
|
||||
// #define EFI_PRINT_MESSAGES_TO_TERMINAL TRUE
|
||||
|
||||
#undef EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
||||
#define EFI_ACTIVE_CONFIGURATION_IN_FLASH TRUE
|
||||
|
|
|
@ -368,7 +368,7 @@ static void handleWriteValueCommand(TsChannelBase* tsChannel, ts_response_format
|
|||
tunerStudioDebug("got W (Write)"); // we can get a lot of these
|
||||
|
||||
#if EFI_TUNER_STUDIO_VERBOSE
|
||||
// scheduleMsg(logger, "Page number %d\r\n", pageId); // we can get a lot of these
|
||||
// scheduleMsg(logger, "Page number %d", pageId); // we can get a lot of these
|
||||
#endif
|
||||
|
||||
if (validateOffsetCount(offset, 1, tsChannel)) {
|
||||
|
@ -569,8 +569,10 @@ static void tsProcessOne(TsChannelBase* tsChannel) {
|
|||
}
|
||||
|
||||
int success = tsInstance.handleCrcCommand(tsChannel, tsChannel->scratchBuffer, incomingPacketSize);
|
||||
if (!success)
|
||||
print("got unexpected TunerStudio command %x:%c\r\n", command, command);
|
||||
|
||||
if (!success) {
|
||||
scheduleMsg(&tsLogger, "got unexpected TunerStudio command %x:%c", command, command);
|
||||
}
|
||||
}
|
||||
|
||||
void runBinaryProtocolLoop(TsChannelBase* tsChannel) {
|
||||
|
|
|
@ -50,7 +50,7 @@ void startTsPort(ts_channel_s *tsChannel) {
|
|||
#if defined(TS_UART_DEVICE) || defined(TS_SERIAL_DEVICE)
|
||||
if (CONFIG(useSerialPort)) {
|
||||
|
||||
print("TunerStudio over USART");
|
||||
scheduleMsg(&tsLogger, "TunerStudio over USART");
|
||||
/**
|
||||
* We have hard-coded USB serial console so that it would be clear how to connect to each specific board,
|
||||
* but for UART serial we allow users to change settings.
|
||||
|
@ -59,15 +59,16 @@ void startTsPort(ts_channel_s *tsChannel) {
|
|||
efiSetPadMode("tunerstudio tx", engineConfiguration->binarySerialTxPin, PAL_MODE_ALTERNATE(TS_SERIAL_AF));
|
||||
|
||||
#if TS_UART_DMA_MODE
|
||||
scheduleMsg(&tsLogger, "Using UART-DMA mode");
|
||||
tsChannel->uartp = TS_UART_DEVICE;
|
||||
startUartDmaConnector(tsChannel->uartp PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
#elif TS_UART_MODE
|
||||
print("Using UART mode");
|
||||
scheduleMsg(&tsLogger, "Using UART mode");
|
||||
// start DMA driver
|
||||
tsUartConfig.speed = CONFIG(tunerStudioSerialSpeed);
|
||||
uartStart(TS_UART_DEVICE, &tsUartConfig);
|
||||
#elif defined(TS_SERIAL_DEVICE)
|
||||
print("Using Serial mode");
|
||||
scheduleMsg(&tsLogger, "Using Serial mode");
|
||||
tsSerialConfig.speed = CONFIG(tunerStudioSerialSpeed);
|
||||
|
||||
sdStart(TS_SERIAL_DEVICE, &tsSerialConfig);
|
||||
|
|
|
@ -68,7 +68,6 @@ static UARTConfig tsDmaUartConfig = {
|
|||
};
|
||||
|
||||
void startUartDmaConnector(UARTDriver *uartp DECLARE_CONFIG_PARAMETER_SUFFIX) {
|
||||
print("Using UART-DMA mode");
|
||||
// init FIFO queue
|
||||
iqObjectInit(&tsUartDma.fifoRxQueue, tsUartDma.buffer, sizeof(tsUartDma.buffer), NULL, NULL);
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ static msg_t _put(void *ip, uint8_t b) {
|
|||
}
|
||||
|
||||
_putt(ip, b, CONSOLE_WRITE_TIMEOUT);
|
||||
|
||||
|
||||
// Relock if we were locked before
|
||||
if (wasLocked) {
|
||||
if (isIsrContext()) {
|
||||
|
@ -202,15 +202,6 @@ static THD_FUNCTION(consoleThreadEntryPoint, arg) {
|
|||
|
||||
#endif /* EFI_CONSOLE_NO_THREAD */
|
||||
|
||||
void consoleOutputBuffer(const uint8_t *buf, int size) {
|
||||
#if !EFI_UART_ECHO_TEST_MODE
|
||||
BaseChannel * channel = getConsoleChannel();
|
||||
if (channel != nullptr) {
|
||||
chnWriteTimeout(channel, buf, size, CONSOLE_WRITE_TIMEOUT);
|
||||
}
|
||||
#endif /* EFI_UART_ECHO_TEST_MODE */
|
||||
}
|
||||
|
||||
static Logging *logger;
|
||||
|
||||
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p) {
|
||||
|
|
|
@ -170,27 +170,6 @@ static void cmd_threads(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* This methods prints the message to whatever is configured as our primary console
|
||||
*/
|
||||
void print(const char *format, ...) {
|
||||
#if !EFI_UART_ECHO_TEST_MODE
|
||||
if (!isCommandLineConsoleReady()) {
|
||||
return;
|
||||
}
|
||||
BaseSequentialStream * channel = (BaseSequentialStream*) getConsoleChannel();
|
||||
if (channel == nullptr) {
|
||||
return;
|
||||
}
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
chvprintf(channel, format, ap);
|
||||
va_end(ap);
|
||||
#else
|
||||
UNUSED(format);
|
||||
#endif /* EFI_UART_ECHO_TEST_MODE */
|
||||
}
|
||||
|
||||
void initializeConsole(Logging *sharedLogger) {
|
||||
initConsoleLogic(sharedLogger);
|
||||
|
||||
|
|
|
@ -10,5 +10,4 @@
|
|||
#include "datalogging.h"
|
||||
|
||||
void initializeConsole(Logging *sharedLogger);
|
||||
void print(const char *fmt, ...);
|
||||
void startUsbConsole();
|
||||
|
|
|
@ -75,8 +75,6 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
|
|||
#endif /* EFI_HD44780_LCD */
|
||||
|
||||
if (!main_loop_started) {
|
||||
print("%s %s %s:%d\r\n", CRITICAL_PREFIX, msg, file, line);
|
||||
// chThdSleepSeconds(1);
|
||||
chSysHalt("Main loop did not start");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -550,7 +550,7 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX
|
|||
#if EFI_PROD_CODE
|
||||
addConsoleActionP("maininfo", (VoidPtr) showMainInfo, engine);
|
||||
|
||||
printMsg(logger, "initMainLoop: %d", currentTimeMillis());
|
||||
scheduleMsg(logger, "initMainLoop: %d", currentTimeMillis());
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ typedef enum {
|
|||
} persisted_configuration_state_e;
|
||||
|
||||
static persisted_configuration_state_e doReadConfiguration(flashaddr_t address, Logging * logger) {
|
||||
printMsg(logger, "readFromFlash %x", address);
|
||||
scheduleMsg(logger, "readFromFlash %x", address);
|
||||
intFlashRead(address, (char *) &persistentState, sizeof(persistentState));
|
||||
|
||||
if (!isValidCrc(&persistentState)) {
|
||||
|
@ -160,7 +160,7 @@ static persisted_configuration_state_e readConfiguration(Logging* logger) {
|
|||
efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "read f", PC_ERROR);
|
||||
persisted_configuration_state_e result = doReadConfiguration(getFlashAddrFirstCopy(), logger);
|
||||
if (result != PC_OK) {
|
||||
printMsg(logger, "Reading second configuration copy");
|
||||
scheduleMsg(logger, "Reading second configuration copy");
|
||||
result = doReadConfiguration(getFlashAddrSecondCopy(), logger);
|
||||
}
|
||||
|
||||
|
@ -187,11 +187,11 @@ void readFromFlash() {
|
|||
persisted_configuration_state_e result = readConfiguration(logger);
|
||||
|
||||
if (result == CRC_FAILED) {
|
||||
printMsg(logger, "Need to reset flash to default due to CRC");
|
||||
scheduleMsg(logger, "Need to reset flash to default due to CRC");
|
||||
} else if (result == INCOMPATIBLE_VERSION) {
|
||||
printMsg(logger, "Resetting due to version mismatch but preserving engine type [%d]", engineConfiguration->engineType);
|
||||
scheduleMsg(logger, "Resetting due to version mismatch but preserving engine type [%d]", engineConfiguration->engineType);
|
||||
} else {
|
||||
printMsg(logger, "Read valid configuration from flash!");
|
||||
scheduleMsg(logger, "Read valid configuration from flash!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,8 +124,6 @@ void initPotentiometers(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
|
||||
setPotResistance(&potConfig[0], 0, 3000);
|
||||
setPotResistance(&potConfig[0], 1, 7000);
|
||||
#else
|
||||
print("digiPot logic disabled\r\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ void initHardwareNoConfig(Logging *l) {
|
|||
efiAssertVoid(CUSTOM_EC_NULL, engineConfiguration!=NULL, "engineConfiguration");
|
||||
|
||||
|
||||
printMsg(sharedLogger, "initHardware()");
|
||||
scheduleMsg(sharedLogger, "initHardware()");
|
||||
|
||||
initPinRepository();
|
||||
|
||||
|
@ -605,7 +605,7 @@ void initHardware() {
|
|||
|
||||
calcFastAdcIndexes();
|
||||
|
||||
printMsg(sharedLogger, "initHardware() OK!");
|
||||
scheduleMsg(sharedLogger, "initHardware() OK!");
|
||||
}
|
||||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
|
|
@ -237,7 +237,7 @@ void lcd_HD44780_init(Logging *sharedLogger) {
|
|||
return;
|
||||
}
|
||||
|
||||
printMsg(logger, "lcd_HD44780_init %d", engineConfiguration->displayMode);
|
||||
scheduleMsg(logger, "lcd_HD44780_init %d", engineConfiguration->displayMode);
|
||||
|
||||
if (!lcd_HD44780_is_enabled())
|
||||
return;
|
||||
|
@ -267,7 +267,7 @@ void lcd_HD44780_init(Logging *sharedLogger) {
|
|||
lcd_HD44780_write_command(LCD_HD44780_DISPLAY_ON);
|
||||
|
||||
lcd_HD44780_set_position(0, 0);
|
||||
printMsg(logger, "lcd_HD44780_init() done");
|
||||
scheduleMsg(logger, "lcd_HD44780_init() done");
|
||||
}
|
||||
|
||||
void lcdShowPanicMessage(char *message) {
|
||||
|
|
|
@ -49,7 +49,7 @@ static void printGpsInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
scheduleMsg(&logging, "GPS RX %s", hwPortname(CONFIG(gps_rx_pin)));
|
||||
scheduleMsg(&logging, "GPS TX %s", hwPortname(CONFIG(gps_tx_pin)));
|
||||
|
||||
scheduleMsg(&logging, "m=%d,e=%d: vehicle speed = %.2f\r\n", gpsMesagesCount, uartErrors, getCurrentSpeed());
|
||||
scheduleMsg(&logging, "m=%d,e=%d: vehicle speed = %.2f", gpsMesagesCount, uartErrors, getCurrentSpeed());
|
||||
|
||||
float sec = currentTimeMillis() / 1000.0;
|
||||
scheduleMsg(&logging, "communication speed: %.2f", gpsMesagesCount / sec);
|
||||
|
|
|
@ -158,13 +158,13 @@ void setDateTime(const char *strDate) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
scheduleMsg(&logger, "date_set Date parameter %s is wrong\r\n", strDate);
|
||||
scheduleMsg(&logger, "date_set Date parameter %s is wrong", strDate);
|
||||
}
|
||||
#endif /* EFI_RTC */
|
||||
|
||||
void initRtc(void) {
|
||||
#if EFI_RTC
|
||||
GetTimeUnixSec(); // this would test RTC, see 'rtcWorks' variable, see #311
|
||||
printMsg(&logger, "initRtc()");
|
||||
scheduleMsg(&logger, "initRtc()");
|
||||
#endif /* EFI_RTC */
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ void runRusEfi(void) {
|
|||
runSchedulingPrecisionTestIfNeeded();
|
||||
}
|
||||
|
||||
print("Running main loop\r\n");
|
||||
scheduleMsg(&sharedLogger, "Running main loop");
|
||||
main_loop_started = true;
|
||||
/**
|
||||
* This loop is the closes we have to 'main loop' - but here we only publish the status. The main logic of engine
|
||||
|
|
|
@ -183,7 +183,7 @@ void helpCommand(void) {
|
|||
* @brief This is just a test function
|
||||
*/
|
||||
static void echo(int value) {
|
||||
print("got value: %d\r\n", value);
|
||||
scheduleMsg(logging, "got value: %d", value);
|
||||
}
|
||||
|
||||
char *unquote(char *line) {
|
||||
|
@ -371,7 +371,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
|||
if (current->parameterType == FLOAT_PARAMETER) {
|
||||
float value = atoff(parameter);
|
||||
if (cisnan(value)) {
|
||||
print("invalid float [%s]\r\n", parameter);
|
||||
scheduleMsg(logging, "invalid float [%s]", parameter);
|
||||
return;
|
||||
}
|
||||
VoidFloat callbackF = (VoidFloat) current->callback;
|
||||
|
@ -388,7 +388,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
|||
REPLACE_SPACES_WITH_ZERO;
|
||||
float value1 = atoff(parameter);
|
||||
if (cisnan(value1)) {
|
||||
print("invalid float [%s]\r\n", parameter);
|
||||
scheduleMsg(logging, "invalid float [%s]", parameter);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
|||
float value2 = atoff(parameter);
|
||||
|
||||
if (cisnan(value2)) {
|
||||
print("invalid float [%s]\r\n", parameter);
|
||||
scheduleMsg(logging, "invalid float [%s]", parameter);
|
||||
return;
|
||||
}
|
||||
if (current->parameterType == FLOAT_FLOAT_PARAMETER) {
|
||||
|
@ -425,7 +425,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
|||
float value2 = atoff(parameter);
|
||||
|
||||
if (cisnan(value2)) {
|
||||
print("invalid float [%s]\r\n", parameter);
|
||||
scheduleMsg(logging, "invalid float [%s]", parameter);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
|||
|
||||
int value = atoi(parameter);
|
||||
if (absI(value) == ERROR_CODE) {
|
||||
print("invalid integer [%s]\r\n", parameter);
|
||||
scheduleMsg(logging, "invalid integer [%s]", parameter);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ char *validateSecureLine(char *line) {
|
|||
char *divider = line;
|
||||
while (*divider != '!') {
|
||||
if (*divider == '\0') {
|
||||
print("Divider not found [%s]\r\n", line);
|
||||
scheduleMsg(logging, "Divider not found [%s]", line);
|
||||
return NULL;
|
||||
}
|
||||
divider++;
|
||||
|
@ -503,7 +503,7 @@ char *validateSecureLine(char *line) {
|
|||
line = divider;
|
||||
int actualLength = strlen(line);
|
||||
if (expectedLength != actualLength) {
|
||||
print("Error detected: expected %d but got %d in [%s]\r\n", expectedLength, actualLength, line);
|
||||
scheduleMsg(logging, "Error detected: expected %d but got %d in [%s]", expectedLength, actualLength, line);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ void handleConsoleLine(char *line) {
|
|||
if (lineLength > 100) {
|
||||
// todo: better max size logic
|
||||
// todo: better reaction to excessive line
|
||||
print("Long line?\r\n");
|
||||
scheduleMsg(logging, "Long line?");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,46 +173,6 @@ void Logging::appendFloat(float value, int precision) {
|
|||
|
||||
static char header[16];
|
||||
|
||||
/**
|
||||
* this method should invoked on the main thread only
|
||||
*/
|
||||
static void printWithLength(char *line) {
|
||||
#if ! EFI_UNIT_TEST
|
||||
int len;
|
||||
char *p;
|
||||
|
||||
if (!isCommandLineConsoleReady())
|
||||
return;
|
||||
|
||||
/**
|
||||
* this is my way to detect serial port transmission errors
|
||||
* following code is functionally identical to
|
||||
* print("line:%d:%s\r\n", len, line);
|
||||
* but it is faster because it outputs the whole buffer, not single characters
|
||||
* We need this optimization because when we output larger chunks of data like the wave_chart:
|
||||
* When we work with actual hardware, it is faster to invoke 'chSequentialStreamWrite' for the
|
||||
* whole buffer then to invoke 'chSequentialStreamPut' once per character.
|
||||
*/
|
||||
// todo: if needed we can probably know line length without calculating it, but seems like this is done not
|
||||
// under a lock so not a problem?
|
||||
|
||||
len = efiStrlen(line);
|
||||
strcpy(header, "line:");
|
||||
p = header + efiStrlen(header);
|
||||
p = itoa10(p, len);
|
||||
*p++ = ':';
|
||||
*p++ = '\0';
|
||||
|
||||
p = line;
|
||||
p += len;
|
||||
*p++ = '\r';
|
||||
*p++ = '\n';
|
||||
|
||||
consoleOutputBuffer((const uint8_t *) header, strlen(header));
|
||||
consoleOutputBuffer((const uint8_t *) line, p - line);
|
||||
#endif // EFI_UNIT_TEST
|
||||
}
|
||||
|
||||
void appendMsgPrefix(Logging *logging) {
|
||||
logging->append(PROTOCOL_MSG DELIMETER);
|
||||
}
|
||||
|
@ -226,25 +186,6 @@ void Logging::reset() {
|
|||
*linePointer = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method would output a simple console message immediately.
|
||||
* This method should only be invoked on main thread because only the main thread can write to the console
|
||||
*/
|
||||
void printMsg(Logging *logger, const char *fmt, ...) {
|
||||
efiAssertVoid(CUSTOM_ERR_6605, getCurrentRemainingStack() > 128, "lowstck#5o");
|
||||
// resetLogging(logging); // I guess 'reset' is not needed here?
|
||||
appendMsgPrefix(logger);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
logger->vappendPrintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
logger->append(DELIMETER);
|
||||
printWithLength(logger->buffer);
|
||||
logger->reset();
|
||||
}
|
||||
|
||||
Logging::Logging(char const *name, char *buffer, int bufferSize)
|
||||
: name(name)
|
||||
, buffer(buffer)
|
||||
|
|
|
@ -85,9 +85,6 @@ void appendMsgPostfix(Logging *logging);
|
|||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void printMsg(Logging *logging, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* this method copies the line into the intermediate buffer for later output by
|
||||
* the main thread
|
||||
|
|
|
@ -237,7 +237,7 @@ float atoff(const char *param) {
|
|||
char *string = todofixthismesswithcopy;
|
||||
if (indexOf(string, 'n') != -1 || indexOf(string, 'N') != -1) {
|
||||
#if ! EFI_SIMULATOR
|
||||
print("NAN from [%s]\r\n", string);
|
||||
scheduleMsg(nullptr, "NAN from [%s]", string);
|
||||
#endif
|
||||
return (float) NAN;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,6 @@ typedef uint32_t systime_t;
|
|||
|
||||
void chDbgAssert(int c, char *msg, void *arg);
|
||||
|
||||
void print(const char *fmt, ...);
|
||||
|
||||
#define TICKS_IN_MS 100
|
||||
|
||||
#define chDbgCheck(x, y) chDbgAssert(x, y, NULL)
|
||||
|
|
|
@ -45,12 +45,5 @@ GTEST_API_ int main(int argc, char **argv) {
|
|||
return result == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
void print(const char *format, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vprintf(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void initLogging(LoggingWithStorage *logging, const char *name) {
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ static void testExpression2(float selfValue, const char *line, float expected, E
|
|||
LEElement thepool[TEST_POOL_SIZE];
|
||||
LEElementPool pool(thepool, TEST_POOL_SIZE);
|
||||
LEElement * element = pool.parseExpression(line);
|
||||
print("Parsing [%s]\n", line);
|
||||
printf("Parsing [%s]\n", line);
|
||||
ASSERT_TRUE(element != NULL) << "Not NULL expected";
|
||||
LECalculator c;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "pid.h"
|
||||
|
||||
TEST(util, pid) {
|
||||
print("******************************************* testPidController\r\n");
|
||||
pid_s pidS;
|
||||
pidS.pFactor = 50;
|
||||
pidS.iFactor = 0.5;
|
||||
|
|
|
@ -40,7 +40,7 @@ static void assertNextEvent(const char *msg, int expectedPinState, TestExecutor
|
|||
}
|
||||
|
||||
static void test100dutyCycle() {
|
||||
print("*************************************** test100dutyCycle\r\n");
|
||||
printf("*************************************** test100dutyCycle\r\n");
|
||||
|
||||
expectedTimeOfNextEvent = timeNowUs = 0;
|
||||
TestExecutor executor;
|
||||
|
@ -67,7 +67,7 @@ static void test100dutyCycle() {
|
|||
}
|
||||
|
||||
static void testSwitchToNanPeriod() {
|
||||
print("*************************************** testSwitchToNanPeriod\r\n");
|
||||
printf("*************************************** testSwitchToNanPeriod\r\n");
|
||||
|
||||
expectedTimeOfNextEvent = timeNowUs = 0;
|
||||
TestExecutor executor;
|
||||
|
@ -105,8 +105,6 @@ TEST(misc, testPwmGenerator) {
|
|||
test100dutyCycle();
|
||||
testSwitchToNanPeriod();
|
||||
|
||||
print("*************************************** testPwmGenerator\r\n");
|
||||
|
||||
expectedTimeOfNextEvent = timeNowUs = 0;
|
||||
TestExecutor executor;
|
||||
SimplePwm pwm("test PWM3");
|
||||
|
|
|
@ -87,8 +87,6 @@ TEST(misc, testSignalExecutor3) {
|
|||
}
|
||||
|
||||
TEST(misc, testSignalExecutor) {
|
||||
print("*************************************** testSignalExecutor\r\n");
|
||||
|
||||
EventQueue eq;
|
||||
ASSERT_EQ(eq.getNextEventTime(0), unexpected);
|
||||
scheduling_s s1;
|
||||
|
|
|
@ -46,8 +46,6 @@ TEST(util, crc) {
|
|||
ASSERT_EQ(4, efiRound(4.4, 1));
|
||||
ASSERT_FLOAT_EQ(1.2, efiRound(1.2345, 0.1));
|
||||
|
||||
print("*************************************** testCrc\r\n");
|
||||
|
||||
const char * A = "A";
|
||||
|
||||
ASSERT_EQ( 168, calc_crc((const crc_t *) A, 1)) << "crc8";
|
||||
|
@ -75,8 +73,6 @@ TEST(util, cyclicBufferContains) {
|
|||
TEST(util, cyclicBuffer) {
|
||||
cyclic_buffer<int> sb;
|
||||
|
||||
print("*************************************** testCyclicBuffer\r\n");
|
||||
|
||||
{
|
||||
sb.add(10);
|
||||
|
||||
|
@ -102,8 +98,6 @@ TEST(util, cyclicBuffer) {
|
|||
}
|
||||
|
||||
TEST(util, histogram) {
|
||||
print("******************************************* testHistogram\r\n");
|
||||
|
||||
initHistogramsModule();
|
||||
|
||||
ASSERT_EQ(80, histogramGetIndex(239));
|
||||
|
@ -145,7 +139,6 @@ TEST(util, histogram) {
|
|||
}
|
||||
|
||||
static void testMalfunctionCentralRemoveNonExistent() {
|
||||
print("******************************************* testMalfunctionCentralRemoveNonExistent\r\n");
|
||||
clearWarnings();
|
||||
|
||||
// this should not crash
|
||||
|
@ -154,7 +147,6 @@ static void testMalfunctionCentralRemoveNonExistent() {
|
|||
|
||||
static void testMalfunctionCentralSameElementAgain() {
|
||||
clearWarnings();
|
||||
print("******************************************* testMalfunctionCentralSameElementAgain\r\n");
|
||||
error_codes_set_s localCopy;
|
||||
|
||||
addError(OBD_Engine_Coolant_Temperature_Circuit_Malfunction);
|
||||
|
@ -165,7 +157,6 @@ static void testMalfunctionCentralSameElementAgain() {
|
|||
|
||||
static void testMalfunctionCentralRemoveFirstElement() {
|
||||
clearWarnings();
|
||||
print("******************************************* testMalfunctionCentralRemoveFirstElement\r\n");
|
||||
error_codes_set_s localCopy;
|
||||
|
||||
obd_code_e firstElement = OBD_Engine_Coolant_Temperature_Circuit_Malfunction;
|
||||
|
@ -189,7 +180,6 @@ TEST(misc, testMalfunctionCentral) {
|
|||
testMalfunctionCentralSameElementAgain();
|
||||
testMalfunctionCentralRemoveFirstElement();
|
||||
|
||||
print("******************************************* testMalfunctionCentral\r\n");
|
||||
clearWarnings();
|
||||
|
||||
error_codes_set_s localCopy;
|
||||
|
@ -256,8 +246,6 @@ static loc_t GPSdata;
|
|||
static char nmeaMessage[1000];
|
||||
|
||||
TEST(misc, testGpsParser) {
|
||||
print("******************************************* testGpsParser\r\n");
|
||||
|
||||
strcpy(nmeaMessage, "");
|
||||
gps_location(&GPSdata, nmeaMessage);
|
||||
|
||||
|
@ -310,7 +298,6 @@ TEST(misc, testGpsParser) {
|
|||
static char buffer[300];
|
||||
|
||||
TEST(misc, testConsoleLogic) {
|
||||
print("******************************************* testConsoleLogic\r\n");
|
||||
resetConsoleActions();
|
||||
|
||||
helpCommand();
|
||||
|
@ -338,32 +325,32 @@ TEST(misc, testConsoleLogic) {
|
|||
strcpy(buffer, "sdasdafasd asd");
|
||||
handleConsoleLine(buffer);
|
||||
|
||||
print("\r\naddConsoleActionI\r\n");
|
||||
printf("\r\naddConsoleActionI\r\n");
|
||||
addConsoleActionI("echoi", testEchoI);
|
||||
strcpy(buffer, "echoi 239");
|
||||
handleConsoleLine(buffer);
|
||||
ASSERT_EQ(239, lastInteger);
|
||||
|
||||
print("\r\naddConsoleActionI 240 with two spaces\r\n");
|
||||
printf("\r\naddConsoleActionI 240 with two spaces\r\n");
|
||||
strcpy(buffer, "echoi 240");
|
||||
handleConsoleLine(buffer);
|
||||
ASSERT_EQ(240, lastInteger);
|
||||
|
||||
|
||||
print("\r\naddConsoleActionII\r\n");
|
||||
printf("\r\naddConsoleActionII\r\n");
|
||||
addConsoleActionII("echoii", testEchoII);
|
||||
strcpy(buffer, "echoii 22 239");
|
||||
handleConsoleLine(buffer);
|
||||
ASSERT_EQ(22, lastInteger);
|
||||
ASSERT_EQ(239, lastInteger2);
|
||||
|
||||
print("\r\naddConsoleActionII three spaces\r\n");
|
||||
printf("\r\naddConsoleActionII three spaces\r\n");
|
||||
strcpy(buffer, "echoii 21 220");
|
||||
handleConsoleLine(buffer);
|
||||
ASSERT_EQ(21, lastInteger);
|
||||
ASSERT_EQ(220, lastInteger2);
|
||||
|
||||
print("\r\addConsoleActionSSS\r\n");
|
||||
printf("\r\addConsoleActionSSS\r\n");
|
||||
addConsoleActionSSS("echosss", testEchoSSS);
|
||||
strcpy(buffer, "echosss 111 222 333");
|
||||
handleConsoleLine(buffer);
|
||||
|
@ -378,8 +365,6 @@ TEST(misc, testConsoleLogic) {
|
|||
}
|
||||
|
||||
TEST(misc, testFLStack) {
|
||||
print("******************************************* testFLStack\r\n");
|
||||
|
||||
FLStack<int, 4> stack;
|
||||
ASSERT_EQ(0, stack.size());
|
||||
|
||||
|
@ -410,7 +395,6 @@ TEST(misc, testFLStack) {
|
|||
static char buff[32];
|
||||
|
||||
TEST(misc, testMisc) {
|
||||
print("******************************************* testMisc\r\n");
|
||||
strcpy(buff, " ab ");
|
||||
// we need a mutable array here
|
||||
ASSERT_TRUE(strEqual("ab", efiTrim(buff)));
|
||||
|
@ -434,8 +418,6 @@ TEST(misc, testMisc) {
|
|||
}
|
||||
|
||||
TEST(misc, testMenuTree) {
|
||||
print("******************************************* testMenuTree\r\n");
|
||||
|
||||
MenuItem ROOT(NULL, NULL);
|
||||
|
||||
MenuTree tree(&ROOT);
|
||||
|
|
Loading…
Reference in New Issue