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

плюс коррекции по отображению
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

@@ -71,8 +71,14 @@ constexpr bool SERIAL_LOG_TIMESTAMPS = true;
constexpr bool SERIAL_MINIMAL_LOG = true;
#define BUTTON_ACTIVE_LEVEL LOW
#define RX_SIGNAL_INVERTED false
// Raw GPIO_RX level that means the optical receiver is active.
#define RX_ACTIVE_LEVEL LOW
// PWM_SAFE_LEVEL must switch the optical transmitter fully off and is used
// during tests whenever PWM is stopped, and while the controller sleeps.
// PWM_ACTIVE_LEVEL intentionally keeps the transmitter active while the
// controller is awake and no test is in progress.
#define PWM_SAFE_LEVEL HIGH
#define PWM_ACTIVE_LEVEL LOW
#define PWM_SETTLE_CYCLES 5U
constexpr uint32_t BUTTON_DEBOUNCE_MS = 30;
@@ -85,6 +91,9 @@ constexpr uint32_t LINK_REPLY_TIMEOUT_MS = 1500;
constexpr uint8_t LINK_PACKET_RETRIES = 10;
constexpr uint32_t LINK_RETRY_INTERVAL_MS = 1000;
constexpr uint32_t DISCOVERY_RETRY_INTERVAL_MS = 20;
// During discovery Master alternates PWM_ACTIVE_LEVEL and PWM_SAFE_LEVEL to
// wake a sleeping Slave through the optical channel.
constexpr uint32_t OPTICAL_WAKE_HALF_PERIOD_MS = 50;
constexpr uint32_t LINK_HEARTBEAT_INTERVAL_MS = 500;
constexpr uint32_t LINK_HEARTBEAT_TIMEOUT_MS = 2500;
constexpr uint32_t FINAL_ACK_RETRY_INTERVAL_MS = 50;
@@ -99,7 +108,6 @@ constexpr uint8_t MEASUREMENT_PROGRESS_STEPS = 10;
constexpr uint32_t OLED_PROGRESS_UPDATE_MS = 15;
constexpr uint32_t IDLE_POWER_SAVE_TIMEOUT_MS = 60000;
constexpr uint32_t IDLE_LIGHT_SLEEP_SLICE_US = 10000;
constexpr uint16_t SLAVE_LISTEN_INTERVAL_MS = 100;
constexpr uint16_t SLAVE_LISTEN_WINDOW_MS = 20;
static_assert(SLAVE_LISTEN_WINDOW_MS < SLAVE_LISTEN_INTERVAL_MS,