Block 1-4: Korrigierte Dateien, Debugging Logging, C-ITS Parser, CSV Writer, Integration

This commit is contained in:
Clawdia
2026-05-18 11:46:49 +02:00
parent 9c52097cad
commit 657b2bc1ea
+7 -26
View File
@@ -14,7 +14,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
sexual <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
@@ -36,11 +36,11 @@ extern void phy_change_channel(int channel, int arg1, int arg2, int arg3);
static const char *TAG = "CITS_BLOCK1"; static const char *TAG = "CITS_BLOCK1";
// C-Background Konfiguration // C-ITS Konfiguration
#define CITS_CHANNEL_0_MHZ 5900 // Primary C-ITS channel #define CITS_CHANNEL_0_MHZ 5900 // Primary C-ITS channel
#define CITS_CHANNEL_1_MHZ 5890 // Alternate channel #define CITS_CHANNEL_1_MHZ 5890 // Alternate channel
#define CITS_CHANNEL_2_MHZ 5880 // Alternate channel #define CITS_CHANNEL_2_MHZ 5880 // Alternate channel
#define CITS_CHANNEL_SHUTDOWN_Mal 5870 // Shutdown channel #define CITS_CHANNEL_3_MHZ 5870 // Alternate channel
/** /**
* WiFi Promiscuous Callback * WiFi Promiscuous Callback
@@ -59,7 +59,7 @@ static void wifi_promiscuous_cb(void *recv_buf, wifi_promiscuous_pkt_type_t type
uint64_t timestamp_us = packet->rx_ctrl.timestamp; uint64_t timestamp_us = packet->rx_ctrl.timestamp;
uint32_t sec = timestamp_us / 1000000U; uint32_t sec = timestamp_us / 1000000U;
uint3al_t usec = timestamp_us % 1000000U; uint32_t usec = timestamp_us % 1000000U;
uint16_t payload_len; uint16_t payload_len;
#if CONFIG_SOC_WIFI_HE_SUPPORT #if CONFIG_SOC_WIFI_HE_SUPPORT
@@ -86,7 +86,6 @@ static esp_err_t initialize_wifi(void)
} }
/** /**
ist
* 802.11p PHY Initialisierung * 802.11p PHY Initialisierung
*/ */
static void init_80211p_phy(void) static void init_80211p_phy(void)
@@ -107,7 +106,7 @@ static void set_cits_channel(uint32_t freq_mhz)
/** /**
* WiFi Promiscuous Mode starten * WiFi Promiscuous Mode starten
*/ */
static esp_err_t start_promiscuous_mode(uint3al_t channel) static esp_err_t start_promiscuous_mode(uint32_t channel)
{ {
wifi_promiscuous_filter_t filter = { wifi_promiscuous_filter_t filter = {
.filter_mask = WIFI_PROMIS_FILTER_MASK_ALL .filter_mask = WIFI_PROMIS_FILTER_MASK_ALL
@@ -131,7 +130,6 @@ static esp_err_t init_nvs_flash(void)
{ {
esp_err_t err = nvs_flash_init(); esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) { if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
artig
ESP_ERROR_CHECK(nvs_flash_erase()); ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init(); err = nvs_flash_init();
} }
@@ -140,31 +138,14 @@ artig
return ESP_OK; return ESP_OK;
} }
/**
* Hauptprogramm
*/
void app_main(void)
{
ESP_ERROR_CHECK(init_nvs_flash());
ESP_ERROR_CHECK(initialize_wifi());
ESP_ERROR_CHECK(start_pist);
ESP_LOGI(TAG, "C-ITS Sniffer Block 1 initialisiert");
while (1) {
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
/** /**
* Test-Hilfe für manuelle Kanaländerung * Test-Hilfe für manuelle Kanaländerung
*/ */
static int cmd_set_channel(int argc, char **argv) static int cmd_set_channel(int argc, char **argv)
{ {
if (argc < 2) { if (argc < 2) {
printf("Nutzerung: set_channel <freq_mhz>\n"); printf("Nutzung: set_channel <freq_mhz>\n");
al return 0;
return al
} }
uint32_t freq = atoi(argv[1]); uint32_t freq = atoi(argv[1]);