mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-14 22:55:12 +10:00
fix: clamp los profile bounds
This commit is contained in:
+1
-1
@@ -1673,7 +1673,7 @@
|
||||
"losFrequencyLabel": "Frequency",
|
||||
"losFrequencyInfoTooltip": "View calculation details",
|
||||
"losFrequencyDialogTitle": "Radio horizon calculation",
|
||||
"losFrequencyDialogDescription": "Starting from k={baselineK} at {baselineFreq} MHz, the calculation multiplies 0.15 × (frequency − {baselineFreq}) / {baselineFreq} to reach k approx {kFactor} for the current {frequencyMHz} MHz band, which defines the curved radio horizon cap.",
|
||||
"losFrequencyDialogDescription": "Starting from k={baselineK} at {baselineFreq} MHz, the calculation adjusts the k-factor for the current {frequencyMHz} MHz band, which defines the curved radio horizon cap.",
|
||||
"@losFrequencyDialogDescription": {
|
||||
"description": "Explain how the calculation uses the baseline frequency and derived k-factor.",
|
||||
"placeholders": {
|
||||
|
||||
@@ -5043,7 +5043,7 @@ abstract class AppLocalizations {
|
||||
/// Explain how the calculation uses the baseline frequency and derived k-factor.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Starting from k={baselineK} at {baselineFreq} MHz, the calculation multiplies 0.15 × (frequency − {baselineFreq}) / {baselineFreq} to reach k approx {kFactor} for the current {frequencyMHz} MHz band, which defines the curved radio horizon cap.'**
|
||||
/// **'Starting from k={baselineK} at {baselineFreq} MHz, the calculation adjusts the k-factor for the current {frequencyMHz} MHz band, which defines the curved radio horizon cap.'**
|
||||
String losFrequencyDialogDescription(
|
||||
double baselineK,
|
||||
double baselineFreq,
|
||||
|
||||
@@ -2849,7 +2849,7 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
double frequencyMHz,
|
||||
double kFactor,
|
||||
) {
|
||||
return 'Starting from k=$baselineK at $baselineFreq MHz, the calculation multiplies 0.15 × (frequency − $baselineFreq) / $baselineFreq to reach k approx $kFactor for the current $frequencyMHz MHz band, which defines the curved radio horizon cap.';
|
||||
return 'Starting from k=$baselineK at $baselineFreq MHz, the calculation adjusts the k-factor for the current $frequencyMHz MHz band, which defines the curved radio horizon cap.';
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1065,13 +1065,15 @@ class _LosProfilePainter extends CustomPainter {
|
||||
samples.last.terrainMeters,
|
||||
);
|
||||
|
||||
double distanceForCanvasX(double x) =>
|
||||
((x - horizontalPadding) / chartWidth) * maxDist;
|
||||
double distanceForCanvasX(double x) {
|
||||
final normalized = ((x - horizontalPadding) / chartWidth).clamp(0.0, 1.0);
|
||||
return normalized * maxDist;
|
||||
}
|
||||
|
||||
double elevationToPixel(double elevation) =>
|
||||
size.height -
|
||||
verticalPadding -
|
||||
((elevation - minY) / ySpan) * chartHeight;
|
||||
double elevationToPixel(double elevation) {
|
||||
final normalized = ((elevation - minY) / ySpan).clamp(0.0, 1.0);
|
||||
return size.height - verticalPadding - normalized * chartHeight;
|
||||
}
|
||||
|
||||
double extrapolateTerrain(double distance, bool isLeft) {
|
||||
final samplesForSlope = isLeft
|
||||
|
||||
Reference in New Issue
Block a user