Nasal: minor fixes

This commit is contained in:
Sidi Liang 2021-06-22 00:55:00 +08:00
parent 850fafed3d
commit 2e50a9ad8c
No known key found for this signature in database
GPG Key ID: 9785F5EECFFA5311
2 changed files with 12 additions and 12 deletions

View File

@ -22,21 +22,21 @@ var autoHoldMainLoop = func(){
if(!door1.getpos() and !door2.getpos() and !door3.getpos() and !door4.getpos() and engineNode.getValue()){
followme.brakeController.applyBrakes(1);
working = 1;
workingNode.setValue(1);
workingNode.setIntValue(1);
}else{
stopAndSwitchToParking();
}
}else if(!math.round(currentSpeed)){
followme.brakeController.applyBrakes(0);
working = 0;
workingNode.setValue(0);
workingNode.setIntValue(0);
}
}
}
var stopAndSwitchToParking = func(){
followme.brakeController.applyBrakes(0);
working = 0;
workingNode.setValue(0);
workingNode.setIntValue(0);
followme.brakeController.enableHandBrake();
}
@ -45,17 +45,17 @@ var autoHoldTimer = maketimer(0.05,autoHoldMainLoop);
var startAutoHold = func(){
autoHoldTimer.start();
active = 1;
activeNode.setValue(1);
activeNode.setIntValue(1);
}
var stopAutoHold = func(){
active = 0;
activeNode.setValue(0);
activeNode.setIntValue(0);
autoHoldTimer.stop();
currentSpeed = speedNode.getValue();
if(followme.brakeController.applyingFeetBrake){
working = 0;
workingNode.setValue(0);
workingNode.setIntValue(0);
followme.brakeController.applyBrakes(0);
}else if(!math.round(currentSpeed)){
stopAndSwitchToParking();

View File

@ -551,7 +551,7 @@ var Safety = {
me.aebEnabled = 1;
me.frontRadar.initWithoutStarting();
#//me.frontRadar.stop();
me.aebOnProp.setValue(1);
me.aebOnProp.setIntValue(1);
print("AEB enabled");
},
disableAEB: func(){
@ -559,7 +559,7 @@ var Safety = {
me.aebTimer.stop();
if(me.aebEnabled) me.frontRadar.stop();
me.aebEnabled = 0;
me.aebOnProp.setValue(0);
me.aebOnProp.setIntValue(0);
print("AEB disabled");
},
toggleAEB: func(){
@ -583,9 +583,9 @@ var Safety = {
print("AEB Slow Mode");
},
aebFastMode: func(){
me.frontRadar.maxRange = 18;
me.frontRadar.maxRange = 20;
#me.frontRadar.maxWidth = 0.05;
me.aebThreshold = 18;
me.aebThreshold = 20;
me.aebFullThreshold = 16;
me.aebMode = 2;
print("AEB Fast Mode");
@ -653,7 +653,7 @@ var Safety = {
if(currentSpeed <= 0){
me.aebStop();
#print("1");
}else if(me.aebCount >= 20){
}else if(me.aebCount >= 15){
me.aebStop();
#print("2");
}
@ -664,7 +664,7 @@ var Safety = {
if(currentSpeed <= 0){
me.aebStop();
#print("11");
}else if(me.aebCount >= 20){
}else if(me.aebCount >= 15){
me.aebStop();
#print("22");
}