Коррекция уровня оптики, вкл по умолчанию, выкл в сне

плюс коррекции по отображению
This commit is contained in:
2026-08-12 08:25:56 +03:00
parent f56595f767
commit 862781fa6a
10 changed files with 124 additions and 26 deletions

View File

@@ -58,7 +58,8 @@ bool PulseReceiver::configureRmt(uint32_t resolutionHz) {
rmt_rx_channel_config_t cfg = {};
cfg.clk_src = RMT_CLK_SRC_DEFAULT; cfg.resolution_hz = resolutionHz;
cfg.gpio_num = static_cast<gpio_num_t>(GPIO_RX);
cfg.flags.invert_in = RX_SIGNAL_INVERTED;
// Internally the measurement code always treats HIGH as the active phase.
cfg.flags.invert_in = RX_ACTIVE_LEVEL == LOW;
#if CONFIG_IDF_TARGET_ESP32S3
cfg.mem_block_symbols = 512;
cfg.flags.with_dma = true;
@@ -205,7 +206,7 @@ size_t PulseReceiver::readPeriods(PulsePeriod *periods, size_t capacity, TickTyp
void IRAM_ATTR PulseReceiver::onGpio(void *ctx) {
PulseReceiver *self = static_cast<PulseReceiver *>(ctx);
bool level = gpio_get_level(static_cast<gpio_num_t>(GPIO_RX));
if (RX_SIGNAL_INVERTED) level = !level;
if (RX_ACTIVE_LEVEL == LOW) level = !level;
Edge e = {esp_cpu_get_cycle_count(), static_cast<uint8_t>(level)};
BaseType_t wake = pdFALSE;
if (xQueueSendFromISR(self->queue_, &e, &wake) != pdTRUE)