CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y

#enable BT
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y

#disable BT connection reattempt
CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n

#enable lwip ipv6 autoconfig
CONFIG_LWIP_IPV6_AUTOCONFIG=y

# Use a custom partition table
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_OFFSET=0xC000

# Enable chip shell
CONFIG_ENABLE_CHIP_SHELL=y

CONFIG_ENABLE_WIFI_AP=n

# Enable sntp time sync
CONFIG_ENABLE_SNTP_TIME_SYNC=y

#enable lwIP route hooks
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y

# Button
CONFIG_BUTTON_PERIOD_TIME_MS=20
CONFIG_BUTTON_LONG_PRESS_TIME_MS=5000

# disable softap by default
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n

# Enable OTA Requestor
CONFIG_ENABLE_OTA_REQUESTOR=y

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1)
# unique local addresses for fabrics(MAX_FABRIC), a link local address(1)
CONFIG_LWIP_IPV6_NUM_ADDRESSES=6

# Exclude unused clusters to optimize flash and memory usage
CONFIG_SUPPORT_ACCOUNT_LOGIN_CLUSTER=n
CONFIG_SUPPORT_ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER=n
CONFIG_SUPPORT_AIR_QUALITY_CLUSTER=n
CONFIG_SUPPORT_APPLICATION_BASIC_CLUSTER=n
CONFIG_SUPPORT_APPLICATION_LAUNCHER_CLUSTER=n
CONFIG_SUPPORT_AUDIO_OUTPUT_CLUSTER=n
CONFIG_SUPPORT_BOOLEAN_STATE_CONFIGURATION_CLUSTER=n
CONFIG_SUPPORT_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER=n
CONFIG_SUPPORT_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_CHANNEL_CLUSTER=n
CONFIG_SUPPORT_CHIME_CLUSTER=n
CONFIG_SUPPORT_COMMISSIONER_CONTROL_CLUSTER=n
CONFIG_SUPPORT_CONTENT_LAUNCHER_CLUSTER=n
CONFIG_SUPPORT_CONTENT_CONTROL_CLUSTER=n
CONFIG_SUPPORT_CONTENT_APP_OBSERVER_CLUSTER=n
CONFIG_SUPPORT_DEVICE_ENERGY_MANAGEMENT_CLUSTER=n
CONFIG_SUPPORT_DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER=n
CONFIG_SUPPORT_DIAGNOSTIC_LOGS_CLUSTER=n
CONFIG_SUPPORT_DISHWASHER_ALARM_CLUSTER=n
CONFIG_SUPPORT_DISHWASHER_MODE_CLUSTER=n
CONFIG_SUPPORT_MICROWAVE_OVEN_MODE_CLUSTER=n
CONFIG_SUPPORT_DOOR_LOCK_CLUSTER=n
CONFIG_SUPPORT_ECOSYSTEM_INFORMATION_CLUSTER=n
CONFIG_SUPPORT_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_ELECTRICAL_POWER_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_ENERGY_EVSE_CLUSTER=n
CONFIG_SUPPORT_ENERGY_EVSE_MODE_CLUSTER=n
CONFIG_SUPPORT_ENERGY_PREFERENCE_CLUSTER=n
CONFIG_SUPPORT_FAN_CONTROL_CLUSTER=n
CONFIG_SUPPORT_FAULT_INJECTION_CLUSTER=n
CONFIG_SUPPORT_FIXED_LABEL_CLUSTER=n
CONFIG_SUPPORT_FORMALDEHYDE_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_HEPA_FILTER_MONITORING_CLUSTER=n
CONFIG_SUPPORT_ICD_MANAGEMENT_CLUSTER=n
CONFIG_SUPPORT_KEYPAD_INPUT_CLUSTER=n
CONFIG_SUPPORT_LAUNDRY_WASHER_MODE_CLUSTER=n
CONFIG_SUPPORT_LOCALIZATION_CONFIGURATION_CLUSTER=n
CONFIG_SUPPORT_LOW_POWER_CLUSTER=n
CONFIG_SUPPORT_MEDIA_INPUT_CLUSTER=n
CONFIG_SUPPORT_MEDIA_PLAYBACK_CLUSTER=n
CONFIG_SUPPORT_MICROWAVE_OVEN_CONTROL_CLUSTER=n
CONFIG_SUPPORT_MESSAGES_CLUSTER=n
CONFIG_SUPPORT_MODE_SELECT_CLUSTER=n
CONFIG_SUPPORT_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_SAMPLE_MEI_CLUSTER=n
CONFIG_SUPPORT_OCCUPANCY_SENSING_CLUSTER=n
CONFIG_SUPPORT_POWER_TOPOLOGY_CLUSTER=n
CONFIG_SUPPORT_OPERATIONAL_STATE_CLUSTER=n
CONFIG_SUPPORT_OPERATIONAL_STATE_OVEN_CLUSTER=n
CONFIG_SUPPORT_OPERATIONAL_STATE_RVC_CLUSTER=n
CONFIG_SUPPORT_OVEN_MODE_CLUSTER=n
CONFIG_SUPPORT_OZONE_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_PM10_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_PM1_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_PM2_5_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_POWER_SOURCE_CLUSTER=n
CONFIG_SUPPORT_POWER_SOURCE_CONFIGURATION_CLUSTER=n
CONFIG_SUPPORT_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER=n
CONFIG_SUPPORT_RADON_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_REFRIGERATOR_ALARM_CLUSTER=n
CONFIG_SUPPORT_REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_CLUSTER=n
CONFIG_SUPPORT_RVC_CLEAN_MODE_CLUSTER=n
CONFIG_SUPPORT_RVC_RUN_MODE_CLUSTER=n
CONFIG_SUPPORT_SERVICE_AREA_CLUSTER=n
CONFIG_SUPPORT_SMOKE_CO_ALARM_CLUSTER=n
CONFIG_SUPPORT_SOFTWARE_DIAGNOSTICS_CLUSTER=n
CONFIG_SUPPORT_SWITCH_CLUSTER=n
CONFIG_SUPPORT_TARGET_NAVIGATOR_CLUSTER=n
CONFIG_SUPPORT_TEMPERATURE_CONTROL_CLUSTER=n
CONFIG_SUPPORT_THERMOSTAT_CLUSTER=n
CONFIG_SUPPORT_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER=n
CONFIG_SUPPORT_THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER=n
CONFIG_SUPPORT_THREAD_NETWORK_DIRECTORY_CLUSTER=n
CONFIG_SUPPORT_TIME_FORMAT_LOCALIZATION_CLUSTER=n
CONFIG_SUPPORT_TIME_SYNCHRONIZATION_CLUSTER=y
CONFIG_SUPPORT_TIMER_CLUSTER=n
CONFIG_SUPPORT_TVOC_CONCENTRATION_MEASUREMENT_CLUSTER=n
CONFIG_SUPPORT_UNIT_TESTING_CLUSTER=n
CONFIG_SUPPORT_USER_LABEL_CLUSTER=n
CONFIG_SUPPORT_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER=n
CONFIG_SUPPORT_WAKE_ON_LAN_CLUSTER=n
CONFIG_SUPPORT_LAUNDRY_WASHER_CONTROLS_CLUSTER=n
CONFIG_SUPPORT_LAUNDRY_DRYER_CONTROLS_CLUSTER=n
CONFIG_SUPPORT_WIFI_NETWORK_MANAGEMENT_CLUSTER=n
CONFIG_SUPPORT_WINDOW_COVERING_CLUSTER=n
CONFIG_SUPPORT_WATER_HEATER_MANAGEMENT_CLUSTER=n
CONFIG_SUPPORT_WATER_HEATER_MODE_CLUSTER=n
CONFIG_SUPPORT_CLOSURE_DIMENSION_CLUSTER=n
CONFIG_SUPPORT_CLOSURE_CONTROL_CLUSTER=n
CONFIG_SUPPORT_COMMODITY_TARIFF_CLUSTER=n



#Singnling Specific config

# Signalling only defaults to C6
CONFIG_IDF_TARGET="esp32c6"
CONFIG_IDF_TARGET_ESP32C6=y

#
# Serial flasher config
#
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y

#
# Partition Table
#
#CONFIG_PARTITION_TABLE_CUSTOM=y
#CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="webrtc_example.csv"
#CONFIG_PARTITION_TABLE_FILENAME="webrtc_example.csv"
#CONFIG_PARTITION_TABLE_OFFSET=0x8000

#
# Example Configuration
#
CONFIG_ESP_WIFI_SSID="myssid"
CONFIG_ESP_WIFI_PASSWORD="mypassword"
CONFIG_ESP_MAXIMUM_RETRY=5
CONFIG_EXAMPLE_SDMMC_BUS_WIDTH_1=y
CONFIG_EXAMPLE_PIN_CMD=35
CONFIG_EXAMPLE_PIN_CLK=36
CONFIG_EXAMPLE_PIN_D0=37

#
# ESP32-Specific
#
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240

#
# SPI RAM config
#
CONFIG_SPIRAM=y
CONFIG_SPIRAM_SUPPORT=y
CONFIG_ESP32_SPIRAM_SUPPORT=y
CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST=y

CONFIG_SPIRAM_USE_MALLOC=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_BANKSWITCH_ENABLE=y
CONFIG_SPIRAM_BANKSWITCH_RESERVE=8
CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_SPEED_80M=y

# 1. The SPIRAM test is only needed for custom SPIRAM
# 2. Needed only in development phase
# Disabling this save us around 1 seconds at startup
CONFIG_SPIRAM_MEMTEST=n

CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y
CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0
CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=16

CONFIG_FATFS_LFN_HEAP=y
CONFIG_FATFS_MAX_LFN=255
CONFIG_FATFS_API_ENCODING_ANSI_OEM=y
CONFIG_FATFS_FS_LOCK=10

CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y

CONFIG_LOG_DEFAULT_LEVEL=3

#
# SNTP
#
CONFIG_LWIP_SNTP_MAX_SERVERS=3

#CONFIG_LWIP_SO_LINGER=y
#CONFIG_LWIP_SO_RCVBUF=y
#CONFIG_LWIP_NETBUF_RECVINFO=y
#CONFIG_LWIP_IP_FRAG=y
#CONFIG_LWIP_STATS=y

#CONFIG_LWIP_MULTICAST_PING=y
#CONFIG_LWIP_BROADCAST_PING=y

CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1

CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y

CONFIG_MBEDTLS_DEBUG=y
CONFIG_MBEDTLS_DEBUG_LEVEL_WARN=y
CONFIG_MBEDTLS_DEBUG_LEVEL=1

#CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1
#CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128

CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
CONFIG_MBEDTLS_SSL_ALPN=y

#
# ESP Ringbuf
#
#CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
#CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y

#
# FreeRTOS
#
CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y

#
# ESP System Settings
#
CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y

#
# PThreads
#
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=4096
CONFIG_PTHREAD_STACK_MIN=4096


CONFIG_MAIN_TASK_STACK_SIZE=12000
CONFIG_IPC_TASK_STACK_SIZE=1024
CONFIG_TIMER_TASK_STACK_SIZE=3584

CONFIG_MB_SERIAL_TASK_STACK_SIZE=2048
CONFIG_SUPPORT_STATIC_ALLOCATION=y

#
# Wi-Fi
#
# CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=16
CONFIG_ESP32_WIFI_IRAM_OPT=n
CONFIG_ESP32_WIFI_RX_IRAM_OPT=n

CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4000
CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y

#
# TCP
#
CONFIG_ENABLE_TCP_TRANSPORT=y
CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES=5120