Commit e96c68ae authored by Jacob Priddy's avatar Jacob Priddy 👌

Door strike works!

parent faafc695
Pipeline #7266 failed with stages
in 1 minute and 13 seconds
......@@ -4,3 +4,4 @@ build/
cmake-build*
sdkconfig
sdkconfig.old
.idea
......@@ -22,7 +22,10 @@
#include "app/diagnostic.h"
#include "connectors/nvs.h"
#include "config.h"
#include <driver/gpio.h>
#define GPIO_OUTPUT_IO_0 (unsigned)21
#define GPIO_OUTPUT_PIN_SEL ((1ULL<<GPIO_OUTPUT_IO_0))
static const char* TAG = "MAIN_MODULE";
static void check_code_task(void* pvParameters)
......@@ -46,6 +49,10 @@ static void check_code_task(void* pvParameters)
door_api_verify_code("123867");
ESP_LOGI(TAG, "Done with second request");
gpio_set_level(GPIO_OUTPUT_IO_0, 1);
door_rtos_task_delay(2000);
gpio_set_level(GPIO_OUTPUT_IO_0, 0);
door_http_destroy();
door_wifi_destroy();
ESP_LOGI(TAG, "Finished Request");
......@@ -82,6 +89,22 @@ void app_main()
// Initialize all the modules
initialize();
// initialize GPIO for the door strike
gpio_config_t io_conf = {
//disable interrupt
.intr_type = (gpio_int_type_t)GPIO_PIN_INTR_DISABLE,
//set as output mode
.mode = GPIO_MODE_OUTPUT,
//bit mask of the pins that you want to set,e.g.GPIO18/19
.pin_bit_mask = GPIO_OUTPUT_PIN_SEL,
//disable pull-down mode
.pull_down_en = 0,
//disable pull-up mode
.pull_up_en = 0
};
//configure GPIO with the given settings
gpio_config(&io_conf);
// Do application rollback process
const esp_partition_t *running = esp_ota_get_running_partition();
esp_ota_img_states_t ota_state;
......
......@@ -36,5 +36,4 @@ void door_sntp_get_time_info(struct tm* time_info)
time_t now;
time(&now);
localtime_r(&now, time_info);
return true;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment