Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

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