fix: rppal detect

This commit is contained in:
grabbit 2025-04-05 23:49:31 +08:00
parent 6faba28542
commit ecc90b6fd6

View File

@ -50,8 +50,8 @@ pub struct GpsController {
config: GpsConfig,
/// Serial port for GPS communication
port: Option<Box<dyn SerialPort>>,
/// GPIO pin for PPS signal (Linux only)
#[cfg(target_os = "linux")]
/// GPIO pin for PPS signal
#[cfg(feature = "gpio")]
pps_pin: Option<InputPin>,
/// Placeholder for non-Linux platforms
#[cfg(not(target_os = "linux"))]
@ -93,6 +93,7 @@ impl GpsController {
Ok(Self {
config: gps_config,
port: None,
#[cfg(feature = "gpio")]
pps_pin: None,
position: Arc::new(Mutex::new(initial_position)),
sync_status: Arc::new(Mutex::new(SyncStatus::NoSync)),
@ -170,8 +171,7 @@ impl GpsController {
}
// Initialize PPS pin if enabled and GPS initialized successfully
// This is only compiled on Linux
#[cfg(target_os = "linux")]
#[cfg(feature = "gpio")]
if self.config.use_pps && !self.gps_state.degraded {
match Gpio::new() {
Ok(gpio) => {