Add uptime to serial status output

This commit is contained in:
2026-06-07 13:09:27 +09:00
parent 2f383fe791
commit c6e80e0618
3 changed files with 28 additions and 0 deletions
+21
View File
@@ -582,6 +582,7 @@ void printStatus(const __FlashStringHelper *tag) {
Serial.print(F("["));
Serial.print(tag);
Serial.println(F("]"));
printUptime();
Serial.print(F("raw="));
Serial.print(parkingRawValue);
Serial.print(F(" ig="));
@@ -623,6 +624,26 @@ void printStatus(const __FlashStringHelper *tag) {
Serial.println(autoCalibrationState);
}
void printUptime() {
unsigned long totalMs = millis();
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(F("uptime="));
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.println(F("ms"));
}
void setRelay(int relayPin, boolean state) {
digitalWrite(relayPin, state ? LOW : HIGH);
}
+6
View File
@@ -80,6 +80,12 @@ While debug mode is active, only `x` is accepted. Other input is ignored.
Manual position commands `u`, `d`, and `p` are allowed while driving, as long as the controller is not busy with an in-progress movement.
Every status output includes boot uptime:
```text
uptime=0h 2m 13s 457ms
```
## Automatic Calibration
- Each `IG1 HIGH -> LOW` transition increments the EEPROM use counter.
+1
View File
@@ -224,6 +224,7 @@ when currentPosMs <= 0:
</tbody>
</table>
<p><span class="warn">주의:</span> 명령은 한 글자만 받습니다. <code>debug</code>, <code>down</code>, <code>position 2000</code>처럼 긴 문자열은 실행하지 않습니다.</p>
<p>모든 상태 출력에는 부팅 후 경과 시간이 <code>uptime=0h 2m 13s 457ms</code> 형식으로 포함됩니다. debug 출력에서도 1초마다 같은 형식으로 확인할 수 있습니다.</p>
<h2>5. 수동 위치 세팅 시뮬레이션</h2>
<table>