diff --git a/Auto_Seat.ino b/Auto_Seat.ino index 9167f49..051b99d 100644 --- a/Auto_Seat.ino +++ b/Auto_Seat.ino @@ -622,6 +622,7 @@ void printStatus(const __FlashStringHelper *tag) { Serial.print(forceCalibration ? 1 : 0); Serial.print(F(" autoCalState=")); Serial.println(autoCalibrationState); + printAutoCalibrationDelayStatus(); } void printUptime() { @@ -644,6 +645,48 @@ void printUptime() { Serial.println(F("ms")); } +void printAutoCalibrationDelayStatus() { + if (useCount < USES_BEFORE_AUTO_CALIBRATION) { + return; + } + + Serial.print(F("autoCalOffTimer=")); + if (ignitionState == HIGH) { + Serial.println(F("waiting_for_ig_off")); + return; + } + + unsigned long elapsedMs = millis() - ignitionOffStartTime; + unsigned long remainingMs = 0; + if (elapsedMs < AUTO_CALIBRATION_DELAY_MS) { + remainingMs = AUTO_CALIBRATION_DELAY_MS - elapsedMs; + } + + Serial.print(F("elapsed ")); + printDuration(elapsedMs); + Serial.print(F(" remaining ")); + printDuration(remainingMs); + Serial.println(); +} + +void printDuration(unsigned long totalMs) { + unsigned long hours = totalMs / 3600000UL; + totalMs %= 3600000UL; + unsigned long minutes = totalMs / 60000UL; + totalMs %= 60000UL; + unsigned long seconds = totalMs / 1000UL; + unsigned long milliseconds = totalMs % 1000UL; + + Serial.print(hours); + Serial.print(F("h ")); + Serial.print(minutes); + Serial.print(F("m ")); + Serial.print(seconds); + Serial.print(F("s ")); + Serial.print(milliseconds); + Serial.print(F("ms")); +} + void setRelay(int relayPin, boolean state) { digitalWrite(relayPin, state ? LOW : HIGH); } diff --git a/README.md b/README.md index cfbbf24..ae17a38 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,18 @@ Every status output includes boot uptime: uptime=0h 2m 13s 457ms ``` +If the use counter reached 10, status/debug output also includes the ignition-off calibration timer: + +```text +autoCalOffTimer=elapsed 0h 1m 20s 123ms remaining 0h 3m 39s 877ms +``` + +If IG1 is still ON: + +```text +autoCalOffTimer=waiting_for_ig_off +``` + ## Automatic Calibration - Each `IG1 HIGH -> LOW` transition increments the EEPROM use counter. diff --git a/report.html b/report.html index b843482..9ded4c0 100644 --- a/report.html +++ b/report.html @@ -225,6 +225,7 @@ when currentPosMs <= 0:

주의: 명령은 한 글자만 받습니다. debug, down, position 2000처럼 긴 문자열은 실행하지 않습니다.

모든 상태 출력에는 부팅 후 경과 시간이 uptime=0h 2m 13s 457ms 형식으로 포함됩니다. debug 출력에서도 1초마다 같은 형식으로 확인할 수 있습니다.

+

사용 횟수가 10회에 도달한 경우에만 보정 대기 타이머가 autoCalOffTimer=elapsed 0h 1m 20s 123ms remaining 0h 3m 39s 877ms 형식으로 추가 출력됩니다. IG1 ON 상태에서는 autoCalOffTimer=waiting_for_ig_off로 표시됩니다.

5. 수동 위치 세팅 시뮬레이션