﻿# ============================================================================
#  TEST SCRIPT (English) — HabaCheck reads this file to guide the driver.
#  Edit with Notepad, save as UTF-8. Lines starting with # are comments.
#
#  Each step:
#    [buoc]
#    ten=           short name (shown in the step list on the left)
#    huong_dan=     instruction for the DRIVER — plain words, no jargon
#    cho=           condition that means "doing it right", join with ;
#                   parameter names: vong_quay (rpm), tai_pc (load %),
#                   chan_ga (throttle %), nhiet_nuoc (coolant °F shown, °C internally),
#                   ap_dau (oil kPa), ap_tang_ap (boost kPa), toc_do_xe,
#                   luong_phun, ap_rail, dien_ap_ac_quy, muc_def, nox_ra…
#                   engine brake: momen_phanh_thuc_pc (NEGATIVE when braking),
#                                 kha_nang_phanh_pc, momen_phanh_doi_pc
#                   cruise:       cruise_cong_tac, cruise_dang_an (1 = engaged),
#                                 cruise_toc_do_dat, cong_tac_phanh, cong_tac_con
#    giu=           hold the condition this many seconds to PASS
#                   (breaks under 3 s — gear changes etc. — don't reset it)
#    bo_qua_duoc=1  allow the "Skip step" button
#    xoa_ma=1       CLEAR-FAULTS STEP: once the condition has been held, the
#                   app SENDS the clear commands (DM11 + DM3) itself and waits
#                   ~15 s for the verdict before moving on. ⚠ cho= MUST prove
#                   the ENGINE IS OFF (vong_quay<=30): every tool is refused
#                   by the ECUs while the engine is running.
#    che_do=        do (parked test only) | duong (road test only) | ca_hai
#                   (omitted = the step appears in BOTH test modes)
#    kiem=name|Label shown|min|max
#                   averages that parameter while holding. Leave min/max
#                   EMPTY and the app only records the number, no judgment.
#
#  ⚠ LIMITS (min/max on kiem= lines) belong to the TECHNICIAN. They ship
#    empty on purpose — fill in only approved numbers.
#
#  For a good POWER CURVE the engine must be WARM and under LOAD — idling
#  in the yard gives zero boost and 7–8% torque, nothing to draw.
# ============================================================================
#  03/09/2026: warm-up threshold LOWERED 175°F → 150°F (owner's call): 175°F kept customers
#  idling 10–15 minutes in the shop; dropping the step made sessions too short to log.
#  04/09/2026: the owner asked for 165°F, believing the app misread coolant. Measured
#  against 7 real sessions: it does NOT (see CLAUDE.md 4k) — only the hint line printed
#  the threshold in °C next to a °F gauge. With the display fixed the owner KEPT 150°F:
#  warming to 165°F costs the customer another 15–20 minutes.
#  Thresholds here are ALWAYS SI (°C, km/h); the app converts to °F/mph on US units —
#  do not type 150 here. **65.56°C is EXACTLY 150°F**, so the screen reads a round
#  "150"; a plain 65°C is only 149°F and would not match the step name.
ten=Standard engine test
ghi_giay_toi_da=1200

[buoc]
ten=Key on
huong_dan=Park somewhere safe, set the parking brake, shift to neutral. Turn the key ON but do NOT start the engine. Wait a few seconds.
cho=vong_quay<=100
giu=4
bo_qua_duoc=1
# 04/09: connecting with the engine ALREADY RUNNING makes this step impossible (Mack
# 03/09 hung 453 s, 12 steps never reached) — engine running 3 s straight auto-skips it.
tu_bo_qua=vong_quay>=400
ghi_chu=Reads fault codes + ECM identity before the engine runs

[buoc]
ten=Start the engine
huong_dan=Start the engine and let it idle.
cho=vong_quay>=400
giu=5

[buoc]
ten=Warm up to 150°F (65.6°C)
huong_dan=Let the engine run until the COOLANT gauge reaches 150°F (65.6°C). A few light throttle blips are fine. A cold engine gives numbers you cannot compare.
cho=nhiet_nuoc>=65.56
giu=3
bo_qua_duoc=1

[buoc]
ten=Hot idle
huong_dan=Take your foot off the throttle completely and let the engine idle steadily for 30 seconds.
cho=vong_quay>=350;vong_quay<=950;chan_ga<=5
giu=30
bo_qua_duoc=1
kiem=vong_quay|Idle speed||
kiem=ap_dau|Oil pressure at idle||
kiem=luong_phun|Fuel rate at idle||
kiem=dien_ap_ac_quy|Alternator voltage||

[buoc]
ten=Pull at 1,400–1,800 rpm
che_do=duong
huong_dan=Put it in gear / under load. Hold the throttle so the RPM needle stays in the GREEN ZONE 1,400–1,800 with load above 70%. Hold steady for 45 seconds.
cho=vong_quay>=1400;vong_quay<=1800;tai_pc>=70
giu=45
bo_qua_duoc=1
kiem=ap_tang_ap|Boost under load||
kiem=ap_dau|Oil pressure under load||
kiem=ap_rail|Rail pressure under load||

[buoc]
ten=Full throttle pull
che_do=duong
huong_dan=Somewhere safe, push the throttle ALL the way and hold the engine near its rated speed — above 90 % of the rated speed the ECM reports (2,300 rpm if it reports none) — for 25 seconds. This is the power-curve run.
# 25/09: threshold follows the rated speed the ECM reports (SPN 528) - Class 8 engines governed at 1,600-2,100 rpm never reach a fixed 2,300.
cho=vong_quay>=vong_quay_dinh_muc_khai*0.9?2300;chan_ga>=90
giu=25
bo_qua_duoc=1
kiem=ap_tang_ap|Boost at full throttle||
kiem=luong_phun|Fuel rate at full throttle||

# ────────────────────────────────────────────────────────────────────────────
#  ROAD SECTION — the next four steps NEED THE TRUCK MOVING.
#
#  Why they exist: cruise control and the engine brake only work while the
#  truck is rolling. Idling in the yard, the ECM still declares "brake present,
#  capacity −65%" but never proves it ENGAGES. When a customer says "lost the
#  engine brake" or "lost cruise", these steps are what settle it.
#
#  ⚠ SAFETY: a real driver at the wheel, an empty road, and whoever holds the
#    laptop RIDES IN THE PASSENGER SEAT. Nobody drives and watches a screen.
#    Can't do a step? Press "Skip step" — the report records it as skipped,
#    never as passed.
#
#  Truck that cannot go on the road (stationary power unit, generator set, in
#  the shop) — skip all four; the rest of the report is still complete.
# ────────────────────────────────────────────────────────────────────────────

[buoc]
ten=Road — reach 25 mph
che_do=duong
huong_dan=Get out on an empty road. Bring the truck above 25 mph and hold steady for 20 seconds. This just sets up the three steps that follow.
cho=toc_do_xe>=40
giu=20
bo_qua_duoc=1
ghi_chu=Cruise and engine brake only work while the truck is rolling
kiem=toc_do_xe|Road speed||
kiem=ap_tang_ap|Boost on the road||
kiem=tai_pc|Load on the road||
kiem=luu_luong_khi_nap|Air flow on the road||

[buoc]
ten=Engage cruise control
che_do=duong
huong_dan=Above 25 mph, switch CRUISE on and press SET. Take your foot off the throttle and let cruise hold the speed for 15 seconds. Do NOT touch the brake or clutch — either one drops cruise instantly.
cho=cruise_dang_an=1;toc_do_xe>=40
giu=15
bo_qua_duoc=1
ghi_chu=Answers "lost cruise control" — does it actually engage, not just report present
kiem=cruise_toc_do_dat|Cruise set speed||
kiem=toc_do_xe|Road speed while cruise holds||
kiem=chan_ga|Throttle while cruise holds||
kiem=vong_quay|Engine speed while cruise holds||

[buoc]
ten=Drop cruise with the brake
che_do=duong
huong_dan=Tap the brake pedal once. Cruise must drop out immediately. If cruise keeps holding, the brake switch is faulty — note it down.
cho=cruise_dang_an=0;toc_do_xe>=20
giu=5
bo_qua_duoc=1
ghi_chu=Checks that the brake switch really cancels cruise

[buoc]
ten=Engine brake / exhaust brake
che_do=duong
huong_dan=Get above 30 mph, drop a gear so the engine turns above 1,800 rpm, then LIFT OFF the throttle completely and switch the engine brake ON. Do NOT use the service brake. Hold 12 seconds and let the truck slow itself.
cho=momen_phanh_thuc_pc<=-5;chan_ga<=3
giu=12
bo_qua_duoc=1
ghi_chu=Answers "lost the engine brake" — measures braking torque actually produced
kiem=momen_phanh_thuc_pc|Retarder torque actually used||
kiem=kha_nang_phanh_pc|Retarder capacity ECM declares||
kiem=vong_quay|Engine speed while retarding||
kiem=toc_do_xe|Road speed while retarding||

[buoc]
ten=Pull under load on the road
che_do=duong
huong_dan=Back into a pulling gear, open the throttle until load is above 70% and hold 30 seconds — uphill is best. This gives smoke and boost numbers far closer to real life than a yard test.
cho=toc_do_xe>=30;tai_pc>=70
giu=30
bo_qua_duoc=1
ghi_chu=Smoke/boost measured under a real pull is what compares between two tunes
kiem=ap_tang_ap|Boost pulling on the road||
kiem=luu_luong_khi_nap|Air flow pulling on the road||
kiem=luu_luong_egr|EGR flow pulling on the road||
kiem=luong_phun|Fuel rate pulling on the road||
kiem=vong_quay_tang_ap|Turbo speed pulling||
kiem=nhiet_khi_xa|Exhaust temperature pulling||

[buoc]
ten=Cool down
huong_dan=Back at the yard, release the throttle and let the engine idle for 30 seconds so the turbo cools down before you shut it off.
cho=vong_quay<=950
giu=30
bo_qua_duoc=1

# ────────────────────────────────────────────────────────────────────────────
#  LAST STEP — CLEAR FAULT CODES (owner's call, 03/09/2026)
#
#  With the engine RUNNING no software can clear codes, not even inactive ones —
#  the ECUs answer "access denied". So this step makes you shut the engine off
#  first, key still ON (turning the key off drops the link and the ECUs stop
#  listening).
#
#  The app sends DM11 + DM3 to each ECU by address and then broadcast, re-asks
#  DM2 + DM28 at 3 s and 8 s, and concludes at 15 s. Only STORED (inactive)
#  codes can be cleared; active codes come straight back (the cause is still
#  there) and PERMANENT codes (DM28) are not cleared by DM11/DM3 — that takes
#  the OEM tool (DDDL) or the ECU drops them after enough clean drive cycles.
# ────────────────────────────────────────────────────────────────────────────

[buoc]
ten=Shut down — clear fault codes
huong_dan=SHUT THE ENGINE OFF but LEAVE THE KEY ON. The engine must be fully stopped before the ECUs will accept a clear. Wait for the app to finish before switching the key off.
cho=vong_quay<=30
giu=3
xoa_ma=1
bo_qua_duoc=1
ghi_chu=Only stored (inactive) codes can be cleared; active codes return at once and PERMANENT codes (DM28) need the OEM tool (DDDL)
