Compare commits
8 commits
e9eb537eee
...
674594d32e
Author | SHA1 | Date | |
---|---|---|---|
|
674594d32e | ||
|
548d4eeaa0 | ||
|
fdd9166e8e | ||
|
c82f162115 | ||
|
5c5033898d | ||
|
049de947fd | ||
|
b56ad43a59 | ||
|
54d7eb9277 |
10 changed files with 40 additions and 12 deletions
|
@ -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
|
||||||
|
|
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -1,3 +1,3 @@
|
||||||
[submodule "components/esp32-lora"]
|
[submodule "components/idf-dfplayermini"]
|
||||||
path = components/esp32-lora
|
path = components/idf-dfplayermini
|
||||||
url = https://gitlab.com/morganrallen/esp32-lora.git
|
url = https://git.oit.cloud/morgan/idf-dfplayermini.git
|
||||||
|
|
17
.woodpecker.yml
Normal file
17
.woodpecker.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: espressif/idf:release-v4.1
|
||||||
|
commands:
|
||||||
|
- mkdir ~/.ssh
|
||||||
|
- ssh-keyscan -t rsa git.oit.cloud >> ~/.ssh/known_hosts
|
||||||
|
- git submodule update --init
|
||||||
|
- if [ -f sdkconfig ]; then
|
||||||
|
- rm sdkconfig
|
||||||
|
- fi
|
||||||
|
- ls
|
||||||
|
- . /opt/esp/idf/export.sh
|
||||||
|
- idf.py reconfigure
|
||||||
|
- echo "BB-CI-$((1 + RANDOM % 999))" > bbid
|
||||||
|
- sed -i -e s/BARBACK_ID=\"Barback\"/BARBACK_ID=\"`cat bbid`\"/ sdkconfig
|
||||||
|
- idf.py reconfigure
|
||||||
|
- idf.py build
|
|
@ -3,4 +3,5 @@
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
|
||||||
project(barback)
|
project(barback)
|
||||||
|
|
1
components/idf-dfplayermini
Submodule
1
components/idf-dfplayermini
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 7ec406c5af692b9c99ae9ed0c7fb5ba648a0a71e
|
|
@ -19,6 +19,6 @@ uint8_t pumps_get_duration(uint8_t idx);
|
||||||
uint8_t pumps_set_enabled(uint8_t idx, uint8_t value);
|
uint8_t pumps_set_enabled(uint8_t idx, uint8_t value);
|
||||||
uint8_t pumps_get_enabled(uint8_t idx);
|
uint8_t pumps_get_enabled(uint8_t idx);
|
||||||
|
|
||||||
uint8_t pumps_get_state(uint8_t idx);
|
uint8_t pumps_get_running(uint8_t idx);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,5 +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)
|
||||||
|
|
||||||
register_component()
|
register_component()
|
||||||
|
|
|
@ -68,7 +68,7 @@ static barback_ble_access_t barback_ble_pump_access_enabled = {
|
||||||
}
|
}
|
||||||
|
|
||||||
static barback_ble_access_t barback_ble_pump_access_state = {
|
static barback_ble_access_t barback_ble_pump_access_state = {
|
||||||
.read = pumps_get_state,
|
.read = pumps_get_running,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BLE_CHAR_PUMP_STATE(idx) {\
|
#define BLE_CHAR_PUMP_STATE(idx) {\
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#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";
|
||||||
|
|
||||||
|
@ -42,6 +43,10 @@ void app_main(void) {
|
||||||
char *name = malloc(strlen(TAG) + 4);
|
char *name = malloc(strlen(TAG) + 4);
|
||||||
sprintf(name, "%s-%02X", TAG, mac[5]);
|
sprintf(name, "%s-%02X", TAG, mac[5]);
|
||||||
|
|
||||||
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
|
dfplayermini_init();
|
||||||
|
|
||||||
user_button_init();
|
user_button_init();
|
||||||
pumps_init();
|
pumps_init();
|
||||||
ble_init(name);
|
ble_init(name);
|
||||||
|
|
14
main/pumps.c
14
main/pumps.c
|
@ -15,7 +15,7 @@ uint8_t running = 0;
|
||||||
TimerHandle_t pump_timers[PUMPS];
|
TimerHandle_t pump_timers[PUMPS];
|
||||||
static uint8_t pumps_duration[PUMPS] = {0};
|
static uint8_t pumps_duration[PUMPS] = {0};
|
||||||
static uint8_t pumps_enabled[PUMPS] = {0};
|
static uint8_t pumps_enabled[PUMPS] = {0};
|
||||||
static uint8_t pumps_state[PUMPS] = {0};
|
static uint8_t pumps_running[PUMPS] = {0};
|
||||||
static uint8_t safety = 1;
|
static uint8_t safety = 1;
|
||||||
|
|
||||||
void pumps_update_config() {
|
void pumps_update_config() {
|
||||||
|
@ -38,6 +38,10 @@ uint8_t pumps_set_duration(uint8_t idx, uint8_t time) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t pumps_get_duration(uint8_t idx) {
|
||||||
|
return pumps_duration[idx];
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t pumps_set_enabled(uint8_t idx, uint8_t value) {
|
uint8_t pumps_set_enabled(uint8_t idx, uint8_t value) {
|
||||||
uint8_t io = pump_gpio_map[idx];
|
uint8_t io = pump_gpio_map[idx];
|
||||||
|
|
||||||
|
@ -55,12 +59,8 @@ uint8_t pumps_get_enabled(uint8_t idx) {
|
||||||
return pumps_enabled[idx] ? 1 : 0;
|
return pumps_enabled[idx] ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t pumps_get_duration(uint8_t idx) {
|
uint8_t pumps_get_running(uint8_t idx) {
|
||||||
return pumps_duration[idx];
|
return pumps_running[idx];
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t pumps_get_state(uint8_t idx) {
|
|
||||||
return pumps_state[idx];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t pump_enable(int8_t i) {
|
uint8_t pump_enable(int8_t i) {
|
||||||
|
|
Loading…
Reference in a new issue