9 #ifndef APP_CONFIG_HPP__
10 #define APP_CONFIG_HPP__
12 #include "freertos/FreeRTOS.h"
13 #include "driver/mcpwm.h"
14 #include "driver/gpio.h"
15 #include "driver/ledc.h"
16 #include "driver/adc.h"
18 #include "IPAddress.h"
19 #include "ArduinoJson.h"
23 static constexpr
auto serial_baudrate = 115200ul;
36 static constexpr
size_t ssid_maxlen = 32 + 1;
37 static constexpr
size_t psk_maxlen = 63 + 1;
38 static constexpr
size_t hostname_maxlen = 32 + 1;
41 static constexpr
const char* get_wifi_config_endpoint =
"/get_wifi_config";
42 static constexpr
const char* set_wifi_config_endpoint =
"/set_wifi_config";
43 static constexpr uint16_t http_tcp_port = 80;
46 static constexpr uint32_t max_reboots = 4;
48 static constexpr uint32_t max_reconnections = 3;
49 static constexpr uint32_t reconnection_timeout_ms = 3000;
50 static constexpr uint32_t dns_ttl = 3000;
53 static constexpr
const char* dns_tld =
".lan";
58 bool ap_mode_active =
true;
60 bool sta_use_dhcp =
true;
63 bool dns_active =
true;
64 bool mdns_active =
false;
66 char hostname[hostname_maxlen] =
"eal";
68 char ssid[ssid_maxlen] =
"esp_ajax_lab";
70 char psk[psk_maxlen] =
"123FOO456";
72 IPAddress ip4_addr = {192, 168, 4, 1};
73 IPAddress ip4_gw = {192, 168, 4, 1};
74 IPAddress ip4_mask = {255, 255, 0, 0};
82 bool serve_static_from_spiffs =
true;
84 const char* spiffs_static_files_folder =
"www";
86 const char* static_route =
"/";
88 const char* app_route =
"/app";
91 const char* index_html_file =
"/index.html";
95 const char* cache_control =
"public, max-age=86400";
99 bool template_processing_activated =
false;
102 const char* api_endpoint =
"/cmd";
106 bool api_is_ajax =
true;
107 const char* ajax_return_text =
"OK";
112 const char* sse_endpoint =
"/events";
115 bool reboot_enabled =
false;
118 bool http_auth_activated =
false;
120 const char* http_user =
"";
121 const char* http_pass =
"";
124 const char* error_404_html =
"Error 404, file not found!";
137 uint32_t app_event_task_stack_size = 4096;
140 UBaseType_t app_event_task_priority = 2;
142 BaseType_t app_event_task_core_id = APP_CPU_NUM;
144 uint32_t timer_fast_interval_ms = 20;
155 mcpwm_unit_t mcpwm_num = MCPWM_UNIT_0;
157 gpio_num_t gpio_pwm0a_out = GPIO_NUM_27;
158 gpio_num_t gpio_pwm0b_out = GPIO_NUM_26;
159 gpio_num_t gpio_pwm1a_out = GPIO_NUM_25;
160 gpio_num_t gpio_pwm1b_out = GPIO_NUM_33;
162 gpio_num_t gpio_fault_shutdown = GPIO_NUM_4;
164 mcpwm_fault_input_level_t fault_pin_active_level = MCPWM_LOW_LEVEL_TGR;
168 mcpwm_action_on_pwmxa_t disable_action_lag_leg = MCPWM_FORCE_MCPWMXA_LOW;
170 mcpwm_action_on_pwmxa_t disable_action_lead_leg = MCPWM_FORCE_MCPWMXA_LOW;
173 float frequency_min = 50e3f;
174 float frequency_max = 300e3f;
176 float init_frequency = 100e3f;
178 float init_ps_duty = 0.45f;
180 float init_lead_dt = 125e-9f;
182 float init_lag_dt = 125e-9f;
184 bool init_power_pwm_active =
false;
196 float temp_1_fan_threshold_hi = 45.0f;
197 float temp_1_fan_threshold_lo = 40.0f;
198 float temp_2_fan_threshold_hi = 45.0f;
199 float temp_2_fan_threshold_lo = 40.0f;
206 gpio_num_t gpio_fan = GPIO_NUM_2;
207 gpio_num_t gpio_overcurrent_reset = GPIO_NUM_16;
208 gpio_num_t gpio_relay_ref = GPIO_NUM_18;
209 gpio_num_t gpio_relay_dut = GPIO_NUM_19;
210 gpio_num_t gpio_delta_sigma_out = GPIO_NUM_21;
211 gpio_num_t gpio_drv_supply_en = GPIO_NUM_23;
212 gpio_num_t gpio_drv_disable = GPIO_NUM_32;
214 gpio_num_t gpio_curr_limit_reference_pwm = GPIO_NUM_17;
216 gpio_num_t gpio_delta_sigma_in = GPIO_NUM_22;
218 gpio_config_t aux_periph_gpio_output_config {
219 .pin_bit_mask = ((1ULL<<gpio_fan)
220 |(1ULL<<gpio_overcurrent_reset)
221 |(1ULL<<gpio_relay_ref)
222 |(1ULL<<gpio_relay_dut)
223 |(1ULL<<gpio_delta_sigma_out)
224 |(1ULL<<gpio_drv_supply_en)
225 |(1ULL<<gpio_drv_disable)
227 .mode = GPIO_MODE_OUTPUT,
228 .pull_up_en = GPIO_PULLUP_DISABLE,
229 .pull_down_en = GPIO_PULLDOWN_DISABLE,
230 .intr_type = GPIO_INTR_DISABLE
232 gpio_config_t aux_periph_gpio_input_config {
233 .pin_bit_mask = ((1ULL<<gpio_delta_sigma_in)
235 .mode = GPIO_MODE_INPUT,
236 .pull_up_en = GPIO_PULLUP_DISABLE,
237 .pull_down_en = GPIO_PULLDOWN_ENABLE,
238 .intr_type = GPIO_INTR_DISABLE
243 ledc_timer_config_t pwm_timer_config {
244 .speed_mode = LEDC_HIGH_SPEED_MODE,
245 .duty_resolution = LEDC_TIMER_12_BIT,
246 .timer_num = LEDC_TIMER_0,
248 .clk_cfg = LEDC_USE_APB_CLK
250 ledc_channel_config_t curr_lim_pwm_ch_config {
251 .gpio_num = gpio_curr_limit_reference_pwm,
252 .speed_mode = LEDC_HIGH_SPEED_MODE,
253 .channel = LEDC_CHANNEL_0,
254 .intr_type = LEDC_INTR_DISABLE,
255 .timer_sel = LEDC_TIMER_0,
260 ledc_channel_config_t delta_sigma_out_pwm_ch_config {
261 .gpio_num = gpio_delta_sigma_out,
262 .speed_mode = LEDC_HIGH_SPEED_MODE,
263 .channel = LEDC_CHANNEL_0,
264 .intr_type = LEDC_INTR_DISABLE,
265 .timer_sel = LEDC_TIMER_0,
271 uint32_t oc_reset_pulse_length_ms = 20;
273 float curr_limit_pwm_scale = 1.0f/100.0f * (float)(
274 1 << pwm_timer_config.duty_resolution);
275 uint32_t curr_limit_pwm_offset = 0;
Definition: app_config.hpp:79
Constant / compile-time config values go here!
Definition: app_config.hpp:131
uint32_t timer_slow_interval_ms
In addition to event-based async state update telegrams, we also send cyclic updates to the HTTP clie...
Definition: app_config.hpp:148
const char * settings_filename
Filename for persistent storage of runtime settings.
Definition: app_config.hpp:151
Hardware configuration for AuxHwDrv.
Definition: app_config.hpp:191
adc1_channel_t temp_ch_2
ADC channel for second temperature sensor.
Definition: app_config.hpp:204
adc1_channel_t temp_ch_1
ADC channel for first temperature sensor.
Definition: app_config.hpp:202
WiFi network configuration structure with default values.
Definition: app_config.hpp:34
Definition: app_config.hpp:22