您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

39 行
632 B

  1. #include "GpsTracker.h"
  2. void setup() {
  3. #ifdef _DEBUG
  4. debug::waitForSerial();
  5. Log.begin(LOG_LEVEL_VERBOSE, &Serial);
  6. #endif
  7. core::setCurrentState(GPS_TRACKER_STATES::SETUP);
  8. rtc::powerOn();
  9. rtc::setup();
  10. rtc::powerOff();
  11. }
  12. void loop() {
  13. gps::powerOn();
  14. SIM808_GPS_STATUS gpsStatus = gps::acquireCurrentPosition(30000);
  15. gps::powerOff();
  16. if (gpsStatus > SIM808_GPS_STATUS::NO_FIX) {
  17. tmElements_t time;
  18. gps::getTime(time);
  19. rtc::powerOn();
  20. rtc::setTime(time);
  21. rtc::powerOff();
  22. positions::appendLast();
  23. }
  24. if (positions::needsToSend()) {
  25. positions::send();
  26. }
  27. mainunit::deepSleep(10); //duration TBD
  28. }