浏览代码

Defined configuration constants. Added a timeout to the menu. The goal is to automatically run normally at boot if no input is detected

tags/v1.2.0
Bertrand Lemasle 7 年前
父节点
当前提交
bbbc829b7f
共有 2 个文件被更改,包括 27 次插入5 次删除
  1. +15
    -4
      GpsTracker/Config.h
  2. +12
    -1
      GpsTracker/Debug.cpp

+ 15
- 4
GpsTracker/Config.h 查看文件

@@ -3,7 +3,7 @@
#include <Arduino.h>

#define BACKUP_ENABLE_SDCARD 0
#define BACKUP_ENABLE_NETWORK 1
#define BACKUP_ENABLE_NETWORK 0

#if BACKUP_ENABLE_NETWORK
#include "NetworkPositionsConfig.h"
@@ -16,14 +16,25 @@

#define SIM808_BAUDRATE 4800

#define SLEEP_DEFAULT_TIME_SECONDS 1800
#pragma region Default configuration values

#define GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000
#define GPS_DEFAULT_TOTAL_TIMEOUT_MS 180000
#define MENU_TIMEOUT 10000
/**
\def SLEEP_DEFAULT_TIME_SECONDS
Hard coded value for default sleep time between position acquisitions.
Exprimed in seconds
*/
#define SLEEP_DEFAULT_TIME_SECONDS 1800
#define SLEEP_DEFAULT_INCREASE_THRESHOLD 3

#define GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000
#define GPS_DEFAULT_TOTAL_TIMEOUT_MS 180000

#define NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS 6000
#define NETWORK_DEFAULT_TOTAL_TIMEOUT_MS 180000

#pragma endregion

struct sleepTimings_t {
uint8_t speed;
uint16_t seconds;


+ 12
- 1
GpsTracker/Debug.cpp 查看文件

@@ -147,12 +147,23 @@ namespace debug {
GPSTRACKER_DEBUG_COMMAND command;
size_t menuSize = flash::getArraySize(MENU_ENTRIES);
int16_t timeout = MENU_TIMEOUT;

do {
for (uint8_t i = 0; i < menuSize; i++) {
Serial.println(reinterpret_cast<const __FlashStringHelper *>(pgm_read_word_near(&MENU_ENTRIES[i])));
}

while (!Serial.available());
while (!Serial.available()) {
#ifndef _DEBUG
delay(50);
timeout -= 50;
if (timeout < 0) {
NOTICE_MSG("menu", "Timeout expired.");
return GPSTRACKER_DEBUG_COMMAND::RUN;
}
#endif
}
command = parseCommand(Serial.read());
while (Serial.available()) Serial.read();
} while (command == GPSTRACKER_DEBUG_COMMAND::NONE);


正在加载...
取消
保存