Compare commits
2 Commits
03ca64080c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 56d8a0f2cf | |||
| bec3d91d98 |
@@ -132,7 +132,6 @@ CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK=0
|
||||
CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT=8
|
||||
CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0x000000007FFFFF00
|
||||
CONFIG_SOC_GPIO_SUPPORT_FORCE_HOLD=y
|
||||
CONFIG_SOC_GPIO_SUPPORT_HOLD_IO_IN_DSLP=y
|
||||
CONFIG_SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP=y
|
||||
CONFIG_SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX=y
|
||||
CONFIG_SOC_CLOCKOUT_HAS_SOURCE_GATE=y
|
||||
@@ -2344,13 +2343,6 @@ CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT=y
|
||||
#
|
||||
# CONFIG_OPENTHREAD_ENABLED is not set
|
||||
|
||||
#
|
||||
# Thread Console
|
||||
#
|
||||
CONFIG_OPENTHREAD_CLI=y
|
||||
CONFIG_OPENTHREAD_CONSOLE_COMMAND_PREFIX="ot"
|
||||
# end of Thread Console
|
||||
|
||||
#
|
||||
# OpenThread Spinel
|
||||
#
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "defines.h"
|
||||
#include <mutex>
|
||||
#include "bmHTTP.hpp"
|
||||
#include "esp_mac.h"
|
||||
|
||||
std::atomic<bool> flag_scan_requested{false};
|
||||
std::atomic<bool> credsGiven{false};
|
||||
@@ -28,6 +29,7 @@ std::atomic<NimBLECharacteristic*> authConfirmChar = nullptr;
|
||||
std::atomic<NimBLECharacteristic*> credsChar = nullptr;
|
||||
std::atomic<NimBLECharacteristic*> tokenChar = nullptr;
|
||||
std::atomic<NimBLECharacteristic*> ssidRefreshChar = nullptr;
|
||||
std::atomic<NimBLECharacteristic*> deviceInfoChar = nullptr;
|
||||
|
||||
NimBLEAdvertising* initBLE() {
|
||||
finalAuth = false;
|
||||
@@ -93,6 +95,27 @@ NimBLEAdvertising* initBLE() {
|
||||
);
|
||||
connectConfirmChar.load()->createDescriptor("2902"); // Add BLE2902 descriptor for notifications
|
||||
|
||||
// 0x0006 - Device Info (READ) - MAC address and other device details
|
||||
deviceInfoChar = pService->createCharacteristic(
|
||||
"0006",
|
||||
NIMBLE_PROPERTY::READ
|
||||
);
|
||||
// Build device info JSON with MAC address
|
||||
uint8_t mac[6];
|
||||
esp_read_mac(mac, ESP_MAC_WIFI_STA);
|
||||
char macStr[18];
|
||||
snprintf(macStr, sizeof(macStr), "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
||||
cJSON *infoRoot = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(infoRoot, "mac", macStr);
|
||||
cJSON_AddStringToObject(infoRoot, "firmware", "1.0.0");
|
||||
cJSON_AddStringToObject(infoRoot, "model", "BlindMaster-C6");
|
||||
char *infoJson = cJSON_PrintUnformatted(infoRoot);
|
||||
deviceInfoChar.load()->setValue(std::string(infoJson));
|
||||
cJSON_Delete(infoRoot);
|
||||
free(infoJson);
|
||||
|
||||
// Start
|
||||
pService->start();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# This file was automatically generated for projects
|
||||
# without default 'CMakeLists.txt' file.
|
||||
|
||||
FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.* ${CMAKE_SOURCE_DIR}/include/*.cpp)
|
||||
FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
|
||||
|
||||
idf_component_register(SRCS ${app_sources}
|
||||
INCLUDE_DIRS "."
|
||||
|
||||
13
src/main.cpp
13
src/main.cpp
@@ -18,6 +18,17 @@ Encoder* bottomEnc = new Encoder(InputEnc_PIN_A, InputEnc_PIN_B);
|
||||
// Global calibration instance
|
||||
Calibration calib;
|
||||
|
||||
void switchOnOffServo() {
|
||||
while (1) {
|
||||
printf("Servo On\n");
|
||||
servoOn(CCW, manual);
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
printf("Servo Off\n");
|
||||
servoOff();
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
}
|
||||
}
|
||||
|
||||
void mainApp() {
|
||||
esp_err_t ret = nvs_flash_init(); // change to secure init logic soon!!
|
||||
// 2. If NVS is full or corrupt (common after flashing new code), erase and retry
|
||||
@@ -35,6 +46,8 @@ void mainApp() {
|
||||
bottomEnc->init();
|
||||
servoInit();
|
||||
|
||||
// switchOnOffServo();
|
||||
|
||||
setupLoop();
|
||||
|
||||
statusResolved = false;
|
||||
|
||||
@@ -38,6 +38,7 @@ void servoInit() {
|
||||
ESP_ERROR_CHECK(ledc_channel_config(&ledc_channel));
|
||||
|
||||
// Configure servo power switch pin as output
|
||||
gpio_reset_pin(servoSwitch);
|
||||
gpio_set_direction(servoSwitch, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level(servoSwitch, 0); // Start with servo power off
|
||||
|
||||
Reference in New Issue
Block a user