unit tests progress

This commit is contained in:
rusefi 2019-09-18 21:48:46 -04:00
parent c4339e17d8
commit f48f60bb36
3 changed files with 9 additions and 6 deletions

View File

@ -609,8 +609,7 @@ static void setFsioSetting(float humanIndexF, float value) {
#endif #endif
} }
void setFsioExpression(const char *indexStr, const char *quotedLine) { void setFsioExpression(const char *indexStr, const char *quotedLine DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_PROD_CODE || EFI_SIMULATOR
int index = atoi(indexStr) - 1; int index = atoi(indexStr) - 1;
if (index < 0 || index >= FSIO_COMMAND_COUNT) { if (index < 0 || index >= FSIO_COMMAND_COUNT) {
scheduleMsg(logger, "invalid FSIO index: %d", index); scheduleMsg(logger, "invalid FSIO index: %d", index);
@ -627,7 +626,6 @@ void setFsioExpression(const char *indexStr, const char *quotedLine) {
// this would apply the changes // this would apply the changes
applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
showFsioInfo(); showFsioInfo();
#endif
} }
static void rpnEval(char *line) { static void rpnEval(char *line) {

View File

@ -35,7 +35,7 @@ void setFsioExt(int index, brain_pin_e pin, const char * exp, int pwmFrequency D
void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX); void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE); void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void setFsioExpression(const char *indexStr, const char *quotedLine); void setFsioExpression(const char *indexStr, const char *quotedLine DECLARE_ENGINE_PARAMETER_SUFFIX);
float getFsioOutputValue(int index DECLARE_ENGINE_PARAMETER_SUFFIX); float getFsioOutputValue(int index DECLARE_ENGINE_PARAMETER_SUFFIX);
void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE); void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX); void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -11,15 +11,20 @@
#include "pid.h" #include "pid.h"
#include "fsio_impl.h" #include "fsio_impl.h"
#define Q(x) #x
#define QUOTE(x) Q(x)
TEST(idle, fsioPidParameters) { TEST(idle, fsioPidParameters) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE); WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
// todo finish this unit test! // todo finish this unit test!
engineConfiguration->useFSIO12ForIdleOffset = true; engineConfiguration->useFSIO12ForIdleOffset = true;
setFsioExpression(MAGIC_OFFSET_FOR_IDLE_OFFSET, "\"ac_on_switch cfg_idleRpmPid_offset cfg_idleRpmPid2_offset if"); setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_OFFSET), "\"ac_on_switch cfg_idleRpmPid_offset cfg_idleRpmPid2_offset if" PASS_ENGINE_PARAMETER_SUFFIX);
engineConfiguration->useFSIO13ForIdleMinValue = true; engineConfiguration->useFSIO13ForIdleMinValue = true;
setFsioExpression(MAGIC_OFFSET_FOR_IDLE_MIN_VALUE, "\"ac_on_switch cfg_idleRpmPid_minValue cfg_idleRpmPid2_minValue if"); setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_MIN_VALUE), "\"ac_on_switch cfg_idleRpmPid_minValue cfg_idleRpmPid2_minValue if" PASS_ENGINE_PARAMETER_SUFFIX);
eth.engine.periodicSlowCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
TEST(idle, pid) { TEST(idle, pid) {