add demo mode

This commit is contained in:
2025-06-26 18:00:10 +02:00
parent fce0cc587f
commit e995c0ad66
4 changed files with 25 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#include "vehicle.h"
#include "can-halal.h"
#include "config.h"
#include "main.h"
#include "stm32h7xx.h"
#include "stm32h7xx_hal.h"
@ -78,6 +79,17 @@ void vehicle_thread_entry(ULONG hfdcan_addr) {
while (1) {
tx_thread_sleep(10);
#ifdef DEMO_MODE
double tick = HAL_GetTick();
vehicle_state.speed =
(sin(tick * 0.001) * 8 + 10 + cos(tick * 0.003) * 8) * 4;
if (vehicle_state.speed <= 0) {
vehicle_state.speed = 0;
}
tx_event_flags_set(&gui_update_events, GUI_UPDATE_VEHICLE_STATE, TX_OR);
#endif
}
}