diff --git a/src/i2c_communication.cpp b/src/i2c_communication.cpp index 88ea845..e8baa2a 100644 --- a/src/i2c_communication.cpp +++ b/src/i2c_communication.cpp @@ -61,6 +61,7 @@ void onReceiveEvent(int bytes) { // 更新传感器状态和数据 unsigned long last_gps_data_time = 0; static uint8_t last_receive_cnt = 0; + void update_sensor_data() { //gps //if (millis() > 5000 && gps.charsProcessed() < 10 && digitalRead(GPS_POWER_PIN) == HIGH) @@ -68,11 +69,7 @@ void update_sensor_data() { sensor_data.gps_sta = 0x00; // 无设备 sensor_data.gps_lat = 0.0f; sensor_data.gps_lon = 0.0f; - } else if (digitalRead(GPS_POWER_PIN) == LOW){ - sensor_data.gps_sta = 0x01; // 关机 - sensor_data.gps_lat = 0.0f; - sensor_data.gps_lon = 0.0f; - }else if (!gps.location.isUpdated()) { + } else if (!gps.location.isUpdated()) { sensor_data.gps_sta = 0x02; // 未搜到信号 sensor_data.gps_lat = 0.0f; sensor_data.gps_lon = 0.0f; @@ -87,9 +84,6 @@ void update_sensor_data() { if (receive_cnt == last_receive_cnt){ sensor_data.height_sta = 0x00; // 无设备 sensor_data.height = 0.0f; - }else if (digitalRead(RANGING_POWER_PIN) == LOW){ - sensor_data.height_sta = 0x01; // 关机 - sensor_data.height = 0.0f; }else { last_receive_cnt = receive_cnt; sensor_data.height_sta = 0x03; // 有效高度,正常工作 diff --git a/src/main.cpp b/src/main.cpp index c1f0ebc..39cb2e1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,10 +37,6 @@ void setup() { gpsSerial.begin(GPS_BAUDRATE); //GPS printSerial.begin(PRINT_BAUDRATE); // 调试输出串口(RX, TX) - power_init(); - - // digitalWrite(RANGING_POWER_PIN, HIGH); - // digitalWrite(GPS_POWER_PIN, HIGH); printSerial.println("Initialized..."); }