Compare commits

..

20 commits

Author SHA1 Message Date
Morgan 'ARR\!' Allen
30ae25fa04 migrating to BAROS32 based BLE definitions
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
2024-11-15 15:39:49 -08:00
Morgan 'ARR\!' Allen
aba57662ee include BAROS32 2024-11-15 15:36:50 -08:00
Morgan 'ARR\!' Allen
96dafc4941 tie esp-idf directly to project via submodule
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-11-13 15:30:59 -08:00
Morgan 'ARR\!' Allen
d00d06efb2 Merge branch 'config' into development
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
ci/woodpecker/release/woodpecker Pipeline was successful
2024-11-13 09:59:53 -08:00
Morgan 'ARR\!' Allen
9c580af534 release file is barback, not barhead
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-11-13 08:37:48 -08:00
Morgan 'ARR\!' Allen
39d4ea0b2b include esp_mac 2024-11-12 22:44:11 -08:00
Morgan 'ARR\!' Allen
cb5fd10fa9 various updates mostly related to upgrading IDF 2024-11-12 22:43:56 -08:00
Morgan 'ARR\!' Allen
7f8dec89da remove dfplayer until its actually ready 2024-11-12 22:39:09 -08:00
Morgan 'ARR\!' Allen
3d3e595dfc fix nvs_handle declaration 2024-11-12 22:38:31 -08:00
Morgan 'ARR\!' Allen
5ba2058b7c update ci to use idf and attempt release
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
2024-11-12 20:52:07 -08:00
Morgan 'ARR\!' Allen
8911bcecb2 convert ci to steps
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
2024-11-12 20:22:15 -08:00
Morgan 'ARR\!' Allen
e7695847dc limit CI to systems that have esp32 available 2024-11-12 19:50:34 -08:00
Morgan 'ARR\!' Allen
a49b0fc54e more woodpecker debug
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
2024-05-13 09:35:51 -07:00
Morgan 'ARR\!' Allen
5e309d9114 woodpecker debug
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
2024-05-13 09:34:29 -07:00
Morgan 'ARR\!' Allen
133dcffe7c using local build agent
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
2024-05-10 14:56:53 -07:00
Morgan 'ARR\!' Allen
674594d32e adding woodpecker CI
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/manual/woodpecker Pipeline was successful
2022-04-14 23:15:34 -07:00
Morgan 'ARR\!' Allen
548d4eeaa0 use https instead of git for submodule
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-19 20:18:57 -07:00
Morgan 'ARR\!' Allen
fdd9166e8e hrmph
Some checks failed
continuous-integration/drone/push Build is failing
2021-10-14 23:18:07 -07:00
Morgan 'ARR\!' Allen
c82f162115 weres teh trust
Some checks failed
continuous-integration/drone/push Build is failing
2021-10-14 23:17:26 -07:00
Morgan 'ARR\!' Allen
5c5033898d update submodules before testing
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing
2021-10-14 23:10:30 -07:00
13 changed files with 73 additions and 41 deletions

View file

@ -6,6 +6,9 @@ steps:
- name: build - name: build
image: espressif/idf:release-v4.1 image: espressif/idf:release-v4.1
commands: commands:
- mkdir ~/.ssh
- ssh-keyscan -t rsa git.oit.cloud >> ~/.ssh/known_hosts
- git submodule update --init
- if [ -f sdkconfig ]; then - if [ -f sdkconfig ]; then
- rm sdkconfig - rm sdkconfig
- fi - fi

11
.gitmodules vendored
View file

@ -1,6 +1,9 @@
[submodule "components/esp32-lora"]
path = components/esp32-lora
url = https://gitlab.com/morganrallen/esp32-lora.git
[submodule "components/idf-dfplayermini"] [submodule "components/idf-dfplayermini"]
path = components/idf-dfplayermini path = components/idf-dfplayermini
url = git@git.oit.cloud:morgan/idf-dfplayermini.git url = https://git.oit.cloud/morgan/idf-dfplayermini.git
[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

31
.woodpecker.yml Normal file
View file

@ -0,0 +1,31 @@
labels:
hardware: esp32
steps:
build:
image: espressif/idf:v5.2.2
when:
- event: [ tag, push, manual ]
commands:
- git submodule update --init
- if [ -f sdkconfig ]; then
- rm sdkconfig
- fi
- . /opt/esp/idf/export.sh
- idf.py reconfigure
- idf.py build
release:
image: woodpeckerci/plugin-release
secrets: [ ACCESS_TOKEN ]
when:
- event: tag
settings:
log_level: debug
title: 'Release ${CI_COMMIT_TAG}'
files:
- 'build/barback.bin'
api_key:
from_secret: ACCESS_TOKEN
generate_release_notes: true
overwrite: true
upload-url: https://git.oit.cloud/repos/${CI_REPO}/releases

1
components/BAROS32 Submodule

@ -0,0 +1 @@
Subproject commit 54c7a2d2d65dc9159dad27d6388d8a5409b59dd0

@ -1 +0,0 @@
Subproject commit 7ec406c5af692b9c99ae9ed0c7fb5ba648a0a71e

1
esp-idf Submodule

@ -0,0 +1 @@
Subproject commit 3b8741b172dc951e18509698dee938304bcf1523

View file

@ -8,7 +8,7 @@
#define PUMP_COUNT (4) #define PUMP_COUNT (4)
static QueueHandle_t gpio_evt_queue = NULL; static QueueHandle_t gpio_evt_queue = NULL;
nvs_handle_t config_handle; extern nvs_handle_t config_handle;
extern uint8_t mac[6]; extern uint8_t mac[6];

View file

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

View file

@ -16,6 +16,7 @@
#include "driver/gpio.h" #include "driver/gpio.h"
#include "barback.h" #include "barback.h"
#include "baros.h"
#include "main.h" #include "main.h"
#include "ble.h" #include "ble.h"
#include "pumps.h" #include "pumps.h"
@ -46,21 +47,13 @@ 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); 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)
#define CHAR_BUTTON (BLE_SERVICE_BARBACK + 2)
static barback_ble_access_t barback_ble_pump_access_enabled = { static barback_ble_access_t barback_ble_pump_access_enabled = {
.read = pumps_get_enabled, .read = pumps_get_enabled,
.write = pumps_set_enabled .write = pumps_set_enabled
}; };
#define BLE_CHAR_PUMP_ENABLED(idx) {\ #define BLE_CHAR_PUMP_ENABLED(idx) {\
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_ENABLED + idx),\ .uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_ENABLED + idx),\
.access_cb = barback_ble_char_access,\ .access_cb = barback_ble_char_access,\
.arg = &barback_ble_pump_access_enabled,\ .arg = &barback_ble_pump_access_enabled,\
.val_handle = &ble_svc_handle,\ .val_handle = &ble_svc_handle,\
@ -72,7 +65,7 @@ static barback_ble_access_t barback_ble_pump_access_state = {
}; };
#define BLE_CHAR_PUMP_STATE(idx) {\ #define BLE_CHAR_PUMP_STATE(idx) {\
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_STATE + idx),\ .uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_STATE + idx),\
.access_cb = barback_ble_char_access,\ .access_cb = barback_ble_char_access,\
.arg = &barback_ble_pump_access_state,\ .arg = &barback_ble_pump_access_state,\
.val_handle = &ble_svc_handle,\ .val_handle = &ble_svc_handle,\
@ -85,7 +78,7 @@ static barback_ble_access_t barback_ble_pump_access_duration = {
}; };
#define BLE_CHAR_PUMP_DURATION(idx) {\ #define BLE_CHAR_PUMP_DURATION(idx) {\
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_DURATION + idx),\ .uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_DURATION + idx),\
.access_cb = barback_ble_char_access,\ .access_cb = barback_ble_char_access,\
.arg = &barback_ble_pump_access_duration,\ .arg = &barback_ble_pump_access_duration,\
.val_handle = &pump_duration_svc_val_handles[idx - 1],\ .val_handle = &pump_duration_svc_val_handles[idx - 1],\
@ -95,7 +88,7 @@ static barback_ble_access_t barback_ble_pump_access_duration = {
static const struct ble_gatt_svc_def service_defs[] = { static const struct ble_gatt_svc_def service_defs[] = {
{ {
.type = BLE_GATT_SVC_TYPE_PRIMARY, .type = BLE_GATT_SVC_TYPE_PRIMARY,
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_ENABLED), .uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_ENABLED),
.characteristics = (struct ble_gatt_chr_def[]) { .characteristics = (struct ble_gatt_chr_def[]) {
BLE_CHAR_PUMP_ENABLED(1), BLE_CHAR_PUMP_ENABLED(1),
@ -106,7 +99,7 @@ static const struct ble_gatt_svc_def service_defs[] = {
}, },
}, { }, {
.type = BLE_GATT_SVC_TYPE_PRIMARY, .type = BLE_GATT_SVC_TYPE_PRIMARY,
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_STATE), .uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_STATE),
.characteristics = (struct ble_gatt_chr_def[]) { .characteristics = (struct ble_gatt_chr_def[]) {
BLE_CHAR_PUMP_STATE(1), BLE_CHAR_PUMP_STATE(1),
BLE_CHAR_PUMP_STATE(2), BLE_CHAR_PUMP_STATE(2),
@ -116,7 +109,7 @@ static const struct ble_gatt_svc_def service_defs[] = {
}, },
}, { }, {
.type = BLE_GATT_SVC_TYPE_PRIMARY, .type = BLE_GATT_SVC_TYPE_PRIMARY,
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_PUMP_DURATION), .uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_PUMP_DURATION),
.characteristics = (struct ble_gatt_chr_def[]) { .characteristics = (struct ble_gatt_chr_def[]) {
BLE_CHAR_PUMP_DURATION(1), BLE_CHAR_PUMP_DURATION(1),
BLE_CHAR_PUMP_DURATION(2), BLE_CHAR_PUMP_DURATION(2),
@ -126,15 +119,15 @@ static const struct ble_gatt_svc_def service_defs[] = {
}, },
}, { }, {
.type = BLE_GATT_SVC_TYPE_PRIMARY, .type = BLE_GATT_SVC_TYPE_PRIMARY,
.uuid = BLE_UUID16_DECLARE(BLE_SERVICE_BARBACK), .uuid = BLE_UUID16_DECLARE(BAROS_BLE_SERVICE_BARBACK),
.characteristics = (struct ble_gatt_chr_def[]) { .characteristics = (struct ble_gatt_chr_def[]) {
{ {
.uuid = BLE_UUID16_DECLARE(CHAR_POUR), .uuid = BLE_UUID16_DECLARE(BAROS_CHAR_POUR),
.access_cb = svc_access_system, .access_cb = svc_access_system,
.val_handle = &ble_svc_handle, .val_handle = &ble_svc_handle,
.flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ
}, { }, {
.uuid = BLE_UUID16_DECLARE(CHAR_BUTTON), .uuid = BLE_UUID16_DECLARE(BAROS_CHAR_BUTTON),
.access_cb = svc_access_system, .access_cb = svc_access_system,
.val_handle = &svc_handle_button, .val_handle = &svc_handle_button,
.flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY
@ -179,7 +172,7 @@ static int svc_access_system(uint16_t conn_handle, uint16_t attr_handle, struct
); );
switch(uuid16) { switch(uuid16) {
case CHAR_POUR: case BAROS_CHAR_POUR:
if(value == 1) { if(value == 1) {
ESP_LOGI(TAG, "starting pumps"); ESP_LOGI(TAG, "starting pumps");
pumps_run(); pumps_run();
@ -189,7 +182,7 @@ static int svc_access_system(uint16_t conn_handle, uint16_t attr_handle, struct
} }
break; break;
case CHAR_BUTTON: case BAROS_CHAR_BUTTON:
break; break;
} }
} }
@ -466,7 +459,7 @@ void ble_init(char *name) {
memset(&callback_handlers, 0, sizeof(event_callback_handle_t) * CONFIG_CACO_MAX_SERVICES); memset(&callback_handlers, 0, sizeof(event_callback_handle_t) * CONFIG_CACO_MAX_SERVICES);
ESP_ERROR_CHECK(esp_nimble_hci_and_controller_init()); //ESP_ERROR_CHECK(esp_nimble_hci_and_controller_init());
nimble_port_init(); nimble_port_init();

View file

@ -25,7 +25,6 @@ void console_task(void *args) {
.data_bits = UART_DATA_8_BITS, .data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE, .parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1, .stop_bits = UART_STOP_BITS_1,
.use_ref_tick = true
}; };
ESP_ERROR_CHECK(uart_param_config(CONFIG_ESP_CONSOLE_UART_NUM, &uart_config)); ESP_ERROR_CHECK(uart_param_config(CONFIG_ESP_CONSOLE_UART_NUM, &uart_config));

View file

@ -5,6 +5,7 @@
#include "freertos/queue.h" #include "freertos/queue.h"
#include "driver/uart.h" #include "driver/uart.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_mac.h"
#include "esp_debug_helpers.h" #include "esp_debug_helpers.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "esp_vfs_dev.h" #include "esp_vfs_dev.h"
@ -14,11 +15,11 @@
#include "ble.h" #include "ble.h"
#include "user_button.h" #include "user_button.h"
#include "pumps.h" #include "pumps.h"
#include "dfplayermini.h"
static const char *TAG = "BARBACK"; static const char *TAG = "BARBACK";
uint8_t mac[6]; uint8_t mac[6];
nvs_handle_t config_handle = {};
void app_main(void) { void app_main(void) {
esp_err_t err = nvs_flash_init(); esp_err_t err = nvs_flash_init();
@ -33,7 +34,7 @@ void app_main(void) {
if (err != ESP_OK) { if (err != ESP_OK) {
printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err)); printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err));
} else { } else {
ESP_LOGI(TAG, "config_handle: %d", config_handle); ESP_LOGI(TAG, "config_handle: %d", (int)config_handle);
} }
esp_efuse_mac_get_default((uint8_t*)&mac); esp_efuse_mac_get_default((uint8_t*)&mac);
@ -45,8 +46,6 @@ void app_main(void) {
vTaskDelay(1000 / portTICK_PERIOD_MS); vTaskDelay(1000 / portTICK_PERIOD_MS);
dfplayermini_init();
user_button_init(); user_button_init();
pumps_init(); pumps_init();
ble_init(name); ble_init(name);

View file

@ -76,7 +76,7 @@ uint8_t pump_disable(int8_t i) {
} }
void pump_timer_done(TimerHandle_t timer) { void pump_timer_done(TimerHandle_t timer) {
uint8_t idx = (pcTimerGetTimerName(timer) - 0x48); uint8_t idx = (pcTimerGetName(timer) - 0x48);
ESP_LOGD(TAG, "pump done: %d", idx); ESP_LOGD(TAG, "pump done: %d", idx);
running--; running--;
@ -86,9 +86,12 @@ void pump_timer_done(TimerHandle_t timer) {
void pumps_stop() { void pumps_stop() {
for(uint8_t i = 0; i < PUMPS; i++) { for(uint8_t i = 0; i < PUMPS; i++) {
if(pump_timers[i] != NULL) if(pump_timers[i] != NULL) {
pump_disable(i); pump_disable(i);
xTimerStop(pump_timers[i], 0); xTimerStop(pump_timers[i], 0);
i++;
}
} }
} }
@ -117,7 +120,7 @@ uint8_t pumps_init() {
gpio_set_level(pump_gpio_map[i], 0); gpio_set_level(pump_gpio_map[i], 0);
} }
io_conf.intr_type = GPIO_PIN_INTR_DISABLE; io_conf.intr_type = GPIO_INTR_DISABLE;
io_conf.mode = GPIO_MODE_OUTPUT; io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = GPIO_PUMP_PIN_SEL; io_conf.pin_bit_mask = GPIO_PUMP_PIN_SEL;
io_conf.pull_down_en = 1; io_conf.pull_down_en = 1;
@ -126,7 +129,7 @@ uint8_t pumps_init() {
// zero out pump enabled, duration // zero out pump enabled, duration
memset(&pumps_enabled, 0, sizeof(uint8_t) * PUMPS); memset(&pumps_enabled, 0, sizeof(uint8_t) * PUMPS);
memset(&pumps_duration, 10, sizeof(uint8_t) * PUMPS); memset(&pumps_duration, 5, sizeof(uint8_t) * PUMPS);
size_t size = sizeof(uint8_t) * PUMPS; size_t size = sizeof(uint8_t) * PUMPS;
if(!nvs_get_blob(config_handle, "pumps_duration", &pumps_duration, &size)) { if(!nvs_get_blob(config_handle, "pumps_duration", &pumps_duration, &size)) {

View file

@ -7,7 +7,7 @@
#include "pumps.h" #include "pumps.h"
#include "ble.h" #include "ble.h"
#define GPIO_USER_BUTTON (19) #define GPIO_USER_BUTTON (14)
static void IRAM_ATTR gpio_isr_handler(void* arg) { static void IRAM_ATTR gpio_isr_handler(void* arg) {
uint32_t gpio_num = (uint32_t) arg; uint32_t gpio_num = (uint32_t) arg;
@ -27,10 +27,10 @@ static void gpio_task(void* arg) {
if(level == last_level) continue; if(level == last_level) continue;
last_level = level; last_level = level;
printf("GPIO[%d] intr, val: %d\n", io_num, level); printf("GPIO[%ld] intr, val: %d\n", io_num, level);
if(state == 0) if(state == 0)
vTaskDelay(10 / portTICK_RATE_MS); vTaskDelay(10 / portTICK_PERIOD_MS);
pumps_run(); pumps_run();
@ -44,7 +44,7 @@ static void gpio_task(void* arg) {
void user_button_init() { void user_button_init() {
gpio_config_t io_conf; gpio_config_t io_conf;
io_conf.intr_type = GPIO_PIN_INTR_ANYEDGE; io_conf.intr_type = GPIO_INTR_ANYEDGE;
io_conf.mode = GPIO_MODE_INPUT; io_conf.mode = GPIO_MODE_INPUT;
io_conf.pin_bit_mask = (1ULL << GPIO_USER_BUTTON); io_conf.pin_bit_mask = (1ULL << GPIO_USER_BUTTON);
io_conf.pull_down_en = 0; io_conf.pull_down_en = 0;