Улучшения

- улушчено отображение на OLED
- убраны настройки шага частоты и количества повторов
- сделан перебор только реализуемых частот
- увеличена точность, на 1МГц 1.25%, в остальных до 1%
- точное измерение TOTAL TIME
This commit is contained in:
2026-08-08 10:18:50 +03:00
parent a8099bf2b8
commit 21f8fe8e13
12 changed files with 293 additions and 151 deletions

View File

@@ -57,14 +57,16 @@ constexpr uint32_t RMT_TARGET_CHUNK_US = 5000;
constexpr uint8_t RMT_QUEUE_BLOCKS = 8;
constexpr uint16_t PERIOD_BATCH_SIZE = 128;
constexpr uint8_t MEASUREMENT_PROGRESS_STEPS = 10;
constexpr uint32_t OLED_PROGRESS_UPDATE_MS = 15;
// Conservative sustained validation rate calibrated from real C3 logs.
constexpr uint32_t RX_PROCESSING_PERIODS_PER_SECOND = 300000;
constexpr uint32_t C3_STRICT_MAX_HZ = 1000000;
constexpr uint32_t S3_STRICT_MAX_HZ = 1000000;
// RMT stores each HIGH/LOW duration in 15 bits. At 80 MHz that limits a
// single level to about 409 us, so even a 1 kHz signal with 50% duty cannot
// be captured. 20 MHz still provides 20 ticks at 1 MHz (5% resolution),
// while allowing level durations up to about 1.64 ms for the 1 kHz/90% case.
constexpr uint32_t CAPTURE_RESOLUTION_HZ = 20000000;
// RMT stores each HIGH/LOW duration in 15 bits. Select the fastest clock that
// still fits both levels of the current PWM signal: 20, 40 or 80 MHz.
constexpr uint32_t CAPTURE_RESOLUTION_OPTIONS_HZ[] = {20000000, 40000000, 80000000};
constexpr uint32_t RMT_MAX_LEVEL_TICKS = 32766;
// Arduino-ESP32 uses the 40 MHz crystal as the default LEDC clock on C3/S3.
// Keep this explicit so the resolution calculation never asks LEDC for an
// impossible frequency/resolution combination.
@@ -73,12 +75,21 @@ constexpr uint8_t LEDC_CHANNEL = 0;
constexpr uint8_t LEDC_MAX_BITS = 14;
// -------------------------- Menu value arrays -----------------------------
constexpr uint32_t START_FREQ_OPTIONS_HZ[] = {1000, 2000, 5000, 10000, 20000, 50000};
constexpr uint32_t END_FREQ_OPTIONS_HZ[] = {100000, 200000, 500000, 750000, 1000000};
constexpr uint32_t STEP_OPTIONS_HZ[] = {1000, 2000, 5000, 10000, 20000, 50000, 100000};
// START and END deliberately have separate, independently cycling menu lists.
// Every value is exactly achievable from the 40 MHz XTAL with an integer LEDC
// divider. The test itself walks TEST_FREQUENCIES_HZ between the selected
// endpoints, so there is no separately configurable step.
constexpr uint32_t START_FREQ_OPTIONS_HZ[] = {1000, 10000, 100000};
constexpr uint32_t END_FREQ_OPTIONS_HZ[] = {100000, 500000, 1000000};
// All achievable whole-number frequencies in the supported 1 kHz..1 MHz
// range, used for adjacent test stages rather than direct menu selection.
constexpr uint32_t TEST_FREQUENCIES_HZ[] = {
1000, 2000, 5000, 10000, 25000, 50000,
100000, 200000, 312500, 400000, 500000, 625000, 800000, 1000000
};
constexpr float ACCURACY_OPTIONS_PCT[] = {1.0f, 2.0f, 5.0f, 10.0f};
constexpr uint32_t TEST_TIME_OPTIONS_MS[] = {100, 250, 500, 1000, 2000, 5000};
constexpr uint8_t REPEAT_OPTIONS[] = {1, 2, 3, 5, 10};
constexpr uint8_t DUTY_OPTIONS_PCT[] = {10, 25, 50, 75, 90};
template <typename T, size_t N> constexpr size_t countOf(const T (&)[N]) { return N; }