Browse Source

end code for deactivate system aux and power system, add dock status in Orbiter to PIGOU

Valentin 2 years ago
parent
commit
74f6d3a6f7
25 changed files with 200 additions and 91 deletions
  1. 9 2
      OrbiterLua/Script/pigou.lua
  2. 5 0
      Pigou/src/fr/deltastar/pigou/model/panel/module/airlock/UndockModule.java
  3. 8 3
      Pigou/src/fr/deltastar/pigou/model/panel/module/engine/MainDumpModule.java
  4. 5 3
      Pigou/src/fr/deltastar/pigou/model/panel/module/engine/MainValveModule.java
  5. 8 3
      Pigou/src/fr/deltastar/pigou/model/panel/module/engine/RcsDumpModule.java
  6. 3 2
      Pigou/src/fr/deltastar/pigou/model/panel/module/engine/RcsValveModule.java
  7. 4 2
      Pigou/src/fr/deltastar/pigou/model/panel/module/engine/SupplyModule.java
  8. 2 2
      Pigou/src/fr/deltastar/pigou/model/panel/module/lifepack/LifePackModule.java
  9. 2 2
      Pigou/src/fr/deltastar/pigou/model/panel/module/lifepack/SupplyModule.java
  10. 6 2
      Pigou/src/fr/deltastar/pigou/model/panel/module/power/AirlockPowerModule.java
  11. 8 4
      Pigou/src/fr/deltastar/pigou/model/panel/module/power/ApuModule.java
  12. 6 2
      Pigou/src/fr/deltastar/pigou/model/panel/module/power/ComputerPowerModule.java
  13. 6 2
      Pigou/src/fr/deltastar/pigou/model/panel/module/power/EnginePowerModule.java
  14. 6 2
      Pigou/src/fr/deltastar/pigou/model/panel/module/power/HudPowerModule.java
  15. 6 2
      Pigou/src/fr/deltastar/pigou/model/panel/module/power/LifePackPowerModule.java
  16. 8 0
      Pigou/src/fr/deltastar/pigou/model/panel/module/power/StarterModule.java
  17. 3 6
      Pigou/src/fr/deltastar/pigou/model/panel/system/AirlockSystem.java
  18. 4 1
      Pigou/src/fr/deltastar/pigou/model/panel/system/ComputerSystem.java
  19. 16 1
      Pigou/src/fr/deltastar/pigou/model/panel/system/EngineSystem.java
  20. 3 1
      Pigou/src/fr/deltastar/pigou/model/panel/system/HudSystem.java
  21. 47 40
      Pigou/src/fr/deltastar/pigou/model/panel/system/LifePackSystem.java
  22. 22 5
      Pigou/src/fr/deltastar/pigou/model/panel/system/PowerSystem.java
  23. 13 4
      Pigou/src/fr/deltastar/pigou/service/OrbiterService.java
  24. BIN
      panel/avancé programme/navigation.jpg
  25. BIN
      panel/avancé programme/panel electrique.jpg

+ 9 - 2
OrbiterLua/Script/pigou.lua

@@ -34,6 +34,7 @@ tcp:settimeout(0)
 local v = vessel.get_interface('GL-01') --préciser le nom du vaisseau
 local vMainFuel = v:get_propellanthandle(0) --réservoir principal
 local vRcsFuel = v:get_propellanthandle(1) --réservoir RCS
+portDock = v:get_dockhandle(0) --objet du port de docking du vaisseau
 --variable de controle blocage des réservoirs
 local currentFuelMain = 0
 local currentFuelRcs = 0
@@ -261,10 +262,16 @@ repeat
 		output = output .. round(v:get_propellantmass(vMainFuel))
 	end
 	if fuelRcsIsLock == 1 then
-		output = output .. "," .. currentFuelRcs .. "\n"
+		output = output .. "," .. currentFuelRcs
 	else
-		output = output .. "," .. round(v:get_propellantmass(vRcsFuel)) .. "\n"
+		output = output .. "," .. round(v:get_propellantmass(vRcsFuel))
 	end
+	--etat du docking si le vaiseau est arrimé
+	local isDock = 1
+	if (v:get_dockstatus(portDock) == nil) then
+		isDock = 0
+	end
+	output = output .. "," .. isDock .. "\n"
 	tcp:send(output)
 
 	--en seconde précise le temps d'accorder du temps au simulateur

+ 5 - 0
Pigou/src/fr/deltastar/pigou/model/panel/module/airlock/UndockModule.java

@@ -22,6 +22,10 @@ public class UndockModule implements ModuleInterface {
         this.ledRed = new Component(ComponentConstants.OUTPUT, "Led red");
         this.button = new Component(ComponentConstants.INPUT, "Undock - Big button");
     }
+
+    public Component getLedRed() {
+        return ledRed;
+    }
     
     @Override
     public List<Component> getListComponents() {
@@ -35,6 +39,7 @@ public class UndockModule implements ModuleInterface {
     public void onAction(boolean activate) {
         if (DeltaStar.getAirlockSystem().isOnline()) {
             ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_CMD, CmdOrbiterConstants.OPTION_DEDOCK);
+            this.ledRed.switchOff();
         }
     }
 

+ 8 - 3
Pigou/src/fr/deltastar/pigou/model/panel/module/engine/MainDumpModule.java

@@ -17,10 +17,12 @@ public class MainDumpModule implements ModuleInterface {
 
     private Component ledGreen;
     private Component switchOnOff;
+    private boolean isDump;
 
     public MainDumpModule() {
         this.ledGreen = new Component(ComponentConstants.OUTPUT, "Led green");
         this.switchOnOff = new Component(ComponentConstants.INPUT, "Main dump - Switch");
+        this.isDump = false;
     }
     
     @Override
@@ -34,11 +36,14 @@ public class MainDumpModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getEngineSystem().isOnline()) {
-            ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELDUMP, CmdOrbiterConstants.OPTION_MAIN);
-            if (activate) {
+            if (activate && !this.isDump) {
+                this.isDump = true;
                 this.ledGreen.switchBlink();
-            } else {
+                ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELDUMP, CmdOrbiterConstants.OPTION_MAIN);
+            } else if (this.isDump) {
+                this.isDump = false;
                 this.ledGreen.switchOff();
+                ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELDUMP, CmdOrbiterConstants.OPTION_MAIN);
             }
         }
     }

+ 5 - 3
Pigou/src/fr/deltastar/pigou/model/panel/module/engine/MainValveModule.java

@@ -22,6 +22,7 @@ public class MainValveModule implements ModuleInterface {
     public MainValveModule() {
         this.ledGreen = new Component(ComponentConstants.OUTPUT, "Led green");
         this.switchOnOff = new Component(ComponentConstants.INPUT, "Main valve - Switch");
+        this.isSupply = false;
     }
     
     public boolean isSupply() {
@@ -39,13 +40,14 @@ public class MainValveModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getEngineSystem().getSupplyModule().isConnected()) {
-            ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELSUPPLY, CmdOrbiterConstants.OPTION_MAIN);
-            if (activate) {
+            if (activate && !this.isSupply) {
                 this.ledGreen.switchOn();
                 this.isSupply = true;
-            } else {
+                ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELSUPPLY, CmdOrbiterConstants.OPTION_MAIN);
+            } else if (this.isSupply) {
                 this.ledGreen.switchOff();
                 this.isSupply = false;
+                ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELSUPPLY, CmdOrbiterConstants.OPTION_MAIN);
             }
         }
     }

+ 8 - 3
Pigou/src/fr/deltastar/pigou/model/panel/module/engine/RcsDumpModule.java

@@ -17,10 +17,12 @@ public class RcsDumpModule implements ModuleInterface {
 
     private Component ledGreen;
     private Component switchOnOff;
+    private boolean isDump;
 
     public RcsDumpModule() {
         this.ledGreen = new Component(ComponentConstants.OUTPUT, "Led green");
         this.switchOnOff = new Component(ComponentConstants.INPUT, "RCS dump - Switch");
+        this.isDump = false;
     }
     
     @Override
@@ -34,11 +36,14 @@ public class RcsDumpModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getEngineSystem().isOnline()) {
-            ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELDUMP, CmdOrbiterConstants.OPTION_RCS);
-            if (activate) {
+            if (activate && !this.isDump) {
+                this.isDump = true;
                 this.ledGreen.switchBlink();
-            } else {
+                ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELDUMP, CmdOrbiterConstants.OPTION_RCS);
+            } else if (this.isDump) {
+                this.isDump = false;
                 this.ledGreen.switchOff();
+                ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELDUMP, CmdOrbiterConstants.OPTION_RCS);
             }
         }
     }

+ 3 - 2
Pigou/src/fr/deltastar/pigou/model/panel/module/engine/RcsValveModule.java

@@ -22,6 +22,7 @@ public class RcsValveModule implements ModuleInterface {
     public RcsValveModule() {
         this.ledGreen = new Component(ComponentConstants.OUTPUT, "Led green");
         this.switchOnOff = new Component(ComponentConstants.INPUT, "RCS valve - Switch");
+        this.isSupply = false;
     }
 
     public boolean isSupply() {
@@ -40,10 +41,10 @@ public class RcsValveModule implements ModuleInterface {
     public void onAction(boolean activate) {
         if (DeltaStar.getEngineSystem().getSupplyModule().isConnected()) {
             ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELSUPPLY, CmdOrbiterConstants.OPTION_RCS);
-            if (activate) {
+            if (activate && !this.isSupply) {
                 this.ledGreen.switchOn();
                 this.isSupply = true;
-            } else {
+            } else if (this.isSupply) {
                 this.ledGreen.switchOff();
                 this.isSupply = false;
             }

+ 4 - 2
Pigou/src/fr/deltastar/pigou/model/panel/module/engine/SupplyModule.java

@@ -1,6 +1,5 @@
 package fr.deltastar.pigou.model.panel.module.engine;
 
-import fr.deltastar.pigou.constant.CmdOrbiterConstants;
 import fr.deltastar.pigou.constant.SoundConstants;
 import fr.deltastar.pigou.model.constant.ComponentConstants;
 import fr.deltastar.pigou.model.panel.Component;
@@ -32,6 +31,10 @@ public class SupplyModule implements ModuleInterface {
     public void setIsConnected(boolean isConnected) {
         this.isConnected = isConnected;
     }
+
+    public Component getLedGreen() {
+        return ledGreen;
+    }
     
     @Override
     public List<Component> getListComponents() {
@@ -51,7 +54,6 @@ public class SupplyModule implements ModuleInterface {
             } else if (!DeltaStar.getEngineSystem().getMainValveModule().isSupply() && !DeltaStar.getEngineSystem().getRcsValveModule().isSupply()) {
                 this.ledGreen.switchOff();
                 this.isConnected = false;
-                ServicePigou.getSoundService().play(SoundConstants.SUPPLY_CONNECT);
             }
         }
     }

+ 2 - 2
Pigou/src/fr/deltastar/pigou/model/panel/module/lifepack/LifePackModule.java

@@ -37,11 +37,11 @@ public class LifePackModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getLifePackSystem().isOnline()) {
-            if (activate && this.isOnline == false) {
+            if (activate && !this.isOnline) {
                 this.isOnline = true;
                 this.ledGreen.switchOn();
                 DeltaStar.getLifePackSystem().launchProcessusO2N2();
-            } else if (this.isOnline == true) {
+            } else if (this.isOnline) {
                 DeltaStar.getLifePackSystem().stopProcessusO2N2();
                 this.isOnline = false;
                 this.ledGreen.switchOff();

+ 2 - 2
Pigou/src/fr/deltastar/pigou/model/panel/module/lifepack/SupplyModule.java

@@ -44,7 +44,7 @@ public class SupplyModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getLifePackSystem().isOnline() && ServicePigou.getOrbiterService().isLanding()) {
-            if (activate && this.isConnected == false) {
+            if (activate && !this.isConnected) {
                 this.ledGreen.switchOn();
                 this.isConnected = true;
                 ServicePigou.getSoundService().play(SoundConstants.SUPPLY_CONNECT);
@@ -63,7 +63,7 @@ public class SupplyModule implements ModuleInterface {
                     }
                 });
                 this.processusSupply.start();
-            } else if (this.isConnected == true) {
+            } else if (this.isConnected) {
                 this.processusSupply.stop();
                 this.ledGreen.switchOff();
                 this.isConnected = false;

+ 6 - 2
Pigou/src/fr/deltastar/pigou/model/panel/module/power/AirlockPowerModule.java

@@ -17,10 +17,12 @@ public class AirlockPowerModule implements ModuleInterface {
 
     private Component ledGreen;
     private Component switchOnOff;
+    private boolean isOn;
 
     public AirlockPowerModule() {
         this.ledGreen = new Component(ComponentConstants.OUTPUT, "Led green");
         this.switchOnOff = new Component(ComponentConstants.INPUT, "Airlock power - Switch");
+        this.isOn = false;
     }
 
     public Component getLedGreen() {
@@ -38,9 +40,11 @@ public class AirlockPowerModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getPowerSystem().isOnline()) {
-            if (activate) {
+            if (activate && !this.isOn) {
+                this.isOn = true;
                 DeltaStar.getAirlockSystem().onActivateSystem();
-            } else {
+            } else if (this.isOn) {
+                this.isOn = false;
                 DeltaStar.getAirlockSystem().onDeactivateSystem();
             }
         } else {

+ 8 - 4
Pigou/src/fr/deltastar/pigou/model/panel/module/power/ApuModule.java

@@ -60,8 +60,8 @@ public class ApuModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         //si système non activé ou EPU non branché on bloque
-        if (DeltaStar.getPowerSystem().getEpuModule().isConnected() && DeltaStar.getPowerSystem().getStarterModule().isIsOnline()) {
-            if (activate) {
+        if (DeltaStar.getPowerSystem().getStarterModule().isIsOnline()) {
+            if (activate && !DeltaStar.getPowerSystem().isOnline() && DeltaStar.getPowerSystem().getEpuModule().isConnected()) {
                 ServicePigou.getSoundService().play(SoundConstants.APU_START);
                 DeltaStar.getPowerSystem().getArduinoComLcd().setLcdMod(LcdSystemPowerConstants.APU_IN_PROGRESS);
                 this.ledRed.switchOff();
@@ -80,8 +80,12 @@ public class ApuModule implements ModuleInterface {
                         }
                     }
                 }).start();
-            } else {
-
+            } else if (DeltaStar.getPowerSystem().isOnline()) {
+                ServicePigou.getSoundService().stop(SoundConstants.MAIN_AMBIANCE);
+                ServicePigou.getSoundService().play(SoundConstants.APU_STOP);
+                this.ledGreen.switchOff();
+                this.ledRed.switchOn();
+                DeltaStar.getPowerSystem().onDeactivateSystem();
             }
         } else {
             ServicePigou.getSoundService().play(SoundConstants.BAD_ACTION);

+ 6 - 2
Pigou/src/fr/deltastar/pigou/model/panel/module/power/ComputerPowerModule.java

@@ -17,10 +17,12 @@ public class ComputerPowerModule implements ModuleInterface {
 
     private Component ledGreen;
     private Component switchOnOff;
+    private boolean isOn;
 
     public ComputerPowerModule() {
         this.ledGreen = new Component(ComponentConstants.OUTPUT, "Led green");
         this.switchOnOff = new Component(ComponentConstants.INPUT, "Computer power - Switch");
+        this.isOn = false;
     }
     
     @Override
@@ -34,9 +36,11 @@ public class ComputerPowerModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getPowerSystem().isOnline()) {
-            if (activate) {
+            if (activate && !this.isOn) {
+                this.isOn = true;
                 DeltaStar.getComputerSystem().onActivateSystem();
-            } else {
+            } else if (this.isOn) {
+                this.isOn = false;
                 DeltaStar.getComputerSystem().onDeactivateSystem();
             }
         } else {

+ 6 - 2
Pigou/src/fr/deltastar/pigou/model/panel/module/power/EnginePowerModule.java

@@ -17,10 +17,12 @@ public class EnginePowerModule implements ModuleInterface {
 
     private Component ledGreen;
     private Component switchOnOff;
+    private boolean isOn;
 
     public EnginePowerModule() {
         this.ledGreen = new Component(ComponentConstants.OUTPUT, "Led green");
         this.switchOnOff = new Component(ComponentConstants.INPUT, "Engine power - Switch");
+        this.isOn = false;
     }
 
     public Component getLedGreen() {
@@ -38,9 +40,11 @@ public class EnginePowerModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getPowerSystem().isOnline()) {
-            if (activate) {
+            if (activate && !this.isOn) {
+                this.isOn = true;
                 DeltaStar.getEngineSystem().onActivateSystem();
-            } else {
+            } else if (this.isOn) {
+                this.isOn = false;
                 DeltaStar.getEngineSystem().onDeactivateSystem();
             }
         } else {

+ 6 - 2
Pigou/src/fr/deltastar/pigou/model/panel/module/power/HudPowerModule.java

@@ -17,10 +17,12 @@ public class HudPowerModule implements ModuleInterface {
 
     private Component ledGreen;
     private Component switchOnOff;
+    private boolean isOn;
 
     public HudPowerModule() {
         this.ledGreen = new Component(ComponentConstants.OUTPUT, "Led green");
         this.switchOnOff = new Component(ComponentConstants.INPUT, "HUD power - Switch");
+        this.isOn = false;
     }
 
     public Component getLedGreen() {
@@ -38,9 +40,11 @@ public class HudPowerModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getPowerSystem().isOnline()) {
-            if (activate) {
+            if (activate && !this.isOn) {
+                this.isOn = true;
                 DeltaStar.getHudSystem().onActivateSystem();
-            } else {
+            } else if (this.isOn) {
+                this.isOn = false;
                 DeltaStar.getHudSystem().onDeactivateSystem();
             }
         } else {

+ 6 - 2
Pigou/src/fr/deltastar/pigou/model/panel/module/power/LifePackPowerModule.java

@@ -17,10 +17,12 @@ public class LifePackPowerModule implements ModuleInterface {
 
     private Component ledGreen;
     private Component switchOnOff;
+    private boolean isOn;
 
     public LifePackPowerModule() {
         this.ledGreen = new Component(ComponentConstants.OUTPUT, "Led green");
         this.switchOnOff = new Component(ComponentConstants.INPUT, "Life-pack power - Switch");
+        this.isOn = false;
     }
 
     public Component getLedGreen() {
@@ -38,9 +40,11 @@ public class LifePackPowerModule implements ModuleInterface {
     @Override
     public void onAction(boolean activate) {
         if (DeltaStar.getPowerSystem().isOnline()) {
-            if (activate) {
+            if (activate && !this.isOn) {
+                this.isOn = true;
                 DeltaStar.getLifePackSystem().onActivateSystem();
-            } else {
+            } else if (this.isOn) {
+                this.isOn = false;
                 DeltaStar.getLifePackSystem().onDeactivateSystem();
             }
         } else {

+ 8 - 0
Pigou/src/fr/deltastar/pigou/model/panel/module/power/StarterModule.java

@@ -48,7 +48,15 @@ public class StarterModule implements ModuleInterface {
             //allumage led rouge apu
             ps.getApuModule().getLedRed().switchOn();
         } else {
+            //coupure de l'apu et epu si connecté
+            DeltaStar.getPowerSystem().getEpuModule().onAction(false);
+            DeltaStar.getPowerSystem().getApuModule().onAction(false);
+            //changement texte des LCD
+            ps.getArduinoComLcd().setLcdMod(LcdSystemPowerConstants.NO_DISPLAY);
+            es.getArduinoComLcd().setLcdMod(LcdSystemPowerConstants.NO_DISPLAY);
+            lps.getArduinoComLcd().setLcdMod(LcdSystemPowerConstants.NO_DISPLAY);
             this.isOnline = false;
+            DeltaStar.getPowerSystem().getApuModule().getLedRed().switchOff();
         }
     }
 

+ 3 - 6
Pigou/src/fr/deltastar/pigou/model/panel/system/AirlockSystem.java

@@ -1,16 +1,11 @@
 package fr.deltastar.pigou.model.panel.system;
 
-import fr.deltastar.pigou.constant.SoundConstants;
 import fr.deltastar.pigou.model.panel.BaseSystem;
-import fr.deltastar.pigou.model.panel.Component;
 import fr.deltastar.pigou.model.panel.DeltaStar;
 import fr.deltastar.pigou.model.panel.ModuleInterface;
 import fr.deltastar.pigou.model.panel.module.airlock.*;
-import fr.deltastar.pigou.service.ServicePigou;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 /**
  *
@@ -87,7 +82,9 @@ public class AirlockSystem extends BaseSystem {
 
     @Override
     public void onDeactivateSystem() {
-        
+        super.setIsOnline(false);
+        DeltaStar.getPowerSystem().onAuxSystem(false);
+        DeltaStar.getPowerSystem().getAirlockPowerModule().getLedGreen().switchOff();
     }
 
     @Override

+ 4 - 1
Pigou/src/fr/deltastar/pigou/model/panel/system/ComputerSystem.java

@@ -116,7 +116,10 @@ public class ComputerSystem extends BaseSystem {
 
     @Override
     public void onDeactivateSystem() {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        super.setIsOnline(false);
+        DeltaStar.getPowerSystem().onAuxSystem(false);
+        DeltaStar.getPowerSystem().getComputerPowerModule().getLedGreen().switchOff();
+        this.stopLastAp();
     }
     
     @Override

+ 16 - 1
Pigou/src/fr/deltastar/pigou/model/panel/system/EngineSystem.java

@@ -136,7 +136,22 @@ public class EngineSystem extends BaseSystem implements SystemLcdInterface {
 
     @Override
     public void onDeactivateSystem() {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        this.consoEngine.stop();
+        this.getArduinoComLcd().setLcdMod(LcdSystemEngineConstants.NO_CONNECTION_APU);
+        ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELLOCK, CmdOrbiterConstants.OPTION_MAIN);
+        ServicePigou.getOrbiterService().sendCmdToOrbiter(CmdOrbiterConstants.MODE_FUELLOCK, CmdOrbiterConstants.OPTION_RCS);
+        DeltaStar.getPowerSystem().onAuxSystem(false);
+        DeltaStar.getPowerSystem().getEnginePowerModule().getLedGreen().switchOff();
+        //coupure ravitailleur si en place
+        this.getMainValveModule().onAction(false);
+        this.getRcsValveModule().onAction(false);
+        this.getMainDumpModule().onAction(false);
+        this.getRcsDumpModule().onAction(false);
+        this.getTransfertLeftModule().onAction(false);
+        this.getTransfertRightModule().onAction(false);
+        this.getSupplyModule().onAction(false);
+        
+        super.setIsOnline(false);
     }
     
     @Override

+ 3 - 1
Pigou/src/fr/deltastar/pigou/model/panel/system/HudSystem.java

@@ -32,7 +32,9 @@ public class HudSystem extends BaseSystem {
 
     @Override
     public void onDeactivateSystem() {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        super.setIsOnline(false);
+        DeltaStar.getPowerSystem().onAuxSystem(false);
+        DeltaStar.getPowerSystem().getHudPowerModule().getLedGreen().switchOff();
     }
     
     @Override

+ 47 - 40
Pigou/src/fr/deltastar/pigou/model/panel/system/LifePackSystem.java

@@ -73,7 +73,7 @@ public class LifePackSystem extends BaseSystem implements SystemLcdInterface {
                             //si le vaisseau est pas dépendant de l'extérieur
                             if (!ServicePigou.getOrbiterService().isPossibleToLive()) {
                                 //si pas de support de survie ou plus d'oxygen/azote
-                                Thread.sleep(Constants.INTERVAL_COOLING_O2N2);
+                                Thread.sleep(Constants.INTERVAL_COOLING_O2N2 + 20000);
                                 if (valueO2N2 == 0 || !DeltaStar.getLifePackSystem().getLifePackModule().isOnline()) {
                                     DeltaStar.deadGame();
                                 }
@@ -142,7 +142,16 @@ public class LifePackSystem extends BaseSystem implements SystemLcdInterface {
 
     @Override
     public void onDeactivateSystem() {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        //coupure des systemes si actif
+        this.supplyModule.onAction(false);
+        this.lifePackModule.onAction(false);
+        this.heaterModule.getLedRedCoolerBad().switchOff();
+        this.heaterModule.getLedGreenCoolerGood().switchOff();
+        
+        DeltaStar.getPowerSystem().getLifePackPowerModule().getLedGreen().switchOff();
+        DeltaStar.getPowerSystem().onAuxSystem(false);
+        this.arduinoComLcd.setLcdMod(LcdSystemLifePackConstants.NO_CONNECTION_APU);
+        super.setIsOnline(false);
     }
     
     /**
@@ -183,49 +192,47 @@ public class LifePackSystem extends BaseSystem implements SystemLcdInterface {
      * Deviens une procédure une fois l'APU branchée
      */
     public void launchProcessusCooling() {
-        if (this.processusCooling == null) {
-            this.processusCooling = new Thread(new Runnable() {
-                @Override
-                public void run() {
-                    while (true) {                        
-                        try {
-                            Thread.sleep(Constants.INTERVAL_COOLING_O2N2);
-                            
-                            //selon si radiateur déployé
-                            if (DeltaStar.getLifePackSystem().getHeaterModule().isDeployed() && temperature >= Constants.TEMP_COOLING_MIN) {
-                                temperature -= 1;
-                            } else if (!DeltaStar.getLifePackSystem().getHeaterModule().isDeployed()) {
-                                temperature += Constants.AUGMENTATION_TEMP_COOLING;
-                            }
-                            
-                            //selon temperature atteinte on agit
-                            //seuil d'alert du systeme
-                            if (temperature >= Constants.TEMP_COOLING_ALERT_MAX && DeltaStar.getLifePackSystem().isOnline()) {
-                                if (DeltaStar.getLifePackSystem().isOnline()) {
-                                    DeltaStar.getLifePackSystem().getHeaterModule().getLedGreenCoolerGood().switchOff();
-                                    DeltaStar.getLifePackSystem().getHeaterModule().getLedRedCoolerBad().switchOn();
-                                }
-                                DeltaStar.getLifePackSystem().getArduinoComLcd().setLcdMod(LcdSystemLifePackConstants.SYSTEM_OVERHEATED);
-                                Thread.sleep(Constants.INTERVAL_COOLING_O2N2);
-                                DeltaStar.getLifePackSystem().getArduinoComLcd().setLcdMod(LcdSystemLifePackConstants.DISPLAY_O2N2_CELSIUS);
-                            } else {
-                                if (DeltaStar.getLifePackSystem().isOnline()) {
-                                    DeltaStar.getLifePackSystem().getHeaterModule().getLedGreenCoolerGood().switchOn();
-                                    DeltaStar.getLifePackSystem().getHeaterModule().getLedRedCoolerBad().switchOff();
-                                }
+        this.processusCooling = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                while (true) {                        
+                    try {
+                        Thread.sleep(Constants.INTERVAL_COOLING_O2N2);
+
+                        //selon si radiateur déployé
+                        if (DeltaStar.getLifePackSystem().getHeaterModule().isDeployed() && temperature >= Constants.TEMP_COOLING_MIN) {
+                            temperature -= 1;
+                        } else if (!DeltaStar.getLifePackSystem().getHeaterModule().isDeployed()) {
+                            temperature += Constants.AUGMENTATION_TEMP_COOLING;
+                        }
+
+                        //selon temperature atteinte on agit
+                        //seuil d'alert du systeme
+                        if (temperature >= Constants.TEMP_COOLING_ALERT_MAX && DeltaStar.getLifePackSystem().isOnline()) {
+                            if (DeltaStar.getLifePackSystem().isOnline()) {
+                                DeltaStar.getLifePackSystem().getHeaterModule().getLedGreenCoolerGood().switchOff();
+                                DeltaStar.getLifePackSystem().getHeaterModule().getLedRedCoolerBad().switchOn();
                             }
-                            //seuil final avant surchauffe du système
-                            if (temperature >= Constants.TEMP_COOLING_OVERHEATED) {
-                                DeltaStar.getPowerSystem().onDeactivateSystem();
-                                break;
+                            DeltaStar.getLifePackSystem().getArduinoComLcd().setLcdMod(LcdSystemLifePackConstants.SYSTEM_OVERHEATED);
+                            Thread.sleep(Constants.INTERVAL_COOLING_O2N2);
+                            DeltaStar.getLifePackSystem().getArduinoComLcd().setLcdMod(LcdSystemLifePackConstants.DISPLAY_O2N2_CELSIUS);
+                        } else {
+                            if (DeltaStar.getLifePackSystem().isOnline()) {
+                                DeltaStar.getLifePackSystem().getHeaterModule().getLedGreenCoolerGood().switchOn();
+                                DeltaStar.getLifePackSystem().getHeaterModule().getLedRedCoolerBad().switchOff();
                             }
-                        } catch (InterruptedException ex) {
-                            Logger.getLogger(LifePackSystem.class.getName()).log(Level.SEVERE, null, ex);
                         }
+                        //seuil final avant surchauffe du système
+                        if (temperature >= Constants.TEMP_COOLING_OVERHEATED) {
+                            DeltaStar.getPowerSystem().onDeactivateSystem();
+                            break;
+                        }
+                    } catch (InterruptedException ex) {
+                        Logger.getLogger(LifePackSystem.class.getName()).log(Level.SEVERE, null, ex);
                     }
                 }
-            });
-        }
+            }
+        });
         this.processusCooling.start();
     }
     

+ 22 - 5
Pigou/src/fr/deltastar/pigou/model/panel/system/PowerSystem.java

@@ -161,6 +161,28 @@ public class PowerSystem extends BaseSystem implements SystemLcdInterface {
         this.consoPower.start();
     }
     
+    @Override
+    public void onDeactivateSystem() {
+        //desactivation des systèmes annexes si en ligne
+        if (DeltaStar.getAirlockSystem().isOnline())
+            this.airlockPowerModule.onAction(false);
+        if (DeltaStar.getComputerSystem().isOnline())
+            this.computerPowerModule.onAction(false);
+        if (DeltaStar.getEngineSystem().isOnline())
+            this.enginePowerModule.onAction(false);
+        if (DeltaStar.getHudSystem().isOnline())
+            this.hudPowerModule.onAction(false);
+        if (DeltaStar.getLifePackSystem().isOnline())
+            this.lifePackPowerModule.onAction(false);
+        //consommation inerte les systeme ne chauffe plus
+        DeltaStar.getLifePackSystem().stopProcessusCooling();
+        //plus de consommation on coupe
+        this.consoPower.stop();
+        
+        super.setIsOnline(false);
+        this.getArduinoComLcd().setLcdMod(LcdSystemPowerConstants.NO_CONNECTION_APU);
+    }
+    
     /**
      * Appellé par les système annexes pour informer le systemes electriques l'activation/desactivation d'un systeme
      * @param activate 
@@ -174,11 +196,6 @@ public class PowerSystem extends BaseSystem implements SystemLcdInterface {
             this.consoSupp -= Constants.CONSOMMATION_SYSTEM;
         }
     }
-
-    @Override
-    public void onDeactivateSystem() {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-    }
     
     @Override
     public String toString() {

+ 13 - 4
Pigou/src/fr/deltastar/pigou/service/OrbiterService.java

@@ -23,6 +23,10 @@ public class OrbiterService implements ListenerComInterface {
      * Altitude du vaisseau actuellement
      */
     private long altitude;
+    /**
+     * Indique si le vaisseau est docké ou pas
+     */
+    private boolean isDocking;
 
     public OrbiterService() {
         this.serverSocket = new SocketServer(this);
@@ -82,14 +86,19 @@ public class OrbiterService implements ListenerComInterface {
         this.altitude = Long.parseLong(dataSplit[0]);
         int fuelMain = Integer.parseInt(dataSplit[1]);
         int fuelRcs = Integer.parseInt(dataSplit[2]);
+        this.isDocking = (Integer.parseInt(dataSplit[3]) == 1);
+        
         
         //OPERATION AVEC MAJ DES VALEURS RECU PAR ORBITER
         
+        if (this.isDocking) {
+            DeltaStar.getAirlockSystem().getUndockModule().getLedRed().switchOn();
+        }
+        
         //maj carburant si système en place
-        EngineSystem es = DeltaStar.getEngineSystem();
-        if (es.isOnline()) {
-            es.setArgOne(fuelMain);
-            es.setArgTwo(fuelRcs);
+        if (DeltaStar.getEngineSystem().isOnline()) {
+            DeltaStar.getEngineSystem().setArgOne(fuelMain);
+            DeltaStar.getEngineSystem().setArgTwo(fuelRcs);
         }
         
     }

BIN
panel/avancé programme/navigation.jpg


BIN
panel/avancé programme/panel electrique.jpg