add demo mode
This commit is contained in:
1
Core/Inc/config.h
Normal file
1
Core/Inc/config.h
Normal file
@ -0,0 +1 @@
|
||||
// #define DEMO_MODE
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user