Audio added to firmware, Website File handling

This commit is contained in:
2026-04-01 16:06:40 +02:00
parent 01448223ad
commit 947346777f
22 changed files with 951 additions and 123 deletions

View File

@@ -3,12 +3,14 @@
#include <string.h>
#include "fs_mgmt.h"
#include "ble_mgmt.h"
#include "buzz_proto.h"
#include "fw_mgmt.h"
#include "audio.h"
LOG_MODULE_REGISTER(main);
#if IS_ENABLED(CONFIG_BLE_MGMT)
#include "ble_mgmt.h"
void ble_rx_cb(const uint8_t *data, uint16_t len)
{
uint8_t *buf;
@@ -42,32 +44,27 @@ void ble_rx_cb(const uint8_t *data, uint16_t len)
buzz_proto_buf_free(&buf); /* Speicher bei Fehler sofort wieder freigeben */
}
}
#endif
int main(void)
{
uint8_t hw_id[8];
LOG_INF("Starting app version %s (state: 0x%02x zephyr %s) on %s (Rev: %s, SOC: %s)", fw_mgmt_get_fw_version_string(), fw_mgmt_get_fw_state(), fw_mgmt_get_kernel_version_string(), fw_mgmt_get_board_name(), strlen(fw_mgmt_get_board_revision()) ? fw_mgmt_get_board_revision() : "N/A", fw_mgmt_get_soc_name());
if (fw_mgmt_get_id(hw_id, sizeof(hw_id)) >= 0) {
LOG_INF("Device EUI64: %02X%02X-%02X%02X-%02X%02X-%02X%02X", hw_id[0], hw_id[1], hw_id[2], hw_id[3], hw_id[4], hw_id[5], hw_id[6], hw_id[7]);
} else {
LOG_ERR("Failed to get device ID");
}
int rc;
rc = fs_mgmt_init();
if (rc < 0) {
LOG_ERR("Failed to initialize file system management: %d", rc);
return rc;
}
#if IS_ENABLED(CONFIG_BLE_MGMT)
/* BLE-Subsystem initialisieren und RX-Callback registrieren */
rc = ble_mgmt_init(ble_rx_cb, CONFIG_BLE_MGMT_DEFAULT_DEVICE_NAME);
int rc = ble_mgmt_init(ble_rx_cb, CONFIG_BLE_MGMT_DEFAULT_DEVICE_NAME);
if (rc < 0) {
LOG_ERR("Failed to initialize BLE management: %d", rc);
return rc;
}
#endif
LOG_INF("Init complete");
LOG_INF("Init complete. Starting audio playback test...");
k_sleep(K_SECONDS(1));
audio_queue_play("/lfs/sys/update", false);
k_sleep(K_SECONDS(1));
audio_start_random_playback(); // Starte die Wiedergabe eines zufälligen Sounds
k_sleep(K_SECONDS(1));
audio_queue_play("/lfs/sys/404", true);
k_sleep(K_FOREVER);
}