diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 9a357dc65b..257d3431ba 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -607,7 +607,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->runningFuel = ENGINE(engineState.runningFuel); tsOutputChannels->injectorLagMs = ENGINE(injectorLagMs); - tsOutputChannels->debugIntField1 = engine->tpsAccelEnrichment.cb.getSize(); + if (engineConfiguration->debugMode == TPS_ACCEL) { + tsOutputChannels->debugIntField1 = engine->tpsAccelEnrichment.cb.getSize(); + } tsOutputChannels->wallFuelAmount = wallFuel.getWallFuel(0); tsOutputChannels->wallFuelCorrection = engine->wallFuelCorrection; diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index e840279b73..7ede74ebaa 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -480,8 +480,8 @@ case Force_4b_ego_sensor: } const char *getBrain_pin_e(brain_pin_e value){ switch(value) { -case Force_4b_cranking_brain_pin: - return "Force_4b_cranking_brain_pin"; +case Force_4b_brain_pin_e: + return "Force_4b_brain_pin_e"; case GPIOA_0: return "GPIOA_0"; case GPIOA_1: diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 7945a80aa9..22e7b261eb 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -580,6 +580,8 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) { engineConfiguration->isWaveAnalyzerEnabled = true; engineConfiguration->isIdleThreadEnabled = true; + engineConfiguration->debugMode = ALTERNATOR; + engineConfiguration->acIdleRpmBump = 200; engineConfiguration->knockDetectionWindowStart = 35; engineConfiguration->knockDetectionWindowEnd = 135; diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index fadde84ca4..151c23008f 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -1,4 +1,4 @@ -// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 29 20:39:58 EST 2016 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Feb 04 22:34:53 EST 2016 // begin #ifndef ENGINE_CONFIGURATION_GENERATED_H_ #define ENGINE_CONFIGURATION_GENERATED_H_ @@ -579,6 +579,9 @@ typedef struct { /** offset 384 bit 12 */ bool useLcdScreen : 1; + /** + offset 384 bit 13 */ + bool startConsoleInBinaryMode : 1; /** * offset 388 */ @@ -1467,7 +1470,16 @@ typedef struct { /** * offset 2244 */ - int unused[193]; + debug_mode_e debugMode; + /** + * offset 2246 + */ + int unused[192]; + /** + * need 4 byte alignment + * offset 3014 + */ + uint8_t alignmentFill[2]; /** total size 3016*/ } engine_configuration_s; @@ -1617,4 +1629,4 @@ typedef struct { #endif // end -// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 29 20:39:58 EST 2016 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Feb 04 22:34:53 EST 2016 diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index df7c429f4b..5abab3b526 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -568,9 +568,18 @@ typedef enum { GPIO_UNASSIGNED = 80, GPIO_INVALID = 81, - Force_4b_cranking_brain_pin = ENUM_32_BITS, + Force_4b_brain_pin_e = ENUM_32_BITS, } brain_pin_e; +typedef enum { + ALTERNATOR = 0, + TPS_ACCEL = 1, + mode2 = 2, + mode3 = 3, + + Force_4b_debug_mode_e = ENUM_32_BITS, +} debug_mode_e; + typedef enum { MT_CUSTOM = 0, MT_DENSO183 = 1, /** diff --git a/firmware/controllers/algo/rusefi_generated.h b/firmware/controllers/algo/rusefi_generated.h index 015eb498d3..0a6709c29d 100644 --- a/firmware/controllers/algo/rusefi_generated.h +++ b/firmware/controllers/algo/rusefi_generated.h @@ -359,6 +359,7 @@ #define enabledStep1Limiter_offset 1008 #define useTpicAdvancedMode_offset 1008 #define useLcdScreen_offset 1008 +#define startConsoleInBinaryMode_offset 1008 #define logicAnalyzerPins1_offset 1012 #define logicAnalyzerPins2_offset 1016 #define logicAnalyzerPins3_offset 1020 @@ -731,7 +732,9 @@ #define tpsDecelEnleanmentThreshold_offset 2232 #define tpsDecelEnleanmentMultiplier_offset 2236 #define slowAdcAlpha_offset 2240 -#define unused_offset 2244 +#define debugMode_offset 2244 +#define unused_offset 2246 +#define alignmentFill_offset 3014 #define le_formulas1_offset 3016 #define le_formulas2_offset 3216 #define le_formulas3_offset 3416 diff --git a/firmware/controllers/alternatorController.cpp b/firmware/controllers/alternatorController.cpp index 479c919e16..dc11aeb4a6 100644 --- a/firmware/controllers/alternatorController.cpp +++ b/firmware/controllers/alternatorController.cpp @@ -70,9 +70,15 @@ static msg_t AltCtrlThread(int param) { } #if ! EFI_UNIT_TEST || defined(__DOXYGEN__) - tsOutputChannels.debugFloatField1 = currentAltDuty; - tsOutputChannels.debugFloatField2 = altPid.getIntegration(); - tsOutputChannels.debugFloatField3 = altPid.getPrevError(); + if (engineConfiguration->debugMode == ALTERNATOR) { + tsOutputChannels.debugFloatField1 = currentAltDuty; + tsOutputChannels.debugFloatField2 = altPid.getIntegration(); + tsOutputChannels.debugFloatField3 = altPid.getPrevError(); + tsOutputChannels.debugFloatField4 = altPid.getI(); + tsOutputChannels.debugFloatField5 = altPid.getD(); + tsOutputChannels.debugIntField1 = altPid.getP(); + tsOutputChannels.debugIntField2 = engineConfiguration->alternatorOffset; + } #endif alternatorControl.setSimplePwmDutyCycle(currentAltDuty / 100); diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 437721e7c7..60f8473036 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -80,6 +80,10 @@ float baseFuel;;"ms", 1, 0, 0, 200, 1 int16_t rpm;This value controls what RPM values we consider 'cranking' (any RPM below 'crankingRpm')\nAnything above 'crankingRpm' would be 'running';"RPM", 1, 0, 0, 3000, 0 end_struct +#define debug_mode_e_enum "ALTERNATOR", "TPS_ACCEL", "mode2", "mode3" +custom debug_mode_e 2 bits, U32, @OFFSET@, [0:1], @@debug_mode_e_enum@@ + + #define brain_input_pin_e_enum "INVALID", "INVALID", "PA2", "PA3", "INVALID", "PA5", "INVALID", "INVALID", "PA8", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PC6", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PE5", "INVALID", "PE7", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" custom brain_input_pin_e 4 bits, U32, @OFFSET@, [0:6], @@brain_input_pin_e_enum@@ @@ -416,6 +420,7 @@ bit is_enabled_spi_2 bit enabledStep1Limiter; bit useTpicAdvancedMode; bit useLcdScreen; + bit startConsoleInBinaryMode; brain_input_pin_e[LOGIC_ANALYZER_CHANNEL_COUNT iterate] logicAnalyzerPins; uint8_t[LOGIC_ANALYZER_CHANNEL_COUNT] logicAnalyzerMode;default or inverted input @@ -612,11 +617,11 @@ baro_corr_table_t baroCorrTable; float alternatorOffset;Linear addition to PID logic;"%", 1, 0, 0, 100, 2 pid_s alternatorControl; - int tpsAccelLength;;"len", 1, 0, 1, 200, 3 + int tpsAccelLength;;"cycles", 1, 0, 1, 200, 0 float tpsAccelEnrichmentThreshold;;"roc", 1, 0, 0, 200, 3 float tpsAccelEnrichmentMultiplier;;"coeff", 1, 0, 0, 200, 3 - int engineLoadAccelLength;;"len", 1, 0, 1, 200, 3 + int engineLoadAccelLength;;"cycles", 1, 0, 1, 200, 0 float engineLoadDecelEnleanmentThreshold;;"roc", 1, 0, 0, 200, 3 float engineLoadDecelEnleanmentMultiplier;;"coeff", 1, 0, 0, 200, 3 @@ -631,7 +636,8 @@ baro_corr_table_t baroCorrTable; float tpsDecelEnleanmentThreshold;;"roc", 1, 0, 0, 200, 3 float tpsDecelEnleanmentMultiplier;;"coeff", 1, 0, 0, 200, 3 float slowAdcAlpha;;"coeff", 1, 0, 0, 200, 3 - int[193] unused; + debug_mode_e debugMode; + int[192] unused; end_struct diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index e82a43d895..1f6ff33f82 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -41,7 +41,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jan 31 12:30:25 EST 2016 +; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Feb 04 22:34:53 EST 2016 pageSize = 16088 page = 1 @@ -259,6 +259,7 @@ page = 1 enabledStep1Limiter = bits, U32, 1008, [10:10], "false", "true" useTpicAdvancedMode = bits, U32, 1008, [11:11], "false", "true" useLcdScreen = bits, U32, 1008, [12:12], "false", "true" + startConsoleInBinaryMode= bits, U32, 1008, [13:13], "false", "true" logicAnalyzerPins1 = bits, U32, 1012, [0:6], "INVALID", "INVALID", "PA2", "PA3", "INVALID", "PA5", "INVALID", "INVALID", "PA8", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PC6", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PE5", "INVALID", "PE7", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" logicAnalyzerPins2 = bits, U32, 1016, [0:6], "INVALID", "INVALID", "PA2", "PA3", "INVALID", "PA5", "INVALID", "INVALID", "PA8", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PC6", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PE5", "INVALID", "PE7", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" logicAnalyzerPins3 = bits, U32, 1020, [0:6], "INVALID", "INVALID", "PA2", "PA3", "INVALID", "PA5", "INVALID", "INVALID", "PA8", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PC6", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PE5", "INVALID", "PE7", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" @@ -519,7 +520,9 @@ page = 1 tpsDecelEnleanmentThreshold = scalar, F32, 2232, "roc", 1, 0, 0, 200, 3 tpsDecelEnleanmentMultiplier = scalar, F32, 2236, "coeff", 1, 0, 0, 200, 3 slowAdcAlpha = scalar, F32, 2240, "coeff", 1, 0, 0, 200, 3 -;skipping unused offset 2244 + debugMode = bits, U32, 2244, [0:1], "ALTERNATOR", "TPS_ACCEL", "mode2", "mode3" +;skipping unused offset 2246 +;skipping alignmentFill offset 3014 le_formulas1 = array, U08, 3016, [200],"char", 1, 0, 0.0, 3.0, 2 le_formulas2 = array, U08, 3216, [200],"char", 1, 0, 0.0, 3.0, 2 le_formulas3 = array, U08, 3416, [200],"char", 1, 0, 0.0, 3.0, 2