Make header structure compatible with simulator
Currently, the generated Makefile doesn't successfully compile. But it is possible to run the simulator again by manually editing the Makefile.
This commit is contained in:
@ -5,10 +5,11 @@
|
||||
#include "gui/containers/DriverViewFieldSelection.hpp"
|
||||
#include "touchgfx/Unicode.hpp"
|
||||
#include "touchgfx/containers/scrollers/DrawableList.hpp"
|
||||
#include "vehicle.h"
|
||||
#include <gui/driverview_screen/DriverViewPresenter.hpp>
|
||||
#include <gui_generated/driverview_screen/DriverViewViewBase.hpp>
|
||||
|
||||
#include "vehicle_state.h"
|
||||
|
||||
enum class DriverViewProgressType { PRECHARGE, R2D };
|
||||
|
||||
class DriverViewView : public DriverViewViewBase {
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
#define MODEL_HPP
|
||||
|
||||
#include "stw_defines.h"
|
||||
#include "vehicle.h"
|
||||
#include "vehicle_state.h"
|
||||
|
||||
class ModelListener;
|
||||
|
||||
class Model {
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
#include <gui/ami_screen/AMIPresenter.hpp>
|
||||
#include <gui/ami_screen/AMIView.hpp>
|
||||
|
||||
#include "main.h"
|
||||
#include "vehicle.h"
|
||||
#include "vehicle_state.h"
|
||||
|
||||
AMIPresenter::AMIPresenter(AMIView &v) : view(v) {}
|
||||
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
#include "gui/common/NamedField.hpp"
|
||||
#include "texts/TextKeysAndLanguages.hpp"
|
||||
|
||||
#include "params.h"
|
||||
#include "touchgfx/Unicode.hpp"
|
||||
#include "vehicle.h"
|
||||
|
||||
#include "params.h"
|
||||
#include "vehicle_state.h"
|
||||
|
||||
#define VEH_FIELD(FIELD) []() { return (void *)&vehicle_state.FIELD; }
|
||||
#define VEH_BIT_FIELD(FIELD) \
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
#include <gui/containers/DriverViewStatusItem.hpp>
|
||||
|
||||
#include "texts/TextKeysAndLanguages.hpp"
|
||||
#include "vehicle.h"
|
||||
|
||||
#include "vehicle_state.h"
|
||||
|
||||
DriverViewStatusItem::DriverViewStatusItem() {}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#include "texts/TextKeysAndLanguages.hpp"
|
||||
#include "touchgfx/Unicode.hpp"
|
||||
#include "vehicle.h"
|
||||
#include "vehicle_state.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
#include <gui/driverview_screen/DriverViewView.hpp>
|
||||
|
||||
#include "gui/common/NamedField.hpp"
|
||||
#include "vehicle.h"
|
||||
|
||||
#include "vehicle_state.h"
|
||||
|
||||
DriverViewPresenter::DriverViewPresenter(DriverViewView &v)
|
||||
: view(v), fields{DF_MinCellVolt, DF_Speed, DF_MaxCellTemp} {}
|
||||
|
||||
@ -6,10 +6,12 @@
|
||||
#include "touchgfx/Callback.hpp"
|
||||
#include "touchgfx/Drawable.hpp"
|
||||
#include "touchgfx/Unicode.hpp"
|
||||
#include "vehicle.h"
|
||||
#include <gui/driverview_screen/DriverViewView.hpp>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
#include "vehicle_state.h"
|
||||
|
||||
DriverViewView::DriverViewView()
|
||||
: fieldTypes{DF_MinCellVolt, DF_Speed, DF_TSCurrent} {}
|
||||
@ -87,16 +89,16 @@ void DriverViewView::updateStatusItems() {
|
||||
}
|
||||
|
||||
void DriverViewView::setTemps(const Temperatures &temps) {
|
||||
brakeTempFL.setTemp(roundf(temps.brake_fl));
|
||||
brakeTempFR.setTemp(roundf(temps.brake_fr));
|
||||
brakeTempRL.setTemp(roundf(temps.brake_rl));
|
||||
brakeTempRR.setTemp(roundf(temps.brake_rr));
|
||||
invTempL.setTemp(roundf(temps.inv_l));
|
||||
invTempR.setTemp(roundf(temps.inv_r));
|
||||
motorTempL.setTemp(roundf(temps.mot_l));
|
||||
motorTempR.setTemp(roundf(temps.mot_r));
|
||||
batTempL.setTemp(roundf(temps.bat_l));
|
||||
batTempR.setTemp(roundf(temps.bat_r));
|
||||
brakeTempFL.setTemp(std::round(temps.brake_fl));
|
||||
brakeTempFR.setTemp(std::round(temps.brake_fr));
|
||||
brakeTempRL.setTemp(std::round(temps.brake_rl));
|
||||
brakeTempRR.setTemp(std::round(temps.brake_rr));
|
||||
invTempL.setTemp(std::round(temps.inv_l));
|
||||
invTempR.setTemp(std::round(temps.inv_r));
|
||||
motorTempL.setTemp(std::round(temps.mot_l));
|
||||
motorTempR.setTemp(std::round(temps.mot_r));
|
||||
batTempL.setTemp(std::round(temps.bat_l));
|
||||
batTempR.setTemp(std::round(temps.bat_r));
|
||||
}
|
||||
|
||||
void DriverViewView::setTSSoC(uint8_t soc) {
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
#include "gui/common/FrontendApplication.hpp"
|
||||
#include "stw_defines.h"
|
||||
#include "touchgfx/Application.hpp"
|
||||
#include "vehicle.h"
|
||||
#include <gui/missionselect_screen/MissionSelectPresenter.hpp>
|
||||
#include <gui/missionselect_screen/MissionSelectView.hpp>
|
||||
|
||||
#include "stw_defines.h"
|
||||
#include "vehicle_state.h"
|
||||
|
||||
MissionSelectPresenter::MissionSelectPresenter(MissionSelectView &v)
|
||||
: view(v) {}
|
||||
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
#include "gui/missionselect_screen/MissionSelectPresenter.hpp"
|
||||
#include "stw_defines.h"
|
||||
#include "texts/TextKeysAndLanguages.hpp"
|
||||
#include "vehicle.h"
|
||||
#include <gui/missionselect_screen/MissionSelectView.hpp>
|
||||
|
||||
#include "stw_defines.h"
|
||||
#include "vehicle.h"
|
||||
#include "vehicle_state.h"
|
||||
|
||||
MissionSelectView::MissionSelectView()
|
||||
: selected{nullptr}, selectedMission{MISSION_NONE} {}
|
||||
|
||||
|
||||
@ -1,15 +1,19 @@
|
||||
#include <gui/model/Model.hpp>
|
||||
#include <gui/model/ModelListener.hpp>
|
||||
|
||||
Model::Model() : modelListener(0) {}
|
||||
|
||||
#ifdef SIMULATOR
|
||||
void Model::tick() { modelListener->vehicleStateUpdated(); }
|
||||
#else
|
||||
|
||||
#include "main.h"
|
||||
#include "stm32h7xx_hal.h"
|
||||
#include "stm32h7xx_hal_gpio.h"
|
||||
#include "stw_defines.h"
|
||||
#include "tx_api.h"
|
||||
#include "ui.h"
|
||||
#include "vehicle.h"
|
||||
|
||||
#include <gui/model/Model.hpp>
|
||||
#include <gui/model/ModelListener.hpp>
|
||||
|
||||
Model::Model() : modelListener(0) {}
|
||||
#include "vehicle_state.h"
|
||||
|
||||
void Model::tick() {
|
||||
ULONG events;
|
||||
@ -25,3 +29,5 @@ void Model::tick() {
|
||||
modelListener->vehicleStateUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SIMULATOR
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
#include "gui/common/NamedField.hpp"
|
||||
#include "gui/containers/ConfigItem.hpp"
|
||||
#include "main.h"
|
||||
#include "params.h"
|
||||
#include <cstdint>
|
||||
#include <gui/vehicleconfig_screen/VehicleConfigView.hpp>
|
||||
@ -76,7 +75,7 @@ void VehicleConfigView::updateSelectedParam(int select) {
|
||||
int16_t firstVisible = firstItem->getType();
|
||||
int16_t lastVisible = lastItem->getType();
|
||||
if (lastVisible < firstVisible) {
|
||||
Error_Handler();
|
||||
return;
|
||||
}
|
||||
int16_t numVisible = lastVisible - firstVisible + 1;
|
||||
if (selectedParam >= firstVisible && selectedParam <= lastVisible) {
|
||||
|
||||
@ -1,44 +1,58 @@
|
||||
#include <platform/hal/simulator/sdl2/HALSDL2.hpp>
|
||||
#include <touchgfx/hal/NoDMA.hpp>
|
||||
#include "gui/model/Model.hpp"
|
||||
#include "params.h"
|
||||
#include "vehicle.h"
|
||||
#include "vehicle_state.h"
|
||||
#include <common/TouchGFXInit.hpp>
|
||||
#include <gui_generated/common/SimConstants.hpp>
|
||||
#include <platform/driver/touch/SDL2TouchController.hpp>
|
||||
#include <touchgfx/lcd/LCD.hpp>
|
||||
#include <stdlib.h>
|
||||
#include <platform/hal/simulator/sdl2/HALSDL2.hpp>
|
||||
#include <simulator/mainBase.hpp>
|
||||
#include <stdlib.h>
|
||||
#include <touchgfx/hal/NoDMA.hpp>
|
||||
#include <touchgfx/lcd/LCD.hpp>
|
||||
|
||||
using namespace touchgfx;
|
||||
|
||||
#ifdef __linux__
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int main(int argc, char **argv) {
|
||||
#else
|
||||
#include <shellapi.h>
|
||||
#ifdef _UNICODE
|
||||
#error Cannot run in unicode mode
|
||||
#endif
|
||||
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
int argc;
|
||||
char** argv = touchgfx::HALSDL2::getArgv(&argc);
|
||||
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine, int nCmdShow) {
|
||||
int argc;
|
||||
char **argv = touchgfx::HALSDL2::getArgv(&argc);
|
||||
#endif
|
||||
|
||||
touchgfx::NoDMA dma; //For windows/linux, DMA transfers are simulated
|
||||
LCD& lcd = setupLCD();
|
||||
touchgfx::SDL2TouchController tc;
|
||||
touchgfx::NoDMA dma; // For windows/linux, DMA transfers are simulated
|
||||
LCD &lcd = setupLCD();
|
||||
touchgfx::SDL2TouchController tc;
|
||||
|
||||
touchgfx::HAL& hal = touchgfx::touchgfx_generic_init<touchgfx::HALSDL2>(dma, lcd, tc, SIM_WIDTH, SIM_HEIGHT, 0, 0);
|
||||
touchgfx::HAL &hal = touchgfx::touchgfx_generic_init<touchgfx::HALSDL2>(
|
||||
dma, lcd, tc, SIM_WIDTH, SIM_HEIGHT, 0, 0);
|
||||
|
||||
setupSimulator(argc, argv, hal);
|
||||
setupSimulator(argc, argv, hal);
|
||||
|
||||
// Ensure there is a console window to print to using printf() or
|
||||
// std::cout, and read from using e.g. fgets or std::cin.
|
||||
// Alternatively, instead of using printf(), always use
|
||||
// touchgfx_printf() which will ensure there is a console to write
|
||||
// to.
|
||||
//touchgfx_enable_stdio();
|
||||
// Ensure there is a console window to print to using printf() or
|
||||
// std::cout, and read from using e.g. fgets or std::cin.
|
||||
// Alternatively, instead of using printf(), always use
|
||||
// touchgfx_printf() which will ensure there is a console to write
|
||||
// to.
|
||||
// touchgfx_enable_stdio();
|
||||
|
||||
touchgfx::HAL::getInstance()->taskEntry(); //Never returns
|
||||
touchgfx::HAL::getInstance()->taskEntry(); // Never returns
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// Stubs
|
||||
extern "C" {
|
||||
VehicleState vehicle_state;
|
||||
void params_dec(ParamType param) {}
|
||||
void params_inc(ParamType param) {}
|
||||
void params_broadcast(ParamType param) {}
|
||||
void vehicle_select_mission(Mission mission) {}
|
||||
Params params;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user