Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

89 righe
2.3 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 NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000L
  30. #define NETWORK_DEFAULT_TOTAL_TIMEOUT_MS 80000L
  31. #define NETWORK_DEFAULT_NO_NETWORK_QUALITY_THRESHOLD 8
  32. #define NETWORK_DEFAULT_NO_NETWORK_TRIES 5
  33. #pragma endregion
  34. struct sleepTimings_t {
  35. uint8_t speed;
  36. uint16_t timeMin;
  37. uint16_t timeMax;
  38. uint16_t seconds;
  39. };
  40. struct config_t {
  41. uint8_t seed;
  42. char version[5];
  43. uint16_t firstEntry;
  44. uint16_t lastEntry;
  45. #if BACKUP_ENABLE_NETWORK
  46. networkConfig_t network;
  47. #endif
  48. };
  49. namespace config {
  50. static const sleepTimings_t defaultSleepTimings[] PROGMEM = {
  51. { 0, SLEEP_TIMING_TIME(16, 00), SLEEP_TIMING_TIME(19, 59), 3600 },
  52. { 0, SLEEP_TIMING_TIME(20, 00), SLEEP_TIMING_MAX, SLEEP_DEFAULT_TIME_SECONDS },
  53. { 0, SLEEP_TIMING_MIN, SLEEP_TIMING_TIME(8, 29), SLEEP_DEFAULT_TIME_SECONDS },
  54. { 0, SLEEP_TIMING_TIME(8, 30), SLEEP_TIMING_TIME(15, 59), 10800 },
  55. { SLEEP_TIMING_MIN_MOVING_VELOCITY, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 540 },
  56. { 10, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 270 },
  57. { 20, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 225 },
  58. { 30, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 240 },
  59. { 45, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 280 },
  60. { 65, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 276 },
  61. { 85, SLEEP_TIMING_MIN, SLEEP_TIMING_MAX, 225 }
  62. };
  63. namespace main {
  64. extern config_t value;
  65. void setup();
  66. void save();
  67. void reset();
  68. }
  69. }