Sync while working on OT
All checks were successful
Deploy Docs / build-and-deploy (push) Successful in 12s
All checks were successful
Deploy Docs / build-and-deploy (push) Successful in 12s
This commit is contained in:
@@ -1,43 +1,29 @@
|
||||
# Console and Logging
|
||||
CONFIG_LOG=y
|
||||
|
||||
# UART basics
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
|
||||
# Shell and Built-in Commands
|
||||
CONFIG_SHELL=y
|
||||
CONFIG_DEVICE_SHELL=n
|
||||
CONFIG_DEVMEM_SHELL=n
|
||||
# Shell configuration
|
||||
CONFIG_SHELL_BACKEND_SERIAL=y
|
||||
CONFIG_FILE_SYSTEM_SHELL=y
|
||||
|
||||
# Stack protection
|
||||
CONFIG_HW_STACK_PROTECTION=y
|
||||
CONFIG_STACK_SENTINEL=y
|
||||
|
||||
# --- STACK SIZE UPDATES (Fixes the MPU/Stack Fault) ---
|
||||
CONFIG_MAIN_STACK_SIZE=4096
|
||||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
|
||||
CONFIG_BT_RX_STACK_SIZE=4096
|
||||
|
||||
# Storage and Settings (NVS)
|
||||
CONFIG_FLASH=y
|
||||
CONFIG_FLASH_MAP=y
|
||||
CONFIG_NVS=y
|
||||
CONFIG_SETTINGS=y
|
||||
|
||||
# --- CoAP & UDP Features ---
|
||||
CONFIG_OPENTHREAD_COAP=y
|
||||
CONFIG_OPENTHREAD_MANUAL_START=y
|
||||
|
||||
# Bluetooth
|
||||
CONFIG_BT=y
|
||||
CONFIG_BT_PERIPHERAL=y
|
||||
CONFIG_BT_DEVICE_NAME="Lasertag-Device"
|
||||
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
|
||||
CONFIG_BT_L2CAP_TX_MTU=252
|
||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||
CONFIG_BT_BUF_ACL_RX_SIZE=251
|
||||
CONFIG_BT_ATT_PREPARE_COUNT=5
|
||||
CONFIG_BT_LOG_LEVEL_WRN=y
|
||||
|
||||
# Enable Lasertag Shared Modules
|
||||
CONFIG_LASERTAG_UTILS=y
|
||||
# Lasertag-specific configuration
|
||||
CONFIG_BLE_MGMT=y
|
||||
CONFIG_GAME_MGMT=y
|
||||
CONFIG_GAME_MGMT_SHELL=y
|
||||
CONFIG_GAME_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_THREAD_MGMT=y
|
||||
CONFIG_THREAD_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_BLE_MGMT=y
|
||||
CONFIG_BLE_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_GAME_MGMT=y
|
||||
CONFIG_THREAD_MGMT_SHELL=y
|
||||
CONFIG_FS_MGMT=y
|
||||
CONFIG_FS_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_AUDIO_LOG_LEVEL_DBG=y
|
||||
|
||||
CONFIG_LASERTAG_ROLE_LEADER=y
|
||||
|
||||
CONFIG_ENTROPY_GENERATOR=y
|
||||
@@ -1,52 +1,56 @@
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <lasertag_utils.h>
|
||||
#include <thread_mgmt.h>
|
||||
#include <ble_mgmt.h>
|
||||
#include <game_mgmt.h>
|
||||
#include <lasertag_utils.h>
|
||||
#include <fs_mgmt.h>
|
||||
#include <audio.h>
|
||||
#include <zephyr/random/random.h>
|
||||
|
||||
LOG_MODULE_REGISTER(leader_app, CONFIG_LOG_DEFAULT_LEVEL);
|
||||
LOG_MODULE_REGISTER(OT_SAMPLE, LOG_LEVEL_INF);
|
||||
|
||||
uint64_t generate_64bit_random(void) {
|
||||
uint64_t rnd_val;
|
||||
|
||||
/* Füllt den Speicherbereich der Variable mit Zufallsbytes */
|
||||
sys_csrand_get(&rnd_val, sizeof(rnd_val));
|
||||
|
||||
return rnd_val;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Initialize shared project logic and NVS */
|
||||
LOG_INF("Starting Thread Management test application...");
|
||||
lasertag_utils_init();
|
||||
|
||||
/* Initialize and start BLE management for provisioning */
|
||||
int err = ble_mgmt_init(LT_TYPE_LEADER);
|
||||
if (err) {
|
||||
LOG_ERR("BLE initialization failed (err %d)", err);
|
||||
return err;
|
||||
} else {
|
||||
LOG_INF("BLE Management initialized successfully.");
|
||||
int rc = thread_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Thread management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF("Thread management initialized successfully.");
|
||||
|
||||
/* Initialize and start OpenThread stack */
|
||||
err = thread_mgmt_init();
|
||||
if (err) {
|
||||
LOG_ERR("Thread initialization failed (err %d)", err);
|
||||
return err;
|
||||
} else {
|
||||
LOG_INF("Leader Application successfully started with Thread Mesh.");
|
||||
rc = fs_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("File system management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF("File system management initialized successfully.");
|
||||
|
||||
/* Start BLE advertising */
|
||||
err = ble_mgmt_adv_start();
|
||||
if (err) {
|
||||
LOG_ERR("BLE advertising start failed (err %d)", err);
|
||||
return err;
|
||||
} else {
|
||||
LOG_INF("BLE advertising started.");
|
||||
rc = audio_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Audio initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF("Audio initialized successfully.");
|
||||
|
||||
/* Initialize game management module */
|
||||
err = game_mgmt_init();
|
||||
if (err) {
|
||||
LOG_ERR("Game Management initialization failed (err %d)", err);
|
||||
return err;
|
||||
} else {
|
||||
LOG_INF("Game Management initialized successfully.");
|
||||
rc = game_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Game management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF(FORMAT_BRIGHT("Game management initialized successfully. Switching to LOBBY state..."));
|
||||
game_mgmt_set_game_id(generate_64bit_random()); /* Set a dummy game ID for testing */
|
||||
game_mgmt_set_state(SYS_STATE_LOBBY);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user