Compare commits
No commits in common. "e7abcc0f07f339f3e2283839dfc38f7bf012b44c" and "c57f25af03d01854ac06ab14f42aa7b6d866c5b4" have entirely different histories.
e7abcc0f07
...
c57f25af03
5 changed files with 35 additions and 60 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 093ce60a9f70e98bafbadad568c145de4f3c323e
|
||||
Subproject commit 54c7a2d2d65dc9159dad27d6388d8a5409b59dd0
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 5aeff5d0ce651a98a9a80f0e281fe55a5863e688
|
||||
Subproject commit af52863f024eeed3c4730e2a7b945a18e9bfb9fb
|
||||
|
|
@ -1,13 +1,9 @@
|
|||
#ifndef __BARBACK_H__
|
||||
#define __BARBACK_H__
|
||||
|
||||
#include "configulator.h"
|
||||
|
||||
typedef uint8_t (*barback_ble_access_read_t)(uint8_t idx);
|
||||
typedef uint8_t (*barback_ble_access_write_t)(uint8_t idx, uint8_t value);
|
||||
|
||||
extern cfglr_handle_t *configulator;
|
||||
|
||||
typedef struct {
|
||||
uint16_t base_uuid;
|
||||
|
||||
|
|
|
|||
21
main/main.c
21
main/main.c
|
|
@ -13,8 +13,6 @@
|
|||
#include "led_strip.h"
|
||||
|
||||
#include "configulator.h"
|
||||
#include "barback.h"
|
||||
// TODO main should be merged into barback
|
||||
#include "main.h"
|
||||
#include "console.h"
|
||||
#include "ble.h"
|
||||
|
|
@ -30,8 +28,6 @@ uint8_t mac[6];
|
|||
nvs_handle_t config_handle = {};
|
||||
led_strip_handle_t led_strip;
|
||||
|
||||
cfglr_handle_t *configulator;
|
||||
|
||||
void led_init() {
|
||||
led_strip_config_t strip_config = {
|
||||
.strip_gpio_num = LED_GPIO, // The GPIO that connected to the LED strip's data line
|
||||
|
|
@ -57,10 +53,6 @@ void led_init() {
|
|||
ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip));
|
||||
}
|
||||
|
||||
void test_callback(cfglr_signaler_t *signaler, cfglr_element_t *element, cfglr_signal_e sig) {
|
||||
CFGLR_LOGI(TAG, "callback %s = '%s'", element->key, element->data);
|
||||
}
|
||||
|
||||
void app_main(void) {
|
||||
// init pump IO immediately to limit run away pumps in case power is on
|
||||
pumps_io_init();
|
||||
|
|
@ -97,13 +89,7 @@ void app_main(void) {
|
|||
CFGLR_ELEMENT_U8("armed", 1, CFGLR_SIGNALER_IDF_EVENT()),
|
||||
CFGLR_ELEMENT_U8("monitor", 0, CFGLR_SIGNALER_IDF_EVENT()),
|
||||
CFGLR_ELEMENT_U8("pour_button", 19, CFGLR_SIGNALER_IDF_EVENT()),
|
||||
CFGLR_ELEMENT_STR(
|
||||
"device_name",
|
||||
32,
|
||||
"",
|
||||
CFGLR_SIGNALER_IDF_EVENT(),
|
||||
CFGLR_SIGNALER_CALLBACK(test_callback)
|
||||
),
|
||||
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()),
|
||||
CFGLR_ELEMENT_BIN("pump_ramp_ms", sizeof(uint16_t) * 4, pump_ramp_ms, sizeof(uint16_t) * 4, CFGLR_SIGNALER_IDF_EVENT()),
|
||||
|
|
@ -111,10 +97,7 @@ void app_main(void) {
|
|||
},
|
||||
};
|
||||
|
||||
// setup configulator global handler
|
||||
configulator = &cfglr_handle;
|
||||
|
||||
uint8_t ret = cfglr_init(configulator);
|
||||
uint8_t ret = cfglr_init(&cfglr_handle);
|
||||
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
|
||||
|
|
|
|||
10
main/pumps.c
10
main/pumps.c
|
|
@ -108,7 +108,7 @@ uint8_t pump_disable(int8_t i) {
|
|||
}
|
||||
|
||||
void pump_timer_done(TimerHandle_t timer) {
|
||||
uint8_t idx = (uint8_t)(pcTimerGetName(timer) - 0x48);
|
||||
uint8_t idx = (pcTimerGetName(timer) - 0x48);
|
||||
ESP_LOGD(TAG, "pump done: %d", idx);
|
||||
|
||||
xQueueSend(pump_step_queue, &idx, portMAX_DELAY);
|
||||
|
|
@ -147,12 +147,11 @@ void pumps_run() {
|
|||
|
||||
void pump_step_task() {
|
||||
uint8_t idx;
|
||||
TickType_t awoke = pdFALSE;
|
||||
BaseType_t awoke = pdFALSE;
|
||||
|
||||
ESP_LOGI(TAG, "Starting pump stepping task");
|
||||
|
||||
while(true) {
|
||||
while(xQueueReceive(pump_step_queue, &idx, awoke)) {
|
||||
while(xQueueReceive(pump_step_queue, &idx, &awoke)) {
|
||||
ESP_LOGI(TAG, "step %d complete for %d", pump_states[idx], idx);
|
||||
|
||||
if(pump_states[idx] == PUMP_STATE_RAMPING_UP) {
|
||||
|
|
@ -187,9 +186,6 @@ void pump_step_task() {
|
|||
ESP_LOGE(TAG, "Pump step fired with unknown state: %d", pump_states[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
vTaskDelay(portTICK_PERIOD_MS / 10);
|
||||
}
|
||||
}
|
||||
|
||||
static IRAM_ATTR bool ledc_fade_end_event(const ledc_cb_param_t *param, void *parg) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue