From 676e77ef09afa3e41cab6e8e6fdf1875d73204e9 Mon Sep 17 00:00:00 2001 From: Sidi Liang <1467329765@qq.com> Date: Mon, 16 Aug 2021 20:24:24 +0800 Subject: [PATCH] Smart Instruments: Bug fix --- Nasal/SmartInstruments.nas | 6 +++--- Nasal/engine.nas | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Nasal/SmartInstruments.nas b/Nasal/SmartInstruments.nas index d86ec89..ebab611 100644 --- a/Nasal/SmartInstruments.nas +++ b/Nasal/SmartInstruments.nas @@ -54,7 +54,7 @@ var SmartInstruments = { .show(); m.warningText = m.group.createChild("text", "optional-id-for element") .setTranslation(530, 140) # The origin is in the top left corner - .setAlignment("left-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext) + .setAlignment("center-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext) .setFont("ExoRegular-ymMe.ttf") # Fonts are loaded either from $AIRCRAFT_DIR/Fonts or $FG_ROOT/Fonts .setFontSize(50) # Set fontsize and optionally character aspect ratio .setColor(1,0,0) # Text color @@ -193,7 +193,7 @@ var SmartInstruments = { #//Warning MESSAGE if(me.showingWarningMessage){ - if(math.mod(me.loopCount, 10) == 0){ + if(math.mod(me.loopCount, 10) < 5){ me.warningText.show(); }else{ me.warningText.hide(); @@ -209,7 +209,7 @@ var SmartInstruments = { me.initialized = 1; }, startUp:func(){ - me.welcomeGroup.show(); + if(!me.showingWarningMessage) me.welcomeGroup.show(); var startScreenTimer = maketimer(1, func me.startSequence()); startScreenTimer.singleShot = 1; startScreenTimer.start(); diff --git a/Nasal/engine.nas b/Nasal/engine.nas index 5c3dc11..f7256cc 100644 --- a/Nasal/engine.nas +++ b/Nasal/engine.nas @@ -170,6 +170,8 @@ var Engine = { me.stopEngine(); print("No Power"); me.errorMessage = "NO POWER"; + #//To be improved + smartInstruments.smartInstruments.showWarningMessage(me.errorMessage); return 0; }else{ me.errorMessage = nil; @@ -328,6 +330,7 @@ var startEngine = func(my_engine){ }else{ print("Engine start failed"); my_engine.errorMessage = "START FAIL"; + smartInstruments.smartInstruments.showWarningMessage(my_engine.errorMessage); } }else if(followme.chargeTimer.isRunning){