From e7fbec3d8912bd0c17f7ee585c490e2d9db40ee4 Mon Sep 17 00:00:00 2001 From: Daniel_M_Williams Date: Mon, 14 Dec 2015 19:44:43 -0500 Subject: [PATCH] [Bugfix] Restored AUTOMATIC Ignition Event, et al. Restored Automatic ignition Option - "bottom" core stage is the lowest centerline ('AFTER') - Parallel Stages are always considered as 'launch' stages... and thus ignite on launch. Motors now copy Ignition parameters when loaded into a rocket. Added additional error checking in FlightConfigurationID - class is now tolerant of random string initializations --- .../importt/IgnitionConfigurationHandler.java | 5 --- .../openrocket/importt/MotorMountHandler.java | 6 ++++ .../rocketcomponent/AxialStage.java | 4 +++ .../FlightConfigurationID.java | 10 ++++-- .../rocketcomponent/IgnitionEvent.java | 31 ++++++++----------- .../rocketcomponent/ParallelStage.java | 5 +++ .../sf/openrocket/rocketcomponent/Rocket.java | 3 +- 7 files changed, 38 insertions(+), 26 deletions(-) diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/IgnitionConfigurationHandler.java b/core/src/net/sf/openrocket/file/openrocket/importt/IgnitionConfigurationHandler.java index ebf413267..e05248d7d 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/IgnitionConfigurationHandler.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/IgnitionConfigurationHandler.java @@ -23,7 +23,6 @@ class IgnitionConfigurationHandler extends AbstractElementHandler { } - @Override public ElementHandler openElement(String element, HashMap attributes, WarningSet warnings) { @@ -37,10 +36,6 @@ class IgnitionConfigurationHandler extends AbstractElementHandler { content = content.trim(); if (element.equals("ignitionevent")) { - if ( content.equals( "automatic")){ - content = "launch"; - warnings.add( Warning.fromString("'automatic' separation is deprecated and has been converted to the 'launch' setting.")); - } for (IgnitionEvent ie : IgnitionEvent.values()) { if (ie.equals(content)) { diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/MotorMountHandler.java b/core/src/net/sf/openrocket/file/openrocket/importt/MotorMountHandler.java index 7b7c8807e..eb24e256a 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/MotorMountHandler.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/MotorMountHandler.java @@ -77,6 +77,12 @@ class MotorMountHandler extends AbstractElementHandler { RocketComponent mountComponent = (RocketComponent)mount; motorInstance.setID( new MotorInstanceId(mountComponent.getID(), 1)); motorInstance.setEjectionDelay(motorHandler.getDelay(warnings)); + + // pull event data from defaults + MotorInstance defInstance = mount.getDefaultMotorInstance(); + motorInstance.setIgnitionEvent( defInstance.getIgnitionEvent()); + motorInstance.setIgnitionDelay( defInstance.getIgnitionDelay()); + mount.setMotorInstance(fcid, motorInstance); Rocket rkt = ((RocketComponent)mount).getRocket(); diff --git a/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java b/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java index 0b1a34cd5..4c677eb70 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java +++ b/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java @@ -117,6 +117,10 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC public boolean isAfter(){ return true; } + + public boolean isLaunchStage(){ + return ( getRocket().getBottomCoreStage().equals(this)); + } public void setStageNumber(final int newStageNumber) { this.stageNumber = newStageNumber; diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfigurationID.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfigurationID.java index 71d59b231..eeee7d033 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfigurationID.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfigurationID.java @@ -23,11 +23,17 @@ public final class FlightConfigurationID implements Comparable