mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-07-01 21:25:11 +00:00
update open trunk example (#13)
This commit is contained in:
@@ -108,7 +108,7 @@ void CConsole::PrintHeader(uint32_t uiInstance)
|
||||
PrintText(g_sSeparator4, "============================================================================");
|
||||
PrintText(g_sComment1, "The Open Trunk signal has a safety request.");
|
||||
PrintText(g_sComment2, "Therefore the speed value is required and must be checked.");
|
||||
PrintText(g_sComment3, "If the car is moving the open trunk is blocked.");
|
||||
PrintText(g_sComment3, "If the car is moving, open is blocked and trunk is closed automatically.");
|
||||
PrintText(g_sSeparator5, "============================================================================");
|
||||
PrintText(g_sOpenViaDevice, "Vehicle Device Interface not available.");
|
||||
PrintText(g_sOpenViaService, "Basic Service Interface not available.");
|
||||
@@ -237,11 +237,18 @@ void CConsole::WriteSpeed(float value)
|
||||
|
||||
void CConsole::SetSpeed(float value)
|
||||
{
|
||||
const bool bIsMoving = (value > 0.0F);
|
||||
if (m_SpeedBS != value)
|
||||
{
|
||||
m_SpeedBS = value;
|
||||
PrintValue(g_sBasicServiceSpeed, "Vehicle Speed RX", m_SpeedBS, "km/h");
|
||||
}
|
||||
|
||||
if (bIsMoving && !m_bWasMovingBS)
|
||||
{
|
||||
PrintText(g_sOpenViaService, "Safety active: speed > 0, trunk close command sent.");
|
||||
}
|
||||
m_bWasMovingBS = bIsMoving;
|
||||
}
|
||||
|
||||
bool CConsole::KeyHit()
|
||||
@@ -310,7 +317,7 @@ void CConsole::RunUntilBreak()
|
||||
if (m_pTrunkService)
|
||||
{
|
||||
if (m_pTrunkService->SetOpen(true))
|
||||
PrintText(g_sOpenViaService, "Trunk opened safely.");
|
||||
PrintText(g_sOpenViaService, "Trunk opened safely (auto-close if vehicle starts moving).");
|
||||
else
|
||||
PrintText(g_sOpenViaService, "Open trunk failed, car is moving.");
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ private:
|
||||
float m_SpeedDL = 0.0; ///< Speed Data Link
|
||||
float m_SpeedVD = 0.0; ///< Speed Vehicle Device
|
||||
float m_SpeedBS = 0.0; ///< Speed Basic Service
|
||||
bool m_bWasMovingBS = false; ///< Transition flag for movement status.
|
||||
|
||||
vss::Vehicle::Body::TrunkService::IVSS_SetOpen* m_pTrunkService = nullptr; ///< trunk (basic service)
|
||||
vss::Vehicle::Body::TrunkDevice::IVSS_WriteOpen* m_pTrunkDevice = nullptr; ///< trunk (vehicle device)
|
||||
|
||||
Reference in New Issue
Block a user