Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

USEE-HeadUpDisplay project

Rank

Total Posts: 1

Joined 2024-01-19

PM

My old USEE hud needs a new purpose of use. So I took a nrf53840-Dongle and flashed the BSC-TX-sample to the Dongle. The HUD shows the simulated speed from the domgle. My aim is, to transmit the speed-information from an GPS-Sensor over an ESP32 to the Dongle. My problem is, that obviously the Simulator in the bsc-sample overwrites my speed-Information in bsc.page1. Is there any solution possible? I can't deaktivate the simulater, because he is apparently doing much more than filling the speed-information. Here is my timeout-handler: // In timeout_handler():
static void timeout_handler(struct k_timer *timer_id) {
bsc.BSC_PROFILE_operating_time++;
LOG_INF("speed_updated = %d", speed_updated); // JEDEN Durchlauf loggen
if (speed_updated) {
LOG_INF("!!! VERARBEITE GPS: %.2f km/h !!!", (double)current_speed);
// 1. Umrechnung: km/h -> m/s
float speed_mps = current_speed * 1000.0f / 3600.0f;

// 2. Radumfang (m) - Ihr Wert 2.1m
float wheel_circumference = 2.105f;

// 3. Berechne Umdrehungen pro Sekunde
float revs_per_sec = speed_mps / wheel_circumference;

// 4. Berechne die Zeit zwischen zwei Umdrehungen in 1/2000 Sekunden
uint16_t event_time = 0xFFFF;
if (revs_per_sec > 0.01f) {
// Nur bei ausreichender Geschwindigkeit berechnen
float time_between_revs_ms = 1000.0f / revs_per_sec; // in ms
event_time = (uint16_t)(time_between_revs_ms * 2.0f); // 1/2000s Einheiten
if (event_time > 0xFFFF) event_time = 0xFFFF;
}

// 5. Inkrementiere die Gesamtumdrehungen
static uint32_t total_revs = 0;
total_revs += (uint32_t)(revs_per_sec * 0.25f * 100); // 0.25s pro Tick

// 6. Page 0 befüllen (HIER ist die Korrektur!)
bsc.page_0.rev_count = total_revs;
bsc.page_0.event_time = event_time;

/*// Stop-Indikator in Page 5 (falls vorhanden)
if (revs_per_sec <= 0.01f) {
bsc.page_5.stop_indicator = 1;
} else {
bsc.page_5.stop_indicator = 0;
}
*/

LOG_INF("GPS: %.2f km/h -> Revs: %u, Time: %u",
(double)current_speed, total_revs, event_time);

speed_updated = false;
} else {
ant_bsc_simulator_one_iteration(&bsc;_simulator);
}
}

Sorry, my english isn't trained the last years. Thanks for help.