Сделана настройка мощности передающей оптики

This commit is contained in:
2026-08-23 18:32:47 +03:00
parent 3907cbcf77
commit 8699f8e4eb
7 changed files with 224 additions and 12 deletions

View File

@@ -5,13 +5,15 @@
// ------------------------- Hardware configuration -------------------------
// Enabled for the hand-wired prototype. Comment out for the production PCB.
// Both profiles map S3 signals by physical header position with 5V/GND aligned.
//#define MAKETKA
#define MAKETKA
// Select exactly one populated receiver circuit. Use
// BOARD_RX_INTERFACE_DIGITAL for MAKETKA and boards fitted with GPIO_RX.
#define BOARD_RX_INTERFACE_ADC 1
#define BOARD_RX_INTERFACE_DIGITAL 2
#define BOARD_RX_INTERFACE BOARD_RX_INTERFACE_ADC
#ifndef BOARD_RX_INTERFACE
#define BOARD_RX_INTERFACE BOARD_RX_INTERFACE_DIGITAL
#endif
#if BOARD_RX_INTERFACE != BOARD_RX_INTERFACE_ADC && \
BOARD_RX_INTERFACE != BOARD_RX_INTERFACE_DIGITAL
@@ -38,12 +40,16 @@ constexpr uint8_t GPIO_RX = 4;
constexpr bool BOARD_ADC_AVAILABLE = false;
constexpr uint8_t GPIO_BUTTON_MODE = 0;
constexpr uint8_t GPIO_BUTTON_START = 1;
constexpr uint8_t GPIO_OPTICAL_CURRENT = 2;
constexpr uint8_t GPIO_OPTICAL_VCC = 5;
constexpr uint8_t GPIO_VBAT = UINT8_MAX;
constexpr uint8_t GPIO_ANALOG_RX = UINT8_MAX;
#else
constexpr bool BOARD_ADC_AVAILABLE = true;
constexpr uint8_t GPIO_BUTTON_MODE = 20;
constexpr uint8_t GPIO_BUTTON_START = 10;
constexpr uint8_t GPIO_OPTICAL_CURRENT = 1;
constexpr uint8_t GPIO_OPTICAL_VCC = 5;
constexpr uint8_t GPIO_VBAT = 2;
constexpr uint8_t GPIO_ANALOG_RX = 0;
#endif
@@ -58,6 +64,8 @@ constexpr uint8_t GPIO_PWM = 12;
constexpr uint8_t GPIO_RX = 13;
constexpr uint8_t GPIO_BUTTON_MODE = 9;
constexpr uint8_t GPIO_BUTTON_START = 10;
constexpr uint8_t GPIO_OPTICAL_CURRENT = 2;
constexpr uint8_t GPIO_OPTICAL_VCC = 6;
constexpr uint8_t GPIO_SDA = 44;
constexpr uint8_t GPIO_SCL = 1;
constexpr uint8_t GPIO_VBAT = UINT8_MAX;
@@ -70,6 +78,8 @@ constexpr uint8_t GPIO_PWM = 12;
constexpr uint8_t GPIO_RX = 13;
constexpr uint8_t GPIO_BUTTON_MODE = 5;
constexpr uint8_t GPIO_BUTTON_START = 4;
constexpr uint8_t GPIO_OPTICAL_CURRENT = 10;
constexpr uint8_t GPIO_OPTICAL_VCC = 6;
constexpr uint8_t GPIO_SDA = 44;
constexpr uint8_t GPIO_SCL = 1;
constexpr uint8_t GPIO_VBAT = 11;
@@ -79,6 +89,22 @@ constexpr uint8_t GPIO_ANALOG_RX = 9;
#error "Only ESP32-C3 and ESP32-S3 are supported"
#endif
static_assert(GPIO_OPTICAL_CURRENT != GPIO_PWM &&
GPIO_OPTICAL_CURRENT != GPIO_RX &&
GPIO_OPTICAL_CURRENT != GPIO_BUTTON_MODE &&
GPIO_OPTICAL_CURRENT != GPIO_BUTTON_START &&
GPIO_OPTICAL_CURRENT != GPIO_SDA &&
GPIO_OPTICAL_CURRENT != GPIO_SCL,
"Optical-current ADC GPIO conflicts with another board signal");
static_assert(GPIO_OPTICAL_VCC != GPIO_OPTICAL_CURRENT &&
GPIO_OPTICAL_VCC != GPIO_PWM &&
GPIO_OPTICAL_VCC != GPIO_RX &&
GPIO_OPTICAL_VCC != GPIO_BUTTON_MODE &&
GPIO_OPTICAL_VCC != GPIO_BUTTON_START &&
GPIO_OPTICAL_VCC != GPIO_SDA &&
GPIO_OPTICAL_VCC != GPIO_SCL,
"Optical-VCC ADC GPIO conflicts with another board signal");
constexpr uint8_t OLED_ROTATION = 0;
constexpr uint8_t OLED_ADDRESS = 0x3C;
@@ -89,6 +115,11 @@ constexpr uint32_t SERIAL_BAUD = 115200;
constexpr uint32_t SERIAL_TX_TIMEOUT_MS = 2;
constexpr uint32_t BOARD_ADC_PRINT_INTERVAL_MS = 100;
constexpr uint32_t BOARD_TEST_DISPLAY_INTERVAL_MS = 250;
constexpr float OPTICAL_VCC = 5.1f;
constexpr float OPTICAL_SENSE_R = 47.0f;
constexpr float OPTICAL_DIVIDER_RATIO = 2.0f;
constexpr uint32_t OPTICAL_CURRENT_SETTLE_MS = 20;
constexpr uint32_t OPTICAL_CURRENT_AVERAGING_MS = 200;
constexpr bool SERIAL_ACTION_LOG = true;
constexpr bool SERIAL_LOG_TIMESTAMPS = true;
constexpr bool SERIAL_MINIMAL_LOG = true;