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

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);