baseline CONFIGULATOR

This commit is contained in:
Morgan 'ARR\!' Allen 2024-12-05 19:49:54 -08:00
parent d00d06efb2
commit f81cb38f5a
4 changed files with 24 additions and 1 deletions

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "components/idf-dfplayermini"]
path = components/idf-dfplayermini
url = https://git.oit.cloud/morgan/idf-dfplayermini.git
[submodule "components/configulator"]
path = components/configulator
url = https://git.oit.cloud/morgan/configulator

@ -0,0 +1 @@
Subproject commit c9c691ab7e7d2f6945c49a7327652df401905361

View file

@ -6,6 +6,6 @@ set(COMPONENT_SRCS "\
user_button.c\
")
set(COMPONENT_ADD_INCLUDEDIRS ". ../include")
set(REQUIRES idf-dfplayermini)
set(REQUIRES configulator)
register_component()

View file

@ -10,6 +10,7 @@
#include "nvs_flash.h"
#include "esp_vfs_dev.h"
#include "configulator.h"
#include "main.h"
#include "console.h"
#include "ble.h"
@ -44,6 +45,24 @@ void app_main(void) {
char *name = malloc(strlen(TAG) + 4);
sprintf(name, "%s-%02X", TAG, mac[5]);
uint8_t tank_levels[] = { 100, 100, 100, 100 };
cfglr_handle_t cfglr_handle = {
.namespace = "configulator",
.backend = CFGLR_BACKEND_NVS(),
.elements = {
CFGLR_ELEMENT_U8("armed", 1, CFGLR_SIGNALER_IDF_EVENT()),
CFGLR_ELEMENT_U8("monitor", 0, CFGLR_SIGNALER_IDF_EVENT()),
CFGLR_ELEMENT_U8("pour_button", 21, CFGLR_SIGNALER_IDF_EVENT()),
CFGLR_ELEMENT_STR("device_name", 32, name, CFGLR_SIGNALER_IDF_EVENT()),
CFGLR_ELEMENT_BIN("tank_levels", 4, tank_levels, 4, CFGLR_SIGNALER_IDF_EVENT()),
CFGLR_ELEMENT_BIN("pump_pins", 4, pump_gpio_map, 4, CFGLR_SIGNALER_IDF_EVENT()),
{ NULL },
},
};
uint8_t ret = cfglr_init(&cfglr_handle);
vTaskDelay(1000 / portTICK_PERIOD_MS);
user_button_init();