Compare commits
No commits in common. "development" and "v0.0.0.0.0.1" have entirely different histories.
developmen
...
v0.0.0.0.0
8 changed files with 26 additions and 44 deletions
12
.gitmodules
vendored
12
.gitmodules
vendored
|
@ -1,9 +1,3 @@
|
|||
[submodule "components/configulator"]
|
||||
path = components/configulator
|
||||
url = https://git.oit.cloud/morgan/configulator
|
||||
[submodule "esp-idf"]
|
||||
path = esp-idf
|
||||
url = https://github.com/espressif/esp-idf
|
||||
[submodule "components/BAROS32"]
|
||||
path = components/BAROS32
|
||||
url = https://git.oit.cloud/Barback/BAROS32.git
|
||||
[submodule "components/idf-dfplayermini"]
|
||||
path = components/idf-dfplayermini
|
||||
url = https://git.oit.cloud/morgan/idf-dfplayermini.git
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
labels:
|
||||
hardware: esp32
|
||||
|
||||
steps:
|
||||
build:
|
||||
image: espressif/idf:v5.2.2
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 54c7a2d2d65dc9159dad27d6388d8a5409b59dd0
|
|
@ -1 +0,0 @@
|
|||
Subproject commit af52863f024eeed3c4730e2a7b945a18e9bfb9fb
|
1
esp-idf
1
esp-idf
|
@ -1 +0,0 @@
|
|||
Subproject commit 3b8741b172dc951e18509698dee938304bcf1523
|
|
@ -6,6 +6,6 @@ set(COMPONENT_SRCS "\
|
|||
user_button.c\
|
||||
")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ". ../include")
|
||||
set(REQUIRES configulato BAROS32)
|
||||
set(REQUIRES idf-dfplayermini)
|
||||
|
||||
register_component()
|
||||
|
|
31
main/ble.c
31
main/ble.c
|
@ -16,7 +16,6 @@
|
|||
#include "driver/gpio.h"
|
||||
|
||||
#include "barback.h"
|
||||
#include "baros.h"
|
||||
#include "main.h"
|
||||
#include "ble.h"
|
||||
#include "pumps.h"
|
||||
|
@ -47,13 +46,21 @@ static int svc_access_system(uint16_t conn_handle, uint16_t attr_handle, struct
|
|||
|
||||
static int barback_ble_char_access(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg);
|
||||
|
||||
#define BLE_SERVICE_PUMP_ENABLED (0x4200)
|
||||
#define BLE_SERVICE_PUMP_STATE (0x4300)
|
||||
#define BLE_SERVICE_PUMP_DURATION (0x4350)
|
||||
|
||||
#define BLE_SERVICE_BARBACK (0x4400)
|
||||
#define CHAR_POUR (BLE_SERVICE_BARBACK + 1) // 0x4401
|
||||
#define CHAR_BUTTON (BLE_SERVICE_BARBACK + 2) // 0x4402
|
||||
|
||||
static barback_ble_access_t barback_ble_pump_access_enabled = {
|
||||
.read = pumps_get_enabled,
|
||||
.write = pumps_set_enabled
|
||||
};
|
||||
|
||||
#define BLE_CHAR_PUMP_ENABLED(idx) {\
|
||||
.uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_ENABLED + idx),\
|
||||
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_ENABLED + idx),\
|
||||
.access_cb = barback_ble_char_access,\
|
||||
.arg = &barback_ble_pump_access_enabled,\
|
||||
.val_handle = &ble_svc_handle,\
|
||||
|
@ -65,7 +72,7 @@ static barback_ble_access_t barback_ble_pump_access_state = {
|
|||
};
|
||||
|
||||
#define BLE_CHAR_PUMP_STATE(idx) {\
|
||||
.uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_STATE + idx),\
|
||||
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_STATE + idx),\
|
||||
.access_cb = barback_ble_char_access,\
|
||||
.arg = &barback_ble_pump_access_state,\
|
||||
.val_handle = &ble_svc_handle,\
|
||||
|
@ -78,7 +85,7 @@ static barback_ble_access_t barback_ble_pump_access_duration = {
|
|||
};
|
||||
|
||||
#define BLE_CHAR_PUMP_DURATION(idx) {\
|
||||
.uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_DURATION + idx),\
|
||||
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_DURATION + idx),\
|
||||
.access_cb = barback_ble_char_access,\
|
||||
.arg = &barback_ble_pump_access_duration,\
|
||||
.val_handle = &pump_duration_svc_val_handles[idx - 1],\
|
||||
|
@ -88,7 +95,7 @@ static barback_ble_access_t barback_ble_pump_access_duration = {
|
|||
static const struct ble_gatt_svc_def service_defs[] = {
|
||||
{
|
||||
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
||||
.uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_ENABLED),
|
||||
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_ENABLED),
|
||||
|
||||
.characteristics = (struct ble_gatt_chr_def[]) {
|
||||
BLE_CHAR_PUMP_ENABLED(1),
|
||||
|
@ -99,7 +106,7 @@ static const struct ble_gatt_svc_def service_defs[] = {
|
|||
},
|
||||
}, {
|
||||
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
||||
.uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_STATE),
|
||||
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_STATE),
|
||||
.characteristics = (struct ble_gatt_chr_def[]) {
|
||||
BLE_CHAR_PUMP_STATE(1),
|
||||
BLE_CHAR_PUMP_STATE(2),
|
||||
|
@ -109,7 +116,7 @@ static const struct ble_gatt_svc_def service_defs[] = {
|
|||
},
|
||||
}, {
|
||||
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
||||
.uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_DURATION),
|
||||
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_DURATION),
|
||||
.characteristics = (struct ble_gatt_chr_def[]) {
|
||||
BLE_CHAR_PUMP_DURATION(1),
|
||||
BLE_CHAR_PUMP_DURATION(2),
|
||||
|
@ -119,15 +126,15 @@ static const struct ble_gatt_svc_def service_defs[] = {
|
|||
},
|
||||
}, {
|
||||
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
||||
.uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_BARBACK),
|
||||
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_BARBACK),
|
||||
.characteristics = (struct ble_gatt_chr_def[]) {
|
||||
{
|
||||
.uuid = BLE_UUID16_DECLARE(BAROS_CHAR_POUR),
|
||||
.uuid = BLE_UUID16_DECLARE(CHAR_POUR),
|
||||
.access_cb = svc_access_system,
|
||||
.val_handle = &ble_svc_handle,
|
||||
.flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ
|
||||
}, {
|
||||
.uuid = BLE_UUID16_DECLARE(BAROS_CHAR_BUTTON),
|
||||
.uuid = BLE_UUID16_DECLARE(CHAR_BUTTON),
|
||||
.access_cb = svc_access_system,
|
||||
.val_handle = &svc_handle_button,
|
||||
.flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY
|
||||
|
@ -172,7 +179,7 @@ static int svc_access_system(uint16_t conn_handle, uint16_t attr_handle, struct
|
|||
);
|
||||
|
||||
switch(uuid16) {
|
||||
case BAROS_CHAR_POUR:
|
||||
case CHAR_POUR:
|
||||
if(value == 1) {
|
||||
ESP_LOGI(TAG, "starting pumps");
|
||||
pumps_run();
|
||||
|
@ -182,7 +189,7 @@ static int svc_access_system(uint16_t conn_handle, uint16_t attr_handle, struct
|
|||
}
|
||||
break;
|
||||
|
||||
case BAROS_CHAR_BUTTON:
|
||||
case CHAR_BUTTON:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
19
main/main.c
19
main/main.c
|
@ -10,7 +10,6 @@
|
|||
#include "nvs_flash.h"
|
||||
#include "esp_vfs_dev.h"
|
||||
|
||||
#include "configulator.h"
|
||||
#include "main.h"
|
||||
#include "console.h"
|
||||
#include "ble.h"
|
||||
|
@ -45,24 +44,6 @@ 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();
|
||||
|
|
Loading…
Add table
Reference in a new issue