Kaynağa Gözat

Revert "Removed menu timeout, that was a bad idea"

This reverts commit 92c6a34fef.
tags/v1.2.0
Bertrand Lemasle 7 yıl önce
ebeveyn
işleme
a093a1ea47
3 değiştirilmiş dosya ile 14 ekleme ve 4 silme
  1. +12
    -2
      GpsTracker/Debug.cpp
  2. +1
    -1
      GpsTracker/Debug.h
  3. +1
    -1
      GpsTracker/GpsTracker.ino

+ 12
- 2
GpsTracker/Debug.cpp Dosyayı Görüntüle

@@ -136,16 +136,26 @@ namespace debug {
return GPSTRACKER_DEBUG_COMMAND::NONE;
}

GPSTRACKER_DEBUG_COMMAND menu() {
GPSTRACKER_DEBUG_COMMAND menu(uint16_t timeout) {
GPSTRACKER_DEBUG_COMMAND command;
size_t menuSize = flash::getArraySize(MENU_ENTRIES);
uint8_t intermediate_timeout = 50;

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()); delay(50);
while (!Serial.available()) {
if (timeout > 0) {
delay(intermediate_timeout);
timeout -= intermediate_timeout;
if (timeout <= 0) {
NOTICE_MSG("menu", "Timeout expired.");
return GPSTRACKER_DEBUG_COMMAND::RUN;
}
}
}
command = parseCommand(Serial.read());
while (Serial.available()) Serial.read(); //flushing input
} while (command == GPSTRACKER_DEBUG_COMMAND::NONE);


+ 1
- 1
GpsTracker/Debug.h Dosyayı Görüntüle

@@ -39,7 +39,7 @@ namespace debug {
int freeRam();
void displayFreeRam();

GPSTRACKER_DEBUG_COMMAND menu();
GPSTRACKER_DEBUG_COMMAND menu(uint16_t timeout);

void getAndDisplayBattery();
void getAndDisplayGpsPosition();


+ 1
- 1
GpsTracker/GpsTracker.ino Dosyayı Görüntüle

@@ -22,7 +22,7 @@ void setup() {
void loop() {

debug::GPSTRACKER_DEBUG_COMMAND command = debug::GPSTRACKER_DEBUG_COMMAND::RUN;
if (Serial && !bypassMenu) command = debug::menu();
if (Serial && !bypassMenu) command = debug::menu(MENU_TIMEOUT);

bypassMenu = command == debug::GPSTRACKER_DEBUG_COMMAND::RUN;



Yükleniyor…
İptal
Kaydet