chore: snapshot before shared RS485 bus integration

This commit is contained in:
2026-07-22 15:36:04 +01:00
parent ef02e5c5f5
commit 2a803fcef1
167 changed files with 5749 additions and 1128 deletions

0
components/config/CMakeLists.txt Executable file → Normal file
View File

25
components/config/board_config.c Executable file → Normal file
View File

@@ -1,4 +1,5 @@
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include "esp_system.h"
#include "esp_log.h"
@@ -12,7 +13,27 @@ board_config_t board_config;
bool atob(const char *value)
{
return value[0] == 'y';
return value[0] == 'y' || value[0] == 'Y' || value[0] == '1';
}
static board_config_pilot_adc_source_t pilot_adc_source_from_string(const char *value)
{
if (value == NULL)
{
return BOARD_CONFIG_PILOT_ADC_EXTERNAL_ADC121;
}
if (!strcasecmp(value, "internal") ||
!strcasecmp(value, "esp32") ||
!strcasecmp(value, "adc_internal") ||
!strcasecmp(value, "internal_esp32") ||
!strcasecmp(value, "1") ||
atob(value))
{
return BOARD_CONFIG_PILOT_ADC_INTERNAL_ESP32;
}
return BOARD_CONFIG_PILOT_ADC_EXTERNAL_ADC121;
}
#define SET_CONFIG_VALUE(name, prop, convert_fn) \
@@ -78,6 +99,8 @@ void board_config_load()
SET_CONFIG_VALUE("BUZZER_GPIO", buzzer_gpio, atoi);
SET_CONFIG_VALUE("BUTTON_WIFI_GPIO", button_wifi_gpio, atoi);
SET_CONFIG_VALUE("PILOT_PWM_GPIO", pilot_pwm_gpio, atoi);
SET_CONFIG_VALUE("PILOT_ADC_SOURCE", pilot_adc_source, pilot_adc_source_from_string);
SET_CONFIG_VALUE("PILOT_ADC_INTERNAL", pilot_adc_source, pilot_adc_source_from_string);
SET_CONFIG_VALUE("PILOT_ADC_CHANNEL", pilot_adc_channel, atoi);
SET_CONFIG_VALUE("PILOT_DOWN_THRESHOLD_12", pilot_down_threshold_12, atoi);
SET_CONFIG_VALUE("PILOT_DOWN_THRESHOLD_9", pilot_down_threshold_9, atoi);

10
components/config/include/board_config.h Executable file → Normal file
View File

@@ -1,6 +1,9 @@
#ifndef BOARD_CONFIG_H_
#define BOARD_CONFIG_H_
#include <stdbool.h>
#include <stdint.h>
#include "hal/adc_types.h"
#include "hal/gpio_types.h"
#include "soc/soc_caps.h"
@@ -19,6 +22,12 @@ typedef enum
BOARD_CONFIG_SERIAL_RS485
} board_config_serial_t;
typedef enum
{
BOARD_CONFIG_PILOT_ADC_EXTERNAL_ADC121 = 0,
BOARD_CONFIG_PILOT_ADC_INTERNAL_ESP32 = 1
} board_config_pilot_adc_source_t;
typedef struct
{
char device_name[32];
@@ -36,6 +45,7 @@ typedef struct
gpio_num_t button_wifi_gpio;
gpio_num_t pilot_pwm_gpio;
board_config_pilot_adc_source_t pilot_adc_source;
adc_channel_t pilot_adc_channel;
uint16_t pilot_down_threshold_12;
uint16_t pilot_down_threshold_9;