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 "vehicle.h"
|
||||||
|
|
||||||
#include "can-halal.h"
|
#include "can-halal.h"
|
||||||
|
#include "config.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "stm32h7xx.h"
|
#include "stm32h7xx.h"
|
||||||
#include "stm32h7xx_hal.h"
|
#include "stm32h7xx_hal.h"
|
||||||
@ -78,6 +79,17 @@ void vehicle_thread_entry(ULONG hfdcan_addr) {
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
tx_thread_sleep(10);
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "gui/common/NamedField.hpp"
|
#include "gui/common/NamedField.hpp"
|
||||||
|
|
||||||
|
#include "../../Core/Inc/config.h"
|
||||||
|
|
||||||
FrontendApplication::FrontendApplication(Model &m, FrontendHeap &heap)
|
FrontendApplication::FrontendApplication(Model &m, FrontendHeap &heap)
|
||||||
: FrontendApplicationBase(m, heap), canChangeFromMissionSelect(false) {
|
: FrontendApplicationBase(m, heap), canChangeFromMissionSelect(false) {
|
||||||
namedFieldSort();
|
namedFieldSort();
|
||||||
@ -14,5 +16,8 @@ void FrontendApplication::setCanChangeFromMissionSelect(
|
|||||||
|
|
||||||
// controls if next screen button works on mission select screen
|
// controls if next screen button works on mission select screen
|
||||||
bool FrontendApplication::getCanChangeFromMissionSelect() const {
|
bool FrontendApplication::getCanChangeFromMissionSelect() const {
|
||||||
|
#ifdef DEMO_MODE
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
return canChangeFromMissionSelect;
|
return canChangeFromMissionSelect;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#include "texts/TextKeysAndLanguages.hpp"
|
#include "texts/TextKeysAndLanguages.hpp"
|
||||||
#include <gui/missionselect_screen/MissionSelectView.hpp>
|
#include <gui/missionselect_screen/MissionSelectView.hpp>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "stw_defines.h"
|
#include "stw_defines.h"
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
#include "vehicle_state.h"
|
#include "vehicle_state.h"
|
||||||
@ -54,6 +55,12 @@ void MissionSelectView::confirmMission() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vehicle_select_mission(selectedMission);
|
vehicle_select_mission(selectedMission);
|
||||||
|
|
||||||
|
#ifdef DEMO_MODE
|
||||||
|
vehicle_state.active_mission = selectedMission;
|
||||||
|
presenter->vehicleStateUpdated();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
vehicle_state.active_mission = selectedMission;
|
vehicle_state.active_mission = selectedMission;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user