[WIP] SDC screen
This hasn't really been tested yet and sometimes looks weird.
This commit is contained in:
		
							
								
								
									
										39
									
								
								TouchGFX/gui/include/gui/sdc_screen/SDCPresenter.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								TouchGFX/gui/include/gui/sdc_screen/SDCPresenter.hpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,39 @@
 | 
			
		||||
#ifndef SDCPRESENTER_HPP
 | 
			
		||||
#define SDCPRESENTER_HPP
 | 
			
		||||
 | 
			
		||||
#include <gui/model/ModelListener.hpp>
 | 
			
		||||
#include <mvp/Presenter.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace touchgfx;
 | 
			
		||||
 | 
			
		||||
class SDCView;
 | 
			
		||||
 | 
			
		||||
class SDCPresenter : public touchgfx::Presenter, public ModelListener {
 | 
			
		||||
public:
 | 
			
		||||
  SDCPresenter(SDCView &v);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The activate function is called automatically when this screen is "switched
 | 
			
		||||
   * in" (ie. made active). Initialization logic can be placed here.
 | 
			
		||||
   */
 | 
			
		||||
  virtual void activate() override;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The deactivate function is called automatically when this screen is
 | 
			
		||||
   * "switched out" (ie. made inactive). Teardown functionality can be placed
 | 
			
		||||
   * here.
 | 
			
		||||
   */
 | 
			
		||||
  virtual void deactivate() override;
 | 
			
		||||
 | 
			
		||||
  virtual ~SDCPresenter() {}
 | 
			
		||||
 | 
			
		||||
  void vehicleStateUpdated() override;
 | 
			
		||||
  void nextScreen() override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  SDCPresenter();
 | 
			
		||||
 | 
			
		||||
  SDCView &view;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // SDCPRESENTER_HPP
 | 
			
		||||
							
								
								
									
										33
									
								
								TouchGFX/gui/include/gui/sdc_screen/SDCView.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								TouchGFX/gui/include/gui/sdc_screen/SDCView.hpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,33 @@
 | 
			
		||||
#ifndef SDCVIEW_HPP
 | 
			
		||||
#define SDCVIEW_HPP
 | 
			
		||||
 | 
			
		||||
#include "gui/containers/DriverViewStatusItem.hpp"
 | 
			
		||||
#include "touchgfx/Color.hpp"
 | 
			
		||||
#include "touchgfx/hal/Types.hpp"
 | 
			
		||||
#include <gui/sdc_screen/SDCPresenter.hpp>
 | 
			
		||||
#include <gui_generated/sdc_screen/SDCViewBase.hpp>
 | 
			
		||||
 | 
			
		||||
class SDCView : public SDCViewBase {
 | 
			
		||||
public:
 | 
			
		||||
  SDCView();
 | 
			
		||||
  virtual ~SDCView() {}
 | 
			
		||||
  virtual void setupScreen();
 | 
			
		||||
  virtual void tearDownScreen();
 | 
			
		||||
 | 
			
		||||
  void setPDUClosed(bool closed);
 | 
			
		||||
  void setInertiaClosed(bool closed);
 | 
			
		||||
  void setIMDClosed(bool closed);
 | 
			
		||||
  void setAMSClosed(bool closed);
 | 
			
		||||
  void setSDCLClosed(bool closed);
 | 
			
		||||
  void setHVBClosed(bool closed);
 | 
			
		||||
  void setTSMSClosed(bool closed);
 | 
			
		||||
  void setAccClosed(bool closed);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  inline touchgfx::colortype getColor(bool closed) {
 | 
			
		||||
    return closed ? DriverViewStatusItem::COLOR_OK
 | 
			
		||||
                  : DriverViewStatusItem::COLOR_ERROR;
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // SDCVIEW_HPP
 | 
			
		||||
@ -37,5 +37,5 @@ void AMIPresenter::vehicleStateUpdated() {
 | 
			
		||||
void AMIPresenter::nextScreen() {
 | 
			
		||||
  FrontendApplication *app =
 | 
			
		||||
      static_cast<FrontendApplication *>(FrontendApplication::getInstance());
 | 
			
		||||
  app->gotoDebugViewScreenNoTransition();
 | 
			
		||||
  app->gotoSDCScreenNoTransition();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										27
									
								
								TouchGFX/gui/src/sdc_screen/SDCPresenter.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								TouchGFX/gui/src/sdc_screen/SDCPresenter.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,27 @@
 | 
			
		||||
#include "gui/common/FrontendApplication.hpp"
 | 
			
		||||
#include "vehicle_state.h"
 | 
			
		||||
#include <gui/sdc_screen/SDCPresenter.hpp>
 | 
			
		||||
#include <gui/sdc_screen/SDCView.hpp>
 | 
			
		||||
 | 
			
		||||
SDCPresenter::SDCPresenter(SDCView &v) : view(v) {}
 | 
			
		||||
 | 
			
		||||
void SDCPresenter::activate() { vehicleStateUpdated(); }
 | 
			
		||||
 | 
			
		||||
void SDCPresenter::deactivate() {}
 | 
			
		||||
 | 
			
		||||
void SDCPresenter::vehicleStateUpdated() {
 | 
			
		||||
  view.setPDUClosed(vehicle_state.pdu_sdc_active);
 | 
			
		||||
  view.setInertiaClosed(vehicle_state.sdcl_state[1]);
 | 
			
		||||
  view.setIMDClosed(vehicle_state.imd_ok);
 | 
			
		||||
  view.setAMSClosed(vehicle_state.ts_state != TS_ERROR);
 | 
			
		||||
  view.setSDCLClosed(vehicle_state.sdcl_state[0]);
 | 
			
		||||
  view.setHVBClosed(vehicle_state.sdcl_state[2]);
 | 
			
		||||
  view.setTSMSClosed(true);
 | 
			
		||||
  view.setAccClosed(vehicle_state.sdc_closed);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SDCPresenter::nextScreen() {
 | 
			
		||||
  FrontendApplication *app =
 | 
			
		||||
      static_cast<FrontendApplication *>(FrontendApplication::getInstance());
 | 
			
		||||
  app->gotoDebugViewScreenNoTransition();
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										26
									
								
								TouchGFX/gui/src/sdc_screen/SDCView.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								TouchGFX/gui/src/sdc_screen/SDCView.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,26 @@
 | 
			
		||||
#include "gui/driverview_screen/DriverViewView.hpp"
 | 
			
		||||
#include <gui/sdc_screen/SDCView.hpp>
 | 
			
		||||
 | 
			
		||||
SDCView::SDCView() {}
 | 
			
		||||
 | 
			
		||||
void SDCView::setupScreen() { SDCViewBase::setupScreen(); }
 | 
			
		||||
 | 
			
		||||
void SDCView::tearDownScreen() { SDCViewBase::tearDownScreen(); }
 | 
			
		||||
 | 
			
		||||
void SDCView::setPDUClosed(bool closed) { pdu.setColor(getColor(closed)); }
 | 
			
		||||
 | 
			
		||||
void SDCView::setInertiaClosed(bool closed) {
 | 
			
		||||
  inertia.setColor(getColor(closed));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SDCView::setIMDClosed(bool closed) { imd.setColor(getColor(closed)); }
 | 
			
		||||
 | 
			
		||||
void SDCView::setAMSClosed(bool closed) { ams.setColor(getColor(closed)); }
 | 
			
		||||
 | 
			
		||||
void SDCView::setSDCLClosed(bool closed) { sdcl.setColor(getColor(closed)); }
 | 
			
		||||
 | 
			
		||||
void SDCView::setHVBClosed(bool closed) { hvb.setColor(getColor(closed)); }
 | 
			
		||||
 | 
			
		||||
void SDCView::setTSMSClosed(bool closed) { tsms.setColor(getColor(closed)); }
 | 
			
		||||
 | 
			
		||||
void SDCView::setAccClosed(bool closed) { acc.setColor(getColor(closed)); }
 | 
			
		||||
@ -11,7 +11,7 @@ void VehicleConfigPresenter::deactivate() {}
 | 
			
		||||
 | 
			
		||||
void VehicleConfigPresenter::nextScreen() {
 | 
			
		||||
  static_cast<FrontendApplication *>(Application::getInstance())
 | 
			
		||||
      ->gotoDebugViewScreenNoTransition();
 | 
			
		||||
      ->gotoSDCScreenNoTransition();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VehicleConfigPresenter::paramConfirmed() {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user