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

90 行
2.3 KiB

  1. #include "GpsTracker.h"
  2. #include "Positions.h"
  3. #if _DEBUG
  4. #define MENU_TIMEOUT 0
  5. #else
  6. #define MENU_TIMEOUT 0
  7. #endif
  8. bool bypassMenu = false;
  9. void setup() {
  10. logging::setup();
  11. config::main::setup();
  12. rtc::setup();
  13. hardware::sim808::setup();
  14. positions::setup();
  15. }
  16. void loop() {
  17. debug::GPSTRACKER_DEBUG_COMMAND command = debug::GPSTRACKER_DEBUG_COMMAND::RUN;
  18. if (Serial && !bypassMenu) command = debug::menu();
  19. bypassMenu = command == debug::GPSTRACKER_DEBUG_COMMAND::RUN;
  20. switch (command) {
  21. case debug::GPSTRACKER_DEBUG_COMMAND::RUN:
  22. case debug::GPSTRACKER_DEBUG_COMMAND::ONCE:
  23. core::main();
  24. break;
  25. case debug::GPSTRACKER_DEBUG_COMMAND::RAM:
  26. debug::displayFreeRam();
  27. break;
  28. case debug::GPSTRACKER_DEBUG_COMMAND::BATTERY:
  29. debug::getAndDisplayBattery();
  30. break;
  31. case debug::GPSTRACKER_DEBUG_COMMAND::GPS_ON:
  32. gps::powerOn();
  33. break;
  34. case debug::GPSTRACKER_DEBUG_COMMAND::GPS_OFF:
  35. gps::powerOff();
  36. break;
  37. case debug::GPSTRACKER_DEBUG_COMMAND::GPS_GET:
  38. debug::getAndDisplayGpsPosition();
  39. break;
  40. case debug::GPSTRACKER_DEBUG_COMMAND::GPS_SET:
  41. debug::setFakeGpsPosition();
  42. break;
  43. case debug::GPSTRACKER_DEBUG_COMMAND::RTC_GET:
  44. debug::getAndDisplayRtcTime();
  45. break;
  46. case debug::GPSTRACKER_DEBUG_COMMAND::RTC_SET:
  47. debug::setRtcTime();
  48. break;
  49. case debug::GPSTRACKER_DEBUG_COMMAND::EEPROM_GET_CONFIG:
  50. debug::getAndDisplayEepromConfig();
  51. break;
  52. case debug::GPSTRACKER_DEBUG_COMMAND::EEPROM_RESET_CONFIG:
  53. config::main::reset();
  54. break;
  55. case debug::GPSTRACKER_DEBUG_COMMAND::EEPROM_GET_CONTENT:
  56. debug::getAndDisplayEepromContent();
  57. break;
  58. case debug::GPSTRACKER_DEBUG_COMMAND::EEPROM_GET_ENTRIES:
  59. debug::getAndDisplayEepromPositions();
  60. break;
  61. case debug::GPSTRACKER_DEBUG_COMMAND::EEPROM_GET_LAST_ENTRY:
  62. debug::getAndDisplayEepromLastPosition();
  63. break;
  64. case debug::GPSTRACKER_DEBUG_COMMAND::EEPROM_ADD_ENTRY:
  65. debug::addLastPositionToEeprom();
  66. break;
  67. case debug::GPSTRACKER_DEBUG_COMMAND::EEPROM_BACKUP_ENTRIES:
  68. positions::doBackup();
  69. break;
  70. case debug::GPSTRACKER_DEBUG_COMMAND::SLEEP:
  71. mainunit::sleep(period_t::SLEEP_8S);
  72. break;
  73. case debug::GPSTRACKER_DEBUG_COMMAND::SLEEP_DEEP:
  74. mainunit::deepSleep(10);
  75. break;
  76. case debug::GPSTRACKER_DEBUG_COMMAND::SD_WRITE_TEST:
  77. default:
  78. NOTICE_MSG("loop", "Unsupported");
  79. }
  80. }