From 891587c5430e7fb256f62a334fa52aa70336c4ec Mon Sep 17 00:00:00 2001 From: Sidi Liang <1467329765@qq.com> Date: Wed, 21 Apr 2021 17:17:59 +0800 Subject: [PATCH] AEB: optimaization at radar initialization --- Nasal/radar.nas | 6 +++--- Nasal/systems.nas | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Nasal/radar.nas b/Nasal/radar.nas index 30f67aa..6770090 100644 --- a/Nasal/radar.nas +++ b/Nasal/radar.nas @@ -119,7 +119,7 @@ var Radar = { }, initialized: 0, - running: 0, + isRunning: 0, debug: 0,#if debug = 1, shows marker and prints info warnEnabled: 1,#1 enables the internal warning system(typecally used for a parking radar) as 0 disables it @@ -197,7 +197,7 @@ var Radar = { if(me.warnEnabled and me.warningTimer == nil) me.warningTimer = maketimer(me.warningInterval, func me.warn()); me.radarTimer.start(); me.multiplayerManager.start(); - me.running = 1; + me.isRunning = 1; if(me.warnEnabled){ print("Parking radar started!"); playAudio("parking_radar_init.wav"); @@ -206,7 +206,7 @@ var Radar = { } }, stop: func(){ - me.running = 0; + me.isRunning = 0; if(me.warnEnabled){ print("Parking radar stopped!"); #playAudio("parking_radar_init.wav"); diff --git a/Nasal/systems.nas b/Nasal/systems.nas index b55a9d8..795709f 100644 --- a/Nasal/systems.nas +++ b/Nasal/systems.nas @@ -587,7 +587,7 @@ var Safety = { enableFrontRadar: func(){ #Enables the front radar me.frontRadarEnabled = 1; - me.frontRadar.init(); + me.frontRadar.initWithoutStarting(); me.frontRadar.stop(); me.aebOnProp.setValue(1); print("Front radar(AEB) enabled"); @@ -687,7 +687,7 @@ var Safety = { if(currentSpeed > 30 and engine.engine_1.getDirection() == 1){ #Enable AEB when speed is greater then 30kmh and in D gear if(me.frontRadarEnabled){ - me.frontRadar.init(); + if(!me.frontRadar.isRunning) me.frontRadar.start(); if(currentSpeed >= 48 and me.aebMode == 1) me.aebFastMode(); else if(currentSpeed < 48 and me.aebMode == 2) me.aebSlowMode();#//Adjust mode dynamically according to speed