Compare commits
4 Commits
0fc578fb50
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 79b5e2b7ce | |||
| 4ecec2f0f2 | |||
| abb8d6078a | |||
| b6d79ad16a |
@@ -125,7 +125,7 @@ CONFIG_BOOTLOADER_MCUBOOT=y
|
|||||||
# Enable zcbor library used by mcumgr/SMP/DFU CBOR payloads.
|
# Enable zcbor library used by mcumgr/SMP/DFU CBOR payloads.
|
||||||
CONFIG_ZCBOR=y
|
CONFIG_ZCBOR=y
|
||||||
# Version string used by MCUboot imgtool signing and versioned DFU zip naming.
|
# Version string used by MCUboot imgtool signing and versioned DFU zip naming.
|
||||||
CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="0.0.2+26"
|
CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="0.0.0+0"
|
||||||
|
|
||||||
# Internal flash
|
# Internal flash
|
||||||
# Enable internal flash driver.
|
# Enable internal flash driver.
|
||||||
@@ -182,8 +182,3 @@ CONFIG_MCUMGR_GRP_OS=y
|
|||||||
CONFIG_IMG_MANAGER=y
|
CONFIG_IMG_MANAGER=y
|
||||||
# Write uploaded image data to flash as a stream.
|
# Write uploaded image data to flash as a stream.
|
||||||
CONFIG_STREAM_FLASH=y
|
CONFIG_STREAM_FLASH=y
|
||||||
|
|
||||||
# Netcore HCI IPC
|
|
||||||
# nRF52840 build does not use network core HCI IPC.
|
|
||||||
#CONFIG_SB_CONFIG_NETCORE_HCI_IPC=y
|
|
||||||
#SB_CONFIG_NETCORE_HCI_IPC=y
|
|
||||||
|
|||||||
@@ -39,7 +39,10 @@
|
|||||||
#define PIEZO_AVG_INTER_BURST_GAP_US 650
|
#define PIEZO_AVG_INTER_BURST_GAP_US 650
|
||||||
|
|
||||||
/* real capture 전에 같은 채널에서 버스트+ADC capture를 버리는 횟수(dummy) */
|
/* real capture 전에 같은 채널에서 버스트+ADC capture를 버리는 횟수(dummy) */
|
||||||
#define PIEZO_DUMMY_CAPTURE_COUNT 5
|
#define PIEZO_DUMMY_CAPTURE_COUNT 1
|
||||||
|
|
||||||
|
/* 채널 0 시작 전 안정을 위한 추가 딜레이 */
|
||||||
|
#define PIEZO_CH0_WARMUP_TO_REAL_SETTLE_US 3000
|
||||||
|
|
||||||
/* 6채널 sweep 결과 (각 채널의 평균 완료 후 최종만 저장) */
|
/* 6채널 sweep 결과 (각 채널의 평균 완료 후 최종만 저장) */
|
||||||
static uint16_t piezo_channels[PIEZO_NUM_CHANNELS][PIEZO_MEASURE_MAX_SAMPLES];
|
static uint16_t piezo_channels[PIEZO_NUM_CHANNELS][PIEZO_MEASURE_MAX_SAMPLES];
|
||||||
@@ -230,7 +233,8 @@ int piezo_measure_sweep(void)
|
|||||||
|
|
||||||
if (ch == 0U) // 채널 0 시작 전에만 dummy burst + ADC capture 수행
|
if (ch == 0U) // 채널 0 시작 전에만 dummy burst + ADC capture 수행
|
||||||
{
|
{
|
||||||
// Dummy burst - ADC caputre는 수행하지 않음
|
// Dummy burst + ADC caputre
|
||||||
|
/*
|
||||||
for (uint8_t dummy = 0; dummy < PIEZO_DUMMY_CAPTURE_COUNT; dummy++)
|
for (uint8_t dummy = 0; dummy < PIEZO_DUMMY_CAPTURE_COUNT; dummy++)
|
||||||
{
|
{
|
||||||
k_busy_wait(PIEZO_AVG_INTER_BURST_GAP_US);
|
k_busy_wait(PIEZO_AVG_INTER_BURST_GAP_US);
|
||||||
@@ -251,10 +255,20 @@ int piezo_measure_sweep(void)
|
|||||||
DBG_PRINTF("[ECHO] dummy capture fail ch=%d dummy=%d err=%d\r\n", ch, dummy, err);
|
DBG_PRINTF("[ECHO] dummy capture fail ch=%d dummy=%d err=%d\r\n", ch, dummy, err);
|
||||||
return ECHO_STATUS_CAPTURE;
|
return ECHO_STATUS_CAPTURE;
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
k_busy_wait(PIEZO_AVG_INTER_BURST_GAP_US);
|
||||||
|
piezo_burst_sw_freq(freq, cycles);
|
||||||
|
k_busy_wait(capture_delay_us);
|
||||||
|
err = echo_adc_capture(echo_capture, samples);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
//DBG_PRINTF("[ECHO] dummy capture fail ch=%d dummy=%d err=%d\r\n", ch, dummy, err);
|
||||||
|
return ECHO_STATUS_CAPTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 마지막 dummy capture와 첫 real capture 사이에도 같은 회복 시간
|
// 마지막 dummy capture와 첫 real capture 사이에도 같은 회복 시간 + 추가 안정화
|
||||||
k_busy_wait(PIEZO_AVG_INTER_BURST_GAP_US + 3000);
|
k_busy_wait(PIEZO_AVG_INTER_BURST_GAP_US + PIEZO_CH0_WARMUP_TO_REAL_SETTLE_US);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 여기부터 실제 평균에 들어갈 capture
|
// 여기부터 실제 평균에 들어갈 capture
|
||||||
|
|||||||
@@ -17,11 +17,12 @@
|
|||||||
#include "ble_service.h"
|
#include "ble_service.h"
|
||||||
#include "battery_adc.h"
|
#include "battery_adc.h"
|
||||||
|
|
||||||
#define POWER_HOLD_NODE DT_NODELABEL(pwr_hold) // 전원 래치
|
#define POWER_HOLD_NODE DT_NODELABEL(pwr_hold) // 전원 래치
|
||||||
#define POWER_BTN_NODE DT_NODELABEL(button_check) // 전원 버튼
|
#define POWER_BTN_NODE DT_NODELABEL(button_check) // 전원 버튼
|
||||||
#define POWER_LOOP_INTERVAL 20 // 전원 시퀀스 타이머 간격(ms)
|
#define POWER_LOOP_INTERVAL 20 // 전원 시퀀스 타이머 간격(ms)
|
||||||
#define BOOT_THRESHOLD 350 // power button hold threshold
|
#define POWER_ON_THRESHOLD 350 // power button hold threshold(off -> on)
|
||||||
#define BOND_RESET_THRESHOLD (15000 / POWER_ON_DELAY) // 15s long press bond reset
|
#define POWER_OFF_THRESHOLD 500 // power button hold threshold(on -> off)
|
||||||
|
#define BOND_RESET_THRESHOLD (15000 / POWER_ON_DELAY) // 15s long press bond reset
|
||||||
|
|
||||||
static const struct gpio_dt_spec power_hold = GPIO_DT_SPEC_GET(POWER_HOLD_NODE, gpios); // 전원 유지 출력
|
static const struct gpio_dt_spec power_hold = GPIO_DT_SPEC_GET(POWER_HOLD_NODE, gpios); // 전원 유지 출력
|
||||||
static const struct gpio_dt_spec power_btn = GPIO_DT_SPEC_GET(POWER_BTN_NODE, gpios); // 전원 버튼 입력
|
static const struct gpio_dt_spec power_btn = GPIO_DT_SPEC_GET(POWER_BTN_NODE, gpios); // 전원 버튼 입력
|
||||||
@@ -211,7 +212,7 @@ static void main_s(struct k_timer *timer)
|
|||||||
{
|
{
|
||||||
cnt_s++;
|
cnt_s++;
|
||||||
|
|
||||||
if (cnt_s == BOOT_THRESHOLD) // 임계 시간 도달 시 전원 ON 확정
|
if (cnt_s == POWER_ON_THRESHOLD) // 임계 시간 도달 시 전원 ON 확정
|
||||||
{
|
{
|
||||||
device_on = true;
|
device_on = true;
|
||||||
power_control_handler(ON, "button-2s-latch");
|
power_control_handler(ON, "button-2s-latch");
|
||||||
@@ -248,7 +249,7 @@ static void main_s(struct k_timer *timer)
|
|||||||
{
|
{
|
||||||
cnt_s++;
|
cnt_s++;
|
||||||
|
|
||||||
if (cnt_s >= BOOT_THRESHOLD)
|
if (cnt_s >= POWER_OFF_THRESHOLD)
|
||||||
{
|
{
|
||||||
battery_timer_stop();
|
battery_timer_stop();
|
||||||
k_work_submit(&adv_stop_work);
|
k_work_submit(&adv_stop_work);
|
||||||
|
|||||||
Reference in New Issue
Block a user