From 241f3dc4b26f19c70f3ba9a2149f97ab808cfe6a Mon Sep 17 00:00:00 2001 From: Alireza Habibi <79379836+habibialireza@users.noreply.github.com> Date: Wed, 22 Apr 2026 20:08:57 +0200 Subject: [PATCH 1/3] Add files via upload --- src/ModdedLogger/CMakeLists.txt | 9 + src/ModdedLogger/ModdedLogger.cpp | 389 +++++++++++++++++++++ src/ModdedLogger/ModdedLogger.h | 57 +++ src/ModdedLogger/modded_logger_wrapper.cpp | 112 ++++++ src/ModdedLogger/modded_logger_wrapper.h | 47 +++ 5 files changed, 614 insertions(+) create mode 100644 src/ModdedLogger/CMakeLists.txt create mode 100644 src/ModdedLogger/ModdedLogger.cpp create mode 100644 src/ModdedLogger/ModdedLogger.h create mode 100644 src/ModdedLogger/modded_logger_wrapper.cpp create mode 100644 src/ModdedLogger/modded_logger_wrapper.h diff --git a/src/ModdedLogger/CMakeLists.txt b/src/ModdedLogger/CMakeLists.txt new file mode 100644 index 00000000..5e5665ad --- /dev/null +++ b/src/ModdedLogger/CMakeLists.txt @@ -0,0 +1,9 @@ +enable_language(CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +target_sources(app PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/ModdedLogger.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modded_logger_wrapper.cpp +) \ No newline at end of file diff --git a/src/ModdedLogger/ModdedLogger.cpp b/src/ModdedLogger/ModdedLogger.cpp new file mode 100644 index 00000000..c48e8ab7 --- /dev/null +++ b/src/ModdedLogger/ModdedLogger.cpp @@ -0,0 +1,389 @@ +#include "ModdedLogger.h" +#include + +#include +#include +#include +#include +#include + +LOG_MODULE_REGISTER(ModdedLogger, LOG_LEVEL_DBG); + +#define LFS_ROOT_PATH "/flash" +#define DEFAULT_LOG_FILE "modded_log.txt" + + +static std::string create_lfs_path(const std::string ¤t_path, const std::string &new_path) { + if (new_path.empty()) return LFS_ROOT_PATH; + if (new_path[0] == '/') return LFS_ROOT_PATH + new_path; + return current_path + "/" + new_path; +} + +FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(lfs_storage); +static struct fs_mount_t lfs_mnt = { + .type = FS_LITTLEFS, + .mnt_point = LFS_ROOT_PATH, + .fs_data = &lfs_storage, + .storage_dev = (void *)FIXED_PARTITION_ID(moddedlogger_partition), + .flags = 0, +}; + +ModdedLogger::ModdedLogger() : path(LFS_ROOT_PATH) { + fs_dir_t_init(&this->dirp); + int ret = this->mount(); + if (ret != 0) { + LOG_ERR("Failed to mount! Error: %d\n", ret); + } +} + +ModdedLogger::~ModdedLogger() { + unmount(); +} + +int ModdedLogger::mount() { + if (this->mounted) return 0; + + int ret = fs_mount(&lfs_mnt); + if (ret < 0) { + LOG_ERR("LittleFS mount failed: %d", ret); + return ret; + } + + fs_dir_t_init(&this->dirp); + ret = fs_opendir(&this->dirp, LFS_ROOT_PATH); + if (ret < 0) { + LOG_ERR("Failed to open root dir: %d", ret); + fs_unmount(&lfs_mnt); + return ret; + } + + this->mounted = true; + return 0; +} + +int ModdedLogger::unmount() { + if (!this->mounted) return 0; + + if (this->tracked_file.is_open) { + close_file(); + } + + fs_closedir(&this->dirp); + fs_unmount(&lfs_mnt); + + this->mounted = false; + return 0; +} + + +int ModdedLogger::log_flash_err(const char* input) { + if (!this->mounted) { + LOG_ERR("FS not mounted, cannot log to flash."); + return -ENODEV; + } + + uint64_t uptime_ticks = k_uptime_ticks(); + uint64_t total_us = k_ticks_to_us_floor64(uptime_ticks); + uint32_t us = total_us % 1000; + uint64_t total_ms = total_us / 1000; + uint32_t ms = total_ms % 1000; + uint64_t total_sec = total_ms / 1000; + uint32_t sec = total_sec % 60; + uint64_t total_min = total_sec / 60; + uint32_t min = total_min % 60; + uint32_t hours = total_min / 60; + + char time_buf[64]; + snprintf(time_buf, sizeof(time_buf), "-- [%02u:%02u:%02u.%03u,%03u] ", + hours, min, sec, ms, us); + + std::string message = std::string(time_buf) + "" + input + "\n"; + + size_t len = message.length(); + + ssize_t ret = this->write(DEFAULT_LOG_FILE, message.c_str(), &len, true); + + if (ret < 0) { + LOG_ERR("moddedlogger failed: %d", ret); + return (int)ret; + } + this->sync(); + LOG_ERR("%s", input); + + return 0; +} + +int ModdedLogger::log_flash_dbg(const char* input) { + if (!this->mounted) { + LOG_ERR("FS not mounted, cannot log to flash."); + return -ENODEV; + } + uint64_t uptime_ticks = k_uptime_ticks(); + uint64_t total_us = k_ticks_to_us_floor64(uptime_ticks); + uint32_t us = total_us % 1000; + uint64_t total_ms = total_us / 1000; + uint32_t ms = total_ms % 1000; + uint64_t total_sec = total_ms / 1000; + uint32_t sec = total_sec % 60; + uint64_t total_min = total_sec / 60; + uint32_t min = total_min % 60; + uint32_t hours = total_min / 60; + + char time_buf[64]; + snprintf(time_buf, sizeof(time_buf), "-- [%02u:%02u:%02u.%03u,%03u] ", + hours, min, sec, ms, us); + + std::string message = std::string(time_buf) + "" + input + "\n"; + + size_t len = message.length(); + + ssize_t ret = this->write(DEFAULT_LOG_FILE, message.c_str(), &len, true); + + if (ret < 0) { + LOG_ERR("moddedlogger failed: %d", ret); + return (int)ret; + } + + this->sync(); + LOG_DBG("%s", input); + return 0; +} + +int ModdedLogger::log_flash_inf(const char* input) { + if (!this->mounted) { + LOG_ERR("FS not mounted, cannot log to flash."); + return -ENODEV; + } + uint64_t uptime_ticks = k_uptime_ticks(); + uint64_t total_us = k_ticks_to_us_floor64(uptime_ticks); + uint32_t us = total_us % 1000; + uint64_t total_ms = total_us / 1000; + uint32_t ms = total_ms % 1000; + uint64_t total_sec = total_ms / 1000; + uint32_t sec = total_sec % 60; + uint64_t total_min = total_sec / 60; + uint32_t min = total_min % 60; + uint32_t hours = total_min / 60; + + char time_buf[64]; + snprintf(time_buf, sizeof(time_buf), "-- [%02u:%02u:%02u.%03u,%03u] ", + hours, min, sec, ms, us); + + std::string message = std::string(time_buf) + "" + input + "\n"; + + size_t len = message.length(); + + ssize_t ret = this->write(DEFAULT_LOG_FILE, message.c_str(), &len, true); + + if (ret < 0) { + LOG_ERR("moddedlogger failed: %d", ret); + return (int)ret; + } + + this->sync(); + LOG_INF("%s", input); + return 0; +} + +int ModdedLogger::log_flash_wrn(const char* input) { + if (!this->mounted) { + LOG_ERR("FS not mounted, cannot log to flash."); + return -ENODEV; + } + uint64_t uptime_ticks = k_uptime_ticks(); + uint64_t total_us = k_ticks_to_us_floor64(uptime_ticks); + uint32_t us = total_us % 1000; + uint64_t total_ms = total_us / 1000; + uint32_t ms = total_ms % 1000; + uint64_t total_sec = total_ms / 1000; + uint32_t sec = total_sec % 60; + uint64_t total_min = total_sec / 60; + uint32_t min = total_min % 60; + uint32_t hours = total_min / 60; + + char time_buf[64]; + snprintf(time_buf, sizeof(time_buf), "-- [%02u:%02u:%02u.%03u,%03u] ", + hours, min, sec, ms, us); + + std::string message = std::string(time_buf) + "" + input + "\n"; + + size_t len = message.length(); + + ssize_t ret = this->write(DEFAULT_LOG_FILE, message.c_str(), &len, true); + + if (ret < 0) { + LOG_ERR("moddedlogger failed: %d", ret); + return (int)ret; + } + + this->sync(); + LOG_WRN("%s", input); + return 0; +} + + +int ModdedLogger::cd(const std::string &new_path) { + if (!this->mounted) return -ENODEV; + + std::string abs_path = create_lfs_path(this->path, new_path); + fs_closedir(&this->dirp); + + int ret = fs_opendir(&this->dirp, abs_path.c_str()); + if (ret) { + LOG_ERR("fs_opendir failed: %d", ret); + fs_opendir(&this->dirp, this->path.c_str()); + return ret; + } + + this->path = abs_path; + return 0; +} + +int ModdedLogger::ls(char *buf, size_t *buf_size) { + if (!this->mounted) return -ENODEV; + + struct fs_dir_t local_dirp; + fs_dir_t_init(&local_dirp); + + int ret = fs_opendir(&local_dirp, this->path.c_str()); + if (ret < 0) return ret; + + size_t used_buf_size = 0; + struct fs_dirent entry; + + while (true) { + ret = fs_readdir(&local_dirp, &entry); + if (ret < 0) break; + if (entry.name[0] == 0) break; + + if (buf != nullptr) { + size_t remaining = *buf_size - used_buf_size; + if (remaining < 2) { + ret = -ENOMEM; + break; + } + + int len = snprintk( + &buf[used_buf_size], remaining - 1, // Leave space for \0 + "[%s] %s\n", + entry.type == FS_DIR_ENTRY_DIR ? "DIR " : "FILE", entry.name); + + if (len < 0) { + ret = len; + break; + } + used_buf_size += len; + } + } + + fs_closedir(&local_dirp); + + if (buf != nullptr && *buf_size > 0) { + if (used_buf_size >= *buf_size) used_buf_size = *buf_size - 1; + buf[used_buf_size] = '\0'; + } + + *buf_size = used_buf_size; + + return (ret < 0) ? ret : 0; +} + +int ModdedLogger::mkdir(const std::string &subdir) { + if (!this->mounted) return -ENODEV; + std::string abs_path = create_lfs_path(this->path, subdir); + return fs_mkdir(abs_path.c_str()); +} + +int ModdedLogger::open_file(const std::string &filename, bool write, bool append, bool create) { + if (!this->mounted || this->tracked_file.is_open) return -EBUSY; + + std::string abs_path = create_lfs_path(this->path, filename); + fs_mode_t flags = FS_O_READ; + + if (write) flags |= FS_O_WRITE; + if (append) flags |= FS_O_APPEND; + if (create) flags |= FS_O_CREATE; + + fs_file_t_init(&this->tracked_file.filep); + int ret = fs_open(&this->tracked_file.filep, abs_path.c_str(), flags); + if (ret == 0) { + this->tracked_file.is_open = true; + } + return ret; +} + +int ModdedLogger::close_file() { + if (!this->tracked_file.is_open) return 0; + int ret = fs_close(&this->tracked_file.filep); + this->tracked_file.is_open = false; + return ret; +} + +ssize_t ModdedLogger::write(const char *buf, size_t *buf_size, bool sync) { + if (!this->tracked_file.is_open) return -EINVAL; + ssize_t ret = fs_write(&this->tracked_file.filep, buf, *buf_size); + if (ret < 0) return ret; + if (sync) fs_sync(&this->tracked_file.filep); + return ret; +} + +ssize_t ModdedLogger::write(const std::string &path, const char *buf, size_t *buf_size, bool append) { + int ret = this->open_file(path, true, append, true); + if (ret) { + LOG_ERR("Failed to open file: %d", ret); + return ret; + } + ssize_t written_size = this->write(buf, buf_size); + if (written_size < 0) { + LOG_ERR("Failed to write to file: %d", written_size); + } + + ret = this->close_file(); + if (ret) { + LOG_ERR("Failed to close file: %d", ret); + return ret; + } + + return written_size; +} + +int ModdedLogger::sync() { + if (!this->tracked_file.is_open) return -EINVAL; + return fs_sync(&this->tracked_file.filep); +} + +int ModdedLogger::read(char *buf, size_t *buf_size) { + if (!this->tracked_file.is_open) return -EINVAL; + ssize_t ret = fs_read(&this->tracked_file.filep, buf, *buf_size); + if (ret < 0) return ret; + *buf_size = ret; + return 0; +} + +int ModdedLogger::open_write_close(const std::string &path, char *buf, size_t *buf_size, bool append, bool create) { + int ret = open_file(path, true, append, create); + if (ret) return ret; + + ret = write((const char*)buf, buf_size, true); + close_file(); + return ret; +} + +int ModdedLogger::open_read_close(const std::string &path, char *buf, size_t *buf_size) { + int ret = open_file(path, false, false, false); + if (ret) return ret; + + ret = read(buf, buf_size); + close_file(); + return ret; +} + +int ModdedLogger::rm(const std::string &path) { + if (!this->mounted) return -ENODEV; + std::string abs_path = create_lfs_path(this->path, path); + return fs_unlink(abs_path.c_str()); +} + +bool ModdedLogger::is_mounted() const { + return this->mounted; +} \ No newline at end of file diff --git a/src/ModdedLogger/ModdedLogger.h b/src/ModdedLogger/ModdedLogger.h new file mode 100644 index 00000000..346c266d --- /dev/null +++ b/src/ModdedLogger/ModdedLogger.h @@ -0,0 +1,57 @@ +#ifndef MODDED_LOGGER_H +#define MODDED_LOGGER_H + +#include +#include +#include + +struct tracked_fs_file_t { + struct fs_file_t filep; + bool is_open; +}; + +class ModdedLogger { +public: + ModdedLogger(); + ~ModdedLogger(); + + int mount(); + int unmount(); + + int cd(const std::string &path); + int ls(char *buf, size_t *buf_size); + int mkdir(const std::string &path); + int open_file(const std::string &path, bool write, bool append, bool create); + int close_file(); + + ssize_t write(const char *buf, size_t *buf_size, bool sync = false); + ssize_t write(const std::string &path, const char *buf, size_t *buf_size, bool append = false); + + int sync(); + int read(char *buf, size_t *buf_size); + int rm(const std::string &path); + bool is_mounted() const; + + int open_write_close(const std::string &path, char *buf, size_t *buf_size, + bool append = false, bool create = false); + int open_read_close(const std::string &path, char *buf, size_t *buf_size); + + /* --- Flash Logging Methods --- */ + int log_flash_err(const char* input); + int log_flash_dbg(const char* input); + int log_flash_wrn(const char* input); + int log_flash_inf(const char* input); + + +private: + std::string path; + bool mounted = false; + struct fs_dir_t dirp; + + fs_mount_t mnt; + struct tracked_fs_file_t tracked_file = { + .is_open = false, + }; +}; + +#endif // MODDED_LOGGER_H \ No newline at end of file diff --git a/src/ModdedLogger/modded_logger_wrapper.cpp b/src/ModdedLogger/modded_logger_wrapper.cpp new file mode 100644 index 00000000..daa554e5 --- /dev/null +++ b/src/ModdedLogger/modded_logger_wrapper.cpp @@ -0,0 +1,112 @@ +#include "modded_logger_wrapper.h" +#include "ModdedLogger.h" + +extern "C" { + +modded_logger_t modded_logger_create(void) { + return new ModdedLogger(); +} + +void modded_logger_destroy(modded_logger_t logger) { + if (logger != nullptr) { + delete static_cast(logger); + } +} + +int modded_logger_mount(modded_logger_t logger) { + if (!logger) return -1; + return static_cast(logger)->mount(); +} + +int modded_logger_unmount(modded_logger_t logger) { + if (!logger) return -1; + return static_cast(logger)->unmount(); +} + +bool modded_logger_is_mounted(modded_logger_t logger) { + if (!logger) return false; + return static_cast(logger)->is_mounted(); +} + +int modded_logger_cd(modded_logger_t logger, const char *path) { + if (!logger || !path) return -1; + return static_cast(logger)->cd(std::string(path)); +} + +int modded_logger_ls(modded_logger_t logger, char *buf, size_t *buf_size) { + if (!logger) return -1; + return static_cast(logger)->ls(buf, buf_size); +} + +int modded_logger_mkdir(modded_logger_t logger, const char *path) { + if (!logger || !path) return -1; + return static_cast(logger)->mkdir(std::string(path)); +} + +int modded_logger_rm(modded_logger_t logger, const char *path) { + if (!logger || !path) return -1; + return static_cast(logger)->rm(std::string(path)); +} + +int modded_logger_open_file(modded_logger_t logger, const char *path, bool write, bool append, bool create) { + if (!logger || !path) return -1; + return static_cast(logger)->open_file(std::string(path), write, append, create); +} + +int modded_logger_close_file(modded_logger_t logger) { + if (!logger) return -1; + return static_cast(logger)->close_file(); +} + +int modded_logger_sync(modded_logger_t logger) { + if (!logger) return -1; + return static_cast(logger)->sync(); +} + +int modded_logger_read(modded_logger_t logger, char *buf, size_t *buf_size) { + if (!logger) return -1; + return static_cast(logger)->read(buf, buf_size); +} + +ssize_t modded_logger_write(modded_logger_t logger, const char *buf, size_t *buf_size, bool sync) { + if (!logger) return -1; + return static_cast(logger)->write(buf, buf_size, sync); +} + +ssize_t modded_logger_write_path(modded_logger_t logger, const char *path, const char *buf, size_t *buf_size, bool append) { + if (!logger || !path) return -1; + return static_cast(logger)->write(std::string(path), buf, buf_size, append); +} + +int modded_logger_open_write_close(modded_logger_t logger, const char *path, char *buf, size_t *buf_size, bool append, bool create) { + if (!logger || !path) return -1; + return static_cast(logger)->open_write_close(std::string(path), buf, buf_size, append, create); +} + +int modded_logger_open_read_close(modded_logger_t logger, const char *path, char *buf, size_t *buf_size) { + if (!logger || !path) return -1; + return static_cast(logger)->open_read_close(std::string(path), buf, buf_size); +} + + +int modded_logger_log_err(modded_logger_t logger, const char* input) { + if (!logger || !input) return -1; + return static_cast(logger)->log_flash_err(input); +} + +int modded_logger_log_dbg(modded_logger_t logger, const char* input) { + if (!logger || !input) return -1; + return static_cast(logger)->log_flash_dbg(input); +} + +int modded_logger_log_wrn(modded_logger_t logger, const char* input) { + if (!logger || !input) return -1; + return static_cast(logger)->log_flash_wrn(input); +} + +int modded_logger_log_inf(modded_logger_t logger, const char* input) { + if (!logger || !input) return -1; + return static_cast(logger)->log_flash_inf(input); +} + +} // extern "C" \ No newline at end of file diff --git a/src/ModdedLogger/modded_logger_wrapper.h b/src/ModdedLogger/modded_logger_wrapper.h new file mode 100644 index 00000000..f4e901b6 --- /dev/null +++ b/src/ModdedLogger/modded_logger_wrapper.h @@ -0,0 +1,47 @@ +#ifndef MODDED_LOGGER_WRAPPER_H +#define MODDED_LOGGER_WRAPPER_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* modded_logger_t; + +modded_logger_t modded_logger_create(void); +void modded_logger_destroy(modded_logger_t logger); + +int modded_logger_mount(modded_logger_t logger); +int modded_logger_unmount(modded_logger_t logger); +bool modded_logger_is_mounted(modded_logger_t logger); + +int modded_logger_cd(modded_logger_t logger, const char *path); +int modded_logger_ls(modded_logger_t logger, char *buf, size_t *buf_size); +int modded_logger_mkdir(modded_logger_t logger, const char *path); +int modded_logger_rm(modded_logger_t logger, const char *path); + +int modded_logger_open_file(modded_logger_t logger, const char *path, bool write, bool append, bool create); +int modded_logger_close_file(modded_logger_t logger); +int modded_logger_sync(modded_logger_t logger); +int modded_logger_read(modded_logger_t logger, char *buf, size_t *buf_size); + +ssize_t modded_logger_write(modded_logger_t logger, const char *buf, size_t *buf_size, bool sync); +ssize_t modded_logger_write_path(modded_logger_t logger, const char *path, const char *buf, size_t *buf_size, bool append); + +int modded_logger_open_write_close(modded_logger_t logger, const char *path, char *buf, size_t *buf_size, bool append, bool create); +int modded_logger_open_read_close(modded_logger_t logger, const char *path, char *buf, size_t *buf_size); + +/* --- Flash Logging Methods --- */ +int modded_logger_log_err(modded_logger_t logger, const char* input); +int modded_logger_log_dbg(modded_logger_t logger, const char* input); +int modded_logger_log_wrn(modded_logger_t logger, const char* input); +int modded_logger_log_inf(modded_logger_t logger, const char* input); + +#ifdef __cplusplus +} +#endif + +#endif /* MODDED_LOGGER_WRAPPER_H */ \ No newline at end of file From 0f5992974dec16caf5601a02bc47e5a23a08ee8e Mon Sep 17 00:00:00 2001 From: Alireza Habibi <79379836+habibialireza@users.noreply.github.com> Date: Wed, 22 Apr 2026 20:10:11 +0200 Subject: [PATCH 2/3] Add files via upload --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffa4b8fa..43b0383b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ zephyr_library_include_directories( src/SD_Card/SDLogger src/SD_Card/Benchmark src/SD_Card/SD_Card_Manager - src/time_sync + src/ModdedLogger ) zephyr_library_include_directories(app PRIVATE @@ -75,7 +75,7 @@ add_subdirectory(src/SensorManager) add_subdirectory(src/SD_Card/SDLogger) add_subdirectory(src/SD_Card/Benchmark) add_subdirectory(src/SD_Card/SD_Card_Manager) -add_subdirectory(src/time_sync) +add_subdirectory(src/ModdedLogger) ## Cirrus Logic if (CONFIG_HW_CODEC_CIRRUS_LOGIC) From ace7b2b9ff88b86264d34eb143d9fe133865cb54 Mon Sep 17 00:00:00 2001 From: Alireza Habibi <79379836+habibialireza@users.noreply.github.com> Date: Wed, 22 Apr 2026 20:14:30 +0200 Subject: [PATCH 3/3] Add files via upload --- unicast_server/main.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/unicast_server/main.cpp b/unicast_server/main.cpp index ed11507c..b7aee13a 100644 --- a/unicast_server/main.cpp +++ b/unicast_server/main.cpp @@ -32,8 +32,6 @@ #include "SensorScheme.h" #include "DefaultSensors.h" -#include "time_sync.h" - #include "../src/SD_Card/SDLogger/SDLogger.h" #include "uicr.h" @@ -42,9 +40,6 @@ #include "bt_mgmt.h" -#include "bt_mgmt_conn_interval.h" -#include "conn_interval/conn_intvl_linear.h" - //#include "sd_card.h" #include @@ -55,6 +50,8 @@ LOG_MODULE_REGISTER(main, CONFIG_MAIN_LOG_LEVEL); /* STEP 5.4 - Include header for USB */ #include +/*custom logging*/ +#include "../src/ModdedLogger/ModdedLogger.h" int main(void) { int ret; @@ -63,9 +60,13 @@ int main(void) { ret = power_manager.begin(); ERR_CHK(ret); - uint8_t standalone = uicr_standalone_get(); + //Logging to flash + ModdedLogger logger; + logger.log_flash_inf("Logging to flash with ModdedLogger"); + + //LOG_INF("flash from dk"); LOG_INF("Standalone mode: %i", standalone); /*sdcard_manager.init(); @@ -120,15 +121,6 @@ int main(void) { ret = init_sensor_service(); ERR_CHK(ret); - bt_mgmt_conn_interval_init(new ConnIntvlLinear( - 4, // linear increase step (8ms units) - CONFIG_BLE_ACL_CONN_INTERVAL, - CONFIG_BLE_ACL_CONN_INTERVAL_SLOW - )); - - ret = init_time_sync(); - ERR_CHK(ret); - // error test //long *a = nullptr; //*a = 10;