ChaosDMX
Open-Source DMX-Interface
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include "esp_err.h"
13#include "esp_wifi.h"
14#include <stdbool.h>
15#include <stdint.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
24#define APP_CONFIG_DMX_PORT_COUNT 2
25
29#define APP_CONFIG_INVALID_UNIVERSE 0xFFFF
30
42
52
60
70
78
83#define APP_CONFIG_DEFAULT_CONNECTION \
84 APP_CONFIG_CONN_WIFI_AP
85#define APP_CONFIG_DEFAULT_IP_METHOD \
86 APP_CONFIG_IP_DHCP
87#define APP_CONFIG_DEFAULT_LED_BRIGHTNESS \
88 128
89
90#define APP_CONFIG_DEFAULT_STA_SSID ""
91#define APP_CONFIG_DEFAULT_STA_PASSWORD \
92 ""
93
94
95#define APP_CONFIG_DEFAULT_AP_PASSWORD \
96 "ChaosDMX"
97#define APP_CONFIG_DEFAULT_AP_SSID_PREFIX \
98 "ChaosDMX"
99
100#define APP_CONFIG_DEFAULT_DMX_DIR \
101 APP_CONFIG_DIR_OUTPUT
102#define APP_CONFIG_DEFAULT_START_UNIVERSE \
103 1
104
105#define APP_CONFIG_DEFAULT_SINGLE_CLICK_ACT \
106 APP_BUTTON_ACTION_TOGGLE_LED
107#define APP_CONFIG_DEFAULT_DOUBLE_CLICK_ACT \
108 APP_BUTTON_ACTION_NONE
109#define APP_CONFIG_DEFAULT_MULTI_CLICK_ACT \
110 APP_BUTTON_ACTION_REBOOT
111
112
113/* --- Lifecycle Functions --- */
114
128esp_err_t config_init(void);
129
138esp_err_t config_reset_defaults(void);
139
150esp_err_t config_save(void);
151
152/* --- System Settings Get/Set --- */
153
159
166
172
179
184uint8_t config_get_led_brightness(void);
185
192bool config_set_led_brightness(uint8_t brightness);
193
200
209
210/* --- DMX Port Settings Get/Set --- */
211
218uint16_t config_get_dmx_universe(uint8_t port_index);
219
226bool config_set_dmx_universe(uint8_t port_index, uint16_t universe);
227
234
241bool config_set_dmx_direction(uint8_t port_index, config_direction_t direction);
242
247void config_get_wifi_sta_config(wifi_config_t *dest);
248
254bool config_set_wifi_sta_config(const wifi_config_t *src);
255
260void config_get_wifi_ap_config(wifi_config_t *dest);
261
267bool config_set_wifi_ap_config(const wifi_config_t *src);
268
269
270#ifdef __cplusplus
271}
272#endif
bool config_set_led_brightness(uint8_t brightness)
Sets the status LED brightness level in RAM.
Definition config.c:299
config_button_action_t
Actions that can be dynamically assigned to button events.
Definition config.h:46
@ APP_BUTTON_ACTION_MAX
Definition config.h:50
@ APP_BUTTON_ACTION_REBOOT
Definition config.h:49
@ APP_BUTTON_ACTION_NONE
Definition config.h:47
@ APP_BUTTON_ACTION_TOGGLE_LED
Definition config.h:48
esp_err_t config_reset_defaults(void)
Resets all configuration settings back to factory defaults.
Definition config.c:194
config_ip_method_t config_get_ip_method(void)
Gets the current IP allocation method.
Definition config.c:267
bool config_set_ip_method(config_ip_method_t method)
Sets the IP assignment method in RAM.
Definition config.c:276
uint8_t config_get_led_brightness(void)
Gets the current status LED brightness level.
Definition config.c:290
bool config_set_wifi_ap_config(const wifi_config_t *src)
Sets the Wi-Fi Access Point mode configuration in RAM.
Definition config.c:415
config_connection_t config_get_connection(void)
Gets the current network connection type.
Definition config.c:243
config_direction_t config_get_dmx_direction(uint8_t port_index)
Gets the data direction for a specific port.
Definition config.c:342
bool config_set_dmx_universe(uint8_t port_index, uint16_t universe)
Sets the DMX universe for a specific port in RAM.
Definition config.c:327
uint16_t config_get_dmx_universe(uint8_t port_index)
Gets the configured DMX universe for a specific port.
Definition config.c:318
void config_get_wifi_sta_config(wifi_config_t *dest)
Gets the Wi-Fi Station mode configuration.
Definition config.c:367
config_connection_t
Network connection medium types.
Definition config.h:64
@ APP_CONFIG_CONN_WIFI_STA
Definition config.h:66
@ APP_CONFIG_CONN_ETHERNET
Definition config.h:68
@ APP_CONFIG_CONN_WIFI_AP
Definition config.h:65
app_button_event_t
Supported button event types that can be configured in the system.
Definition config.h:34
@ APP_BUTTON_EVENT_MAX
Definition config.h:40
@ APP_BUTTON_EVENT_LONG_HOLD
Definition config.h:38
@ APP_BUTTON_EVENT_SINGLE_CLICK
Definition config.h:35
@ APP_BUTTON_EVENT_MULTIPLE_CLICK
Definition config.h:37
@ APP_BUTTON_EVENT_DOUBLE_CLICK
Definition config.h:36
bool config_set_dmx_direction(uint8_t port_index, config_direction_t direction)
Sets the data direction for a specific port in RAM.
Definition config.c:351
config_direction_t
Data direction for dmx-port.
Definition config.h:74
@ APP_CONFIG_DIR_INPUT
Definition config.h:76
@ APP_CONFIG_DIR_OUTPUT
Definition config.h:75
config_button_action_t config_get_button_action(app_button_event_t event)
Retrieves the action assigned to a specific button event.
Definition config.c:447
void config_get_wifi_ap_config(wifi_config_t *dest)
Gets the Wi-Fi Access Point mode configuration.
Definition config.c:404
config_ip_method_t
IP assignment method configurations.
Definition config.h:56
@ APP_CONFIG_IP_DHCP
Definition config.h:58
@ APP_CONFIG_IP_STATIC
Definition config.h:57
esp_err_t config_init(void)
Initializes the configuration component.
Definition config.c:136
bool config_set_connection(config_connection_t conn)
Sets the network connection type in RAM.
Definition config.c:252
bool config_set_wifi_sta_config(const wifi_config_t *src)
Sets the Wi-Fi Station mode configuration in RAM.
Definition config.c:379
esp_err_t config_save(void)
Flushes all staged RAM changes permanently to the non-volatile storage.
Definition config.c:204
bool config_set_button_action(app_button_event_t event, config_button_action_t action)
Assigns a new action to a specific button event in RAM.
Definition config.c:477