diff --git a/prj.conf b/prj.conf index e93626c..9bdcbdc 100644 --- a/prj.conf +++ b/prj.conf @@ -1,72 +1,70 @@ # VesiScan BASIC - Zephyr configuration -# Stage 1: GPIO + Power Control + LED + Debug Logging -# Stage 2: BLE (NUS) CONFIG_GPIO=y # Debug Message (RTT) -# Build-time switch for project DBG_PRINTF/DBG_CORE/DBG_ERR macros. +# Build-time switch for project DBG_PRINTF/DBG_CORE/DBG_ERR macros CONFIG_VESIS_DEBUG_PRINT=n -# Zephyr logging subsystem enable. +# Zephyr logging subsystem enable CONFIG_LOG=y -# Print logs immediately when log API is called. +# Print logs immediately when log API is called CONFIG_LOG_MODE_IMMEDIATE=y -# Default log level: 3 = INFO. +# Default log level: 3 = INFO CONFIG_LOG_DEFAULT_LEVEL=2 -# Do not add ANSI color codes to logs. +# Do not add ANSI color codes to logs CONFIG_LOG_BACKEND_SHOW_COLOR=n -# Enable printk(). +# Enable printk() CONFIG_PRINTK=y -# Send Zephyr LOG output to SEGGER RTT. +# Send Zephyr LOG output to SEGGER RTT CONFIG_LOG_BACKEND_RTT=y -# Enable SEGGER RTT support. +# Enable SEGGER RTT support CONFIG_USE_SEGGER_RTT=y -# Enable Zephyr console subsystem. +# Enable Zephyr console subsystem CONFIG_CONSOLE=y -# Send console/printk output to RTT. +# Send console/printk output to RTT CONFIG_RTT_CONSOLE=y -# If RTT buffer is full, wait instead of dropping logs. +# If RTT buffer is full, wait instead of dropping logs CONFIG_LOG_BACKEND_RTT_MODE_BLOCK=y -# RTT log backend output buffer size. +# RTT log backend output buffer size CONFIG_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE=1024 -# Disable UART logging/console/serial driver. This project uses RTT instead of UART. +# Disable UART logging/console/serial driver. This project uses RTT instead of UART CONFIG_LOG_BACKEND_UART=n CONFIG_SERIAL=n CONFIG_UART_CONSOLE=n # BLE stack -# Enable Zephyr Bluetooth host stack. +# Enable Zephyr Bluetooth host stack CONFIG_BT=y -# Keep Bluetooth internal logs at warning level. +# Keep Bluetooth internal logs at warning level CONFIG_BT_LOG_LEVEL_WRN=y -# Operate as a BLE peripheral device. +# Operate as a BLE peripheral device CONFIG_BT_PERIPHERAL=y -# Default local device name. Runtime advertising name is set from SERIAL_NO by bt_set_name(). -CONFIG_BT_DEVICE_NAME="VBT260300ZZ" -# Allow runtime BLE name change with bt_set_name(SERIAL_NO). +# Default local device name. Runtime advertising name is set from SERIAL_NO by bt_set_name() +CONFIG_BT_DEVICE_NAME="VBT2608000Z" +# Allow runtime BLE name change with bt_set_name(SERIAL_NO) CONFIG_BT_DEVICE_NAME_DYNAMIC=y -# Maximum runtime BLE name length. Current serial number is 12 characters. +# Maximum runtime BLE name length. Current serial number is 12 characters CONFIG_BT_DEVICE_NAME_MAX=16 -# Allow only one simultaneous peripheral link. +# Allow only one simultaneous peripheral link CONFIG_BT_MAX_CONN=1 # BLE NUS (Nordic UART Service) -# Enable Nordic UART Service for BLE data exchange. +# Enable Nordic UART Service for BLE data exchange CONFIG_BT_NUS=y # BLE PHY -# Disable 2M PHY so the link stays on 1M PHY. +# Disable 2M PHY so the link stays on 1M PHY CONFIG_BT_CTLR_PHY_2M=n # GATT / MTU -# Enable GATT client support. May be removable if no client API is used. +# Enable GATT client support. May be removable if no client API is used CONFIG_BT_GATT_CLIENT=y -# L2CAP TX MTU. ATT MTU is this value minus 3 bytes. +# L2CAP TX MTU. ATT MTU is this value minus 3 bytes CONFIG_BT_L2CAP_TX_MTU=247 -# BLE ACL TX buffer size for larger MTU packets. +# BLE ACL TX buffer size for larger MTU packets CONFIG_BT_BUF_ACL_TX_SIZE=251 -# BLE ACL RX buffer size for larger MTU packets. +# BLE ACL RX buffer size for larger MTU packets CONFIG_BT_BUF_ACL_RX_SIZE=251 # Connection parameters @@ -76,91 +74,90 @@ CONFIG_BT_PERIPHERAL_PREF_MIN_INT=24 CONFIG_BT_PERIPHERAL_PREF_MAX_INT=48 # Slave latency 0: do not skip connection events CONFIG_BT_PERIPHERAL_PREF_LATENCY=0 -# Supervision timeout: 1000 x 10ms = 10s. +# Supervision timeout: 1000 x 10ms = 10s CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=1000 # BLE security (production) -# Enable BLE Security Manager Protocol for pairing/bonding. +# Enable BLE Security Manager Protocol for pairing/bonding CONFIG_BT_SMP=y -# Allow bonding so pairing information can be stored and reused. # Enable mbedTLS/nRF Security backend for Bluetooth PSA crypto calls CONFIG_MBEDTLS=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y # Allow bonding so pairing information can be stored and reused CONFIG_BT_BONDABLE=y -# App provides the passkey through the auth callback. +# App provides the passkey through the auth callback CONFIG_BT_APP_PASSKEY=y # Require MITM-protected pairing. CONFIG_BT_SMP_ENFORCE_MITM=y -# Allow only LE Secure Connections pairing. +# Allow only LE Secure Connections pairing CONFIG_BT_SMP_SC_ONLY=y -# Store and restore BLE bond/security information through settings. +# Store and restore BLE bond/security information through settings CONFIG_BT_SETTINGS=y # Maximum number of stored bonded peers. CONFIG_BT_MAX_PAIRED=1 -# Production secure boot: disable flash patching so only signed flash code can run. +# Production secure boot: disable flash patching so only signed flash code can run CONFIG_DISABLE_FLASH_PATCH=y # ADC (battery) -# Enable Zephyr ADC driver for battery voltage measurement. +# Enable Zephyr ADC driver for battery voltage measurement CONFIG_ADC=y # I2C (IMU: ICM42670P) -# Enable Zephyr I2C driver for IMU communication. +# Enable Zephyr I2C driver for IMU communication CONFIG_I2C=y # Direct nrfx SPIM3 driver for ADC121S051 -# Enable nrfx SPIM driver for direct echo ADC SPI control. +# Enable nrfx SPIM driver for direct echo ADC SPI control CONFIG_NRFX_SPIM=y # System -# Heap memory available for runtime dynamic allocation. +# Heap memory available for runtime dynamic allocation CONFIG_HEAP_MEM_POOL_SIZE=4096 -# Stack size for Zephyr system workqueue thread. +# Stack size for Zephyr system workqueue thread CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 # BLE RX stack sizes -# BLE RX thread stack size. Helps prevent overflow during RX/security processing. +# BLE RX thread stack size. Helps prevent overflow during RX/security processing CONFIG_BT_RX_STACK_SIZE=4096 # DFU -# Build the application for MCUboot bootloader environment. +# Build the application for MCUboot bootloader environment 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 # Version string used by MCUboot imgtool signing and versioned DFU zip naming -CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="2.0.3+0" +CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="2.0.5+0" # Internal flash -# Enable internal flash driver. +# Enable internal flash driver CONFIG_FLASH=y -# Enable flash partition/slot lookup APIs. +# Enable flash partition/slot lookup APIs CONFIG_FLASH_MAP=y # Persistent application settings (FDS replacement) -# Enable Zephyr NVS storage. +# Enable Zephyr NVS storage CONFIG_NVS=y -# Enable Zephyr settings subsystem. +# Enable Zephyr settings subsystem CONFIG_SETTINGS=y -# Use NVS as the settings backend. +# Use NVS as the settings backend CONFIG_SETTINGS_NVS=y -# Number of flash sectors used by settings/NVS backend. +# Number of flash sectors used by settings/NVS backend CONFIG_SETTINGS_NVS_SECTOR_COUNT=2 -# settings_storage partition size. 0x2000 = 8KB. +# settings_storage partition size. 0x2000 = 8KB CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x2000 # mcumgr framework -# Enable mcumgr management framework. +# Enable mcumgr management framework CONFIG_MCUMGR=y # mcumgr over BLE transport -# Enable mcumgr/SMP messages over BLE SMP service. +# Enable mcumgr/SMP messages over BLE SMP service CONFIG_MCUMGR_TRANSPORT_BT=y -# Require authenticated BLE connection for mcumgr read/write operations. +# Require authenticated BLE connection for mcumgr read/write operations CONFIG_MCUMGR_TRANSPORT_BT_PERM_RW_AUTHEN=y -# Reassemble SMP packets fragmented over BLE. +# Reassemble SMP packets fragmented over BLE CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y -# mcumgr transport receive buffer size for DFU image chunks. +# mcumgr transport receive buffer size for DFU image chunks CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=1024 # CBOR (mcumgr/SMP/DFU command payload format) @@ -168,21 +165,21 @@ CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=1024 CONFIG_ZCBOR_MAX_STR_LEN=512 # mcumgr callbacks/hooks -# Enable mcumgr management event notification hooks. +# Enable mcumgr management event notification hooks CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y # Enable image upload/DFU status hooks. CONFIG_MCUMGR_GRP_IMG_STATUS_HOOKS=y -# Enable SMP command done/failed status hooks. +# Enable SMP command done/failed status hooks CONFIG_MCUMGR_SMP_COMMAND_STATUS_HOOKS=y # mcumgr command groups -# Enable image management group: upload, test, confirm, state. +# Enable image management group: upload, test, confirm, state CONFIG_MCUMGR_GRP_IMG=y -# Enable OS management group: reset and OS-related commands. +# Enable OS management group: reset and OS-related commands CONFIG_MCUMGR_GRP_OS=y # MCUboot image handling -# Enable image manager for MCUboot image state/verify/confirm operations. +# Enable image manager for MCUboot image state/verify/confirm operations CONFIG_IMG_MANAGER=y -# Write uploaded image data to flash as a stream. -CONFIG_STREAM_FLASH=y \ No newline at end of file +# Write uploaded image data to flash as a stream +CONFIG_STREAM_FLASH=y diff --git a/src/command/handlers/cmd_sensor.c b/src/command/handlers/cmd_sensor.c index 7f98820..e658fe6 100644 --- a/src/command/handlers/cmd_sensor.c +++ b/src/command/handlers/cmd_sensor.c @@ -24,7 +24,7 @@ int cmd_msn(const uint8_t *data, uint8_t data_len) int mv = battery_read_mv(); if (mv < 0) { - mv = 0; + mv = 0xFFFF; } cmd_send_response_u16("rsn:", (uint16_t)mv);