CLI encapsulation preparing for libfirmware move
This commit is contained in:
parent
c4eb8fc9f8
commit
b21455e178
|
@ -208,6 +208,10 @@ void onCliDuplicateError(const char *token) {
|
|||
firmwareError(ObdCode::CUSTOM_SAME_TWICE, "Same action twice [%s]", token);
|
||||
}
|
||||
|
||||
void onCliOverflowError() {
|
||||
firmwareError(ObdCode::CUSTOM_CONSOLE_TOO_MANY, "Too many console actions");
|
||||
}
|
||||
|
||||
void initializeConsole() {
|
||||
initConsoleLogic();
|
||||
|
||||
|
|
|
@ -14,9 +14,10 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include <cstring>
|
||||
#include <cstdint>
|
||||
#include <rusefi/isnan.h>
|
||||
#include <rusefi/math.h>
|
||||
#include "efiprintf.h"
|
||||
#include "efistringutil.h"
|
||||
#include "cli_registry.h"
|
||||
|
@ -58,7 +59,11 @@ static void doAddAction(const char *token, action_type_e type, Void callback, vo
|
|||
}
|
||||
}
|
||||
|
||||
efiAssertVoid(ObdCode::CUSTOM_CONSOLE_TOO_MANY, consoleActionCount < CONSOLE_MAX_ACTIONS, "Too many console actions");
|
||||
if (consoleActionCount >= CONSOLE_MAX_ACTIONS) {
|
||||
onCliOverflowError();
|
||||
return;
|
||||
}
|
||||
|
||||
TokenCallback *current = &consoleActions[consoleActionCount++];
|
||||
current->token = token;
|
||||
current->parameterType = type;
|
||||
|
|
|
@ -105,6 +105,7 @@ void addConsoleActionSSSSS(const char *token, VoidCharPtrCharPtrCharPtrCharPtrCh
|
|||
|
||||
void onCliCaseError(const char *token);
|
||||
void onCliDuplicateError(const char *token);
|
||||
void onCliOverflowError();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -34,3 +34,5 @@ void onCliCaseError(const char *token) {
|
|||
void onCliDuplicateError(const char *token) {
|
||||
}
|
||||
|
||||
void onCliOverflowError() {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue