-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow encoders to be manually defined by ground stations #45
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,9 @@ public class RealAntenna | |
public virtual double Bandwidth => DataRate; // RF bandwidth required. | ||
public virtual float AMWTemp { get; set; } | ||
public virtual float Beamwidth => Physics.Beamwidth(Gain); | ||
public string encoderOverride { get; set; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should match case with the rest of the code. Also I spot an extra whitespace. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to match the formatting (although I have no idea what |
||
|
||
public Antenna.Encoder Encoder => Antenna.Encoder.GetFromTechLevel(TechLevelInfo.Level); | ||
public Antenna.Encoder Encoder => Antenna.Encoder.Get(encoderOverride, TechLevelInfo.Level); | ||
public virtual float RequiredCI => Encoder.RequiredEbN0; | ||
|
||
public ModuleRealAntenna Parent { get; internal set; } | ||
|
@@ -96,6 +97,7 @@ public RealAntenna(RealAntenna orig) | |
Parent = orig.Parent; | ||
ParentNode = orig.ParentNode; | ||
ParentSnapshot = orig.ParentSnapshot; | ||
encoderOverride = orig.encoderOverride; | ||
} | ||
|
||
public virtual bool Compatible(RealAntenna other) => RFBand == other.RFBand; | ||
|
@@ -119,6 +121,7 @@ public virtual void LoadFromConfigNode(ConfigNode config) | |
Target = Targeting.AntennaTarget.LoadFromConfig(config.GetNode("TARGET"), this); | ||
else if (Shape != AntennaShape.Omni && (ParentNode == null || !ParentNode.isHome) && !(Target?.Validate() == true) && HighLogic.LoadedSceneHasPlanetarium) | ||
Target = Targeting.AntennaTarget.LoadFromConfig(SetDefaultTarget(), this); | ||
encoderOverride = (config.HasValue("encoderOverride")) ? config.GetValue("encoderOverride") : null; | ||
} | ||
|
||
public virtual void ProcessUpgrades(float tsLevel, ConfigNode node) | ||
|
@@ -147,6 +150,7 @@ public virtual void UpgradeFromConfigNode(ConfigNode config) | |
if (config.TryGetValue("SymbolRate", ref d)) SymbolRate = d; | ||
if (config.TryGetValue("AMWTemp", ref f)) AMWTemp = f; | ||
if (config.TryGetValue("RFBand", ref s)) RFBand = Antenna.BandInfo.All[s]; | ||
if (config.TryGetValue("encoderOverride", ref s)) encoderOverride = s; | ||
} | ||
|
||
public virtual ConfigNode SetDefaultTarget() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I would write this as
GetByName
and then in calling code useGetByName(overrride) ?? GetFromTechLevel(level)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright rewrote it so the discrimination is done when the function is called.