Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

96 rindas
2.5 KiB

  1. #pragma once
  2. #include <Arduino.h>
  3. #define BACKUP_ENABLE_SDCARD 0
  4. #define BACKUP_ENABLE_NETWORK 1
  5. #if BACKUP_ENABLE_NETWORK
  6. #include "NetworkPositionsConfig.h"
  7. #endif
  8. #define SIM808_BAUDRATE 4800
  9. #define CONFIG_ADDR 0
  10. #define CONFIG_RESERVED_SIZE 128
  11. #define CONFIG_SEED 13
  12. #define VERSION "1.00"
  13. #define SLEEP_TIMING_TIME(hours, minutes) hours * 60 + minutes
  14. #pragma region Default configuration values
  15. #define MENU_TIMEOUT 10000
  16. /**
  17. \def SLEEP_DEFAULT_TIME_SECONDS
  18. Hard coded value for default sleep time between position acquisitions.
  19. Exprimed in seconds
  20. */
  21. #define SLEEP_DEFAULT_TIME_SECONDS 1800
  22. #define SLEEP_DEFAULT_STOPPED_THRESHOLD 5
  23. #define SLEEP_DEFAULT_PAUSING_TIME_SECONDS 270
  24. #define SLEEP_TIMING_MIN SLEEP_TIMING_TIME(0, 0)
  25. #define SLEEP_TIMING_MAX SLEEP_TIMING_TIME(23, 59)
  26. #define SLEEP_TIMING_MIN_MOVING_VELOCITY 5
  27. #define GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000L
  28. #define GPS_DEFAULT_TOTAL_TIMEOUT_MS 80000L
  29. #define GPS_DEFAULT_MISSED_POSITION_GAP_KM 2
  30. #define NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000L
  31. #define NETWORK_DEFAULT_TOTAL_TIMEOUT_MS 80000L
  32. #define NETWORK_DEFAULT_NO_NETWORK_QUALITY_THRESHOLD 8
  33. #define NETWORK_DEFAULT_NO_NETWORK_TRIES 5
  34. #define ALERT_RTC_TEMPERATURE_FAILURE 0
  35. #pragma endregion
  36. struct sleepTimings_t {
  37. uint8_t speed;
  38. uint16_t timeMin;
  39. uint16_t timeMax;
  40. uint16_t seconds;
  41. };
  42. struct config_t {
  43. uint8_t seed;
  44. char version[5];
  45. uint16_t firstEntry;
  46. uint16_t lastEntry;
  47. #if BACKUP_ENABLE_NETWORK
  48. networkConfig_t network;
  49. #endif
  50. uint8_t alertBatteryLevel1;
  51. uint8_t alertBatteryLevel2;
  52. uint8_t alertBatteryLevelClear;
  53. char contactPhone[15];
  54. };
  55. namespace config {
  56. static const sleepTimings_t defaultSleepTimings[] PROGMEM = {
  57. { 0, SLEEP_TIMING_TIME(16, 00), SLEEP_TIMING_TIME(19, 59), 3600 },
  58. { 0, SLEEP_TIMING_TIME(20, 00), SLEEP_TIMING_MAX, SLEEP_DEFAULT_TIME_SECONDS },
  59. { 0, SLEEP_TIMING_MIN, SLEEP_TIMING_TIME(8, 29), SLEEP_DEFAULT_TIME_SECONDS },
  60. { 0, SLEEP_TIMING_TIME(8, 30), SLEEP_TIMING_TIME(15, 59), 10800 },
  61. { SLEEP_TIMING_MIN_MOVING_VELOCITY, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 540 },
  62. { 10, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 270 },
  63. { 20, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 225 },
  64. { 30, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 240 },
  65. { 45, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 280 },
  66. { 65, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 276 },
  67. { 85, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 225 }
  68. };
  69. namespace main {
  70. extern config_t value;
  71. void setup();
  72. void save();
  73. void reset();
  74. }
  75. }