From cfe2ca690b84e8c4c30e88955817b43e2a3be476 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Tue, 13 Dec 2022 15:55:36 -0800 Subject: [PATCH] Trigger scope uses full buffer (#4893) * trigger scope uses full buffer * channels swapped on 4chan * UI has custom names for boards --- firmware/config/boards/hellen/alphax-4chan/prepend.txt | 3 +++ .../boards/hellen/alphax-4chan/trigger_scope_config.h | 8 ++++---- firmware/console/binary/trigger_scope.cpp | 3 +-- firmware/integration/rusefi_config.txt | 4 ++++ firmware/tunerstudio/rusefi.input | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/firmware/config/boards/hellen/alphax-4chan/prepend.txt b/firmware/config/boards/hellen/alphax-4chan/prepend.txt index ed5f69d739..2b5a8fca2f 100644 --- a/firmware/config/boards/hellen/alphax-4chan/prepend.txt +++ b/firmware/config/boards/hellen/alphax-4chan/prepend.txt @@ -24,3 +24,6 @@ #define show_microRusEFI_presets false #define show_Proteus_presets false #define show_Hellen_presets true + +#define TS_TRIGGER_SCOPE_CHANNEL_1_NAME "C2/C3 Crank VR" +#define TS_TRIGGER_SCOPE_CHANNEL_2_NAME "E5/E6 Cam VR" diff --git a/firmware/config/boards/hellen/alphax-4chan/trigger_scope_config.h b/firmware/config/boards/hellen/alphax-4chan/trigger_scope_config.h index db0891c79e..a5f868b7f2 100644 --- a/firmware/config/boards/hellen/alphax-4chan/trigger_scope_config.h +++ b/firmware/config/boards/hellen/alphax-4chan/trigger_scope_config.h @@ -3,10 +3,10 @@ #define TRIGGER_SCOPE_SAMPLE_TIME ADC_SAMPLE_144 // RES3 -#define TRIGGER_SCOPE_PIN_CH1 Gpio::F8 -#define TRIGGER_SCOPE_ADC_CH1 ADC_CHANNEL_IN6 +#define TRIGGER_SCOPE_PIN_CH1 Gpio::F10 +#define TRIGGER_SCOPE_ADC_CH1 ADC_CHANNEL_IN8 // RES2 #define TRIGGER_SCOPE_HAS_CH2 true -#define TRIGGER_SCOPE_PIN_CH2 Gpio::F10 -#define TRIGGER_SCOPE_ADC_CH2 ADC_CHANNEL_IN8 +#define TRIGGER_SCOPE_PIN_CH2 Gpio::F8 +#define TRIGGER_SCOPE_ADC_CH2 ADC_CHANNEL_IN6 diff --git a/firmware/console/binary/trigger_scope.cpp b/firmware/console/binary/trigger_scope.cpp index 636c5bc77f..594652d7c9 100644 --- a/firmware/console/binary/trigger_scope.cpp +++ b/firmware/console/binary/trigger_scope.cpp @@ -51,8 +51,7 @@ static const ADCConversionGroup adcConvGroupCh1 = { FALSE, 2, &completionCallbac ADC_SQR3_SQ1_N(TRIGGER_SCOPE_ADC_CH1) | ADC_SQR3_SQ2_N(TRIGGER_SCOPE_ADC_CH2) }; -static constexpr size_t sampleCount = 1000; -static_assert(2 * sizeof(uint8_t) * sampleCount < BIG_BUFFER_SIZE); +static constexpr size_t sampleCount = BIG_BUFFER_SIZE / (2 * sizeof(uint8_t)); static void startSampling(void* = nullptr) { chibios_rt::CriticalSectionLocker csl; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 6e9f796856..3541b2f460 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -2112,6 +2112,10 @@ end_struct #define TS_TRIGGER_SCOPE_DISABLE 5 #define TS_TRIGGER_SCOPE_READ 6 +! Generic channel names, your board may want to override these +#define TS_TRIGGER_SCOPE_CHANNEL_1_NAME "Channel 1" +#define TS_TRIGGER_SCOPE_CHANNEL_2_NAME "Channel 2" + #define PROTOCOL_COIL1_SHORT_NAME "c1" #define PROTOCOL_INJ1_SHORT_NAME "i1" diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 51caf0512a..6d072983eb 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -142,8 +142,8 @@ enable2ndByteCanID = false continuousRead = true recordDef = 0, 0, 2 - recordField = channel1, "Channel 1", 0, 8, {6.6 / 255}, "v" - recordField = channel2, "Channel 2", 8, 8, {6.6 / 255}, "v" + recordField = channel1, @@TS_TRIGGER_SCOPE_CHANNEL_1_NAME@@, 0, 8, {6.6 / 255}, "v" + recordField = channel2, @@TS_TRIGGER_SCOPE_CHANNEL_2_NAME@@, 8, 8, {6.6 / 255}, "v" [VeAnalyze]