mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
feat(terrain,ci): add lost-model GPS, GPX trace, inclinometer, throttle expo/crawl, relay ping, log rotation & release CI
This commit is contained in:
1 parent
c83f90570f
commit
9f0c64f873
20 files changed
+926
-78
No files matched your search
@@ -167,6 +167,25 @@ impl OsdOverlay {
|
||||
scale,
|
||||
[255, 60, 60, 255],
|
||||
);
|
||||
// Mode « Véhicule Perdu » : afficher immédiatement la dernière position GPS valide connue
|
||||
if extra.show_gps {
|
||||
if let Some((lat, lon, _, sats)) = telem.last_valid_gps {
|
||||
let mut last_gps_buf = StackStr::<64>::new();
|
||||
let _ = write!(last_gps_buf, "LAST GPS {:.5},{:.5} ({}S)", lat, lon, sats);
|
||||
let gx = (width as i32 / 2)
|
||||
- ((last_gps_buf.as_str().chars().count() as i32 * 6 * scale as i32) / 2);
|
||||
Self::draw_text(
|
||||
rgba,
|
||||
width,
|
||||
height,
|
||||
gx,
|
||||
top_center_bottom + 2,
|
||||
last_gps_buf.as_str(),
|
||||
scale,
|
||||
[255, 200, 50, 255],
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Self::draw_heading_ribbon(
|
||||
rgba,
|
||||
@@ -331,6 +350,26 @@ impl OsdOverlay {
|
||||
telem.drone_pitch_rad,
|
||||
);
|
||||
|
||||
// Inclinomètre numérique (Pitch / Roll en degrés) avec alerte dévers crawler/aile (>= 25° orange, >= 35° rouge)
|
||||
if telem.is_live() {
|
||||
let pitch_deg = telem.drone_pitch_rad.to_degrees();
|
||||
let roll_deg = telem.drone_roll_rad.to_degrees();
|
||||
let max_tilt = pitch_deg.abs().max(roll_deg.abs());
|
||||
let inc_color = if max_tilt >= 35.0 {
|
||||
[255, 60, 60, 255]
|
||||
} else if max_tilt >= 25.0 {
|
||||
[255, 185, 45, 255]
|
||||
} else {
|
||||
[180, 230, 255, 220]
|
||||
};
|
||||
let mut inc_buf = StackStr::<32>::new();
|
||||
let _ = write!(inc_buf, "P:{:+3.0}° R:{:+3.0}°", pitch_deg, roll_deg);
|
||||
let ix = (width as i32 / 2)
|
||||
- ((inc_buf.as_str().chars().count() as i32 * 6 * scale as i32) / 2);
|
||||
let iy = (height as i32 / 2) + 52;
|
||||
Self::draw_text(rgba, width, height, ix, iy, inc_buf.as_str(), scale, inc_color);
|
||||
}
|
||||
|
||||
let bottom_y = height.saturating_sub(28 + 8 * scale) as i32;
|
||||
let spd_kmh = telem.groundspeed_ms * 3.6;
|
||||
let mut left_bottom_buf = StackStr::<48>::new();
|
||||
|
||||
@@ -287,6 +287,10 @@ impl TelemetryReceiver {
|
||||
st.gps_sats = sats;
|
||||
st.gps_alt_m = alt_off as f32 - 1000.0;
|
||||
st.gps_fix_valid = sats >= 4 && (lat_raw != 0 || lon_raw != 0);
|
||||
if st.gps_fix_valid {
|
||||
st.last_valid_gps = Some((st.gps_lat_deg, st.gps_lon_deg, st.gps_alt_m, sats));
|
||||
st.last_valid_gps_at = Some(Instant::now());
|
||||
}
|
||||
st.groundspeed_ms = (gs_10kmh as f32 * 0.1) / 3.6;
|
||||
st.altitude_m = st.gps_alt_m;
|
||||
if hdg_100 <= 36000 {
|
||||
|
||||
@@ -26,6 +26,9 @@ pub struct TelemetryState {
|
||||
/// Point Home mémorisé au premier armement avec fix GPS valide (>= 6 sats)
|
||||
pub home_lat_deg: Option<f64>,
|
||||
pub home_lon_deg: Option<f64>,
|
||||
/// Dernière position GPS valide connue (lat, lon, alt_m, sats) — figée en cas de perte liaison (Lost Model)
|
||||
pub last_valid_gps: Option<(f64, f64, f32, u8)>,
|
||||
pub last_valid_gps_at: Option<Instant>,
|
||||
pub flight_mode: String,
|
||||
pub packets_received: u64,
|
||||
pub last_update: Option<Instant>,
|
||||
@@ -59,6 +62,8 @@ impl Default for TelemetryState {
|
||||
gps_fix_valid: false,
|
||||
home_lat_deg: None,
|
||||
home_lon_deg: None,
|
||||
last_valid_gps: None,
|
||||
last_valid_gps_at: None,
|
||||
flight_mode: String::new(),
|
||||
packets_received: 0,
|
||||
last_update: None,
|
||||
@@ -168,6 +173,22 @@ impl TelemetryState {
|
||||
Some((dist_m, rel))
|
||||
}
|
||||
|
||||
/// Retourne `(distance_m, azimut_depuis_home_deg)` entre le point Home et la dernière position GPS valide connue.
|
||||
/// Utile en mode « Véhicule Perdu » (Lost Model) pour savoir dans quelle direction marcher.
|
||||
pub fn last_known_gps_from_home(&self) -> Option<(f32, f32)> {
|
||||
let (hlat, hlon) = (self.home_lat_deg?, self.home_lon_deg?);
|
||||
let (lat, lon, _, _) = self.last_valid_gps?;
|
||||
let dist_m = haversine_distance_m(hlat, hlon, lat, lon);
|
||||
let bearing = initial_bearing_deg(hlat, hlon, lat, lon);
|
||||
Some((dist_m, bearing))
|
||||
}
|
||||
|
||||
/// URL Google Maps vers la dernière position GPS valide connue.
|
||||
pub fn last_known_gps_maps_url(&self) -> Option<String> {
|
||||
let (lat, lon, _, _) = self.last_valid_gps?;
|
||||
Some(format!("https://maps.google.com/?q={:.6},{:.6}", lat, lon))
|
||||
}
|
||||
|
||||
/// Formate une ligne compacte de télémétrie pour sous-titres DVR `.srt` (VLC/MPV).
|
||||
pub fn format_dvr_srt_caption(
|
||||
&self,
|
||||
|
||||
Reference in new issue
Block a user