Tune Presets

Official tune presets — mechanic authored และ Smongrot staff verified. คืน delta bundle (ไม่ใช่ full fuel/ignition map)

List presets

GET /v1/tune-presets

เฉพาะ presets ที่ is_official=true เท่านั้น — draft/private presets ไม่แสดง

Query parameters

ParamTypeDefaultหมายถึง
ecu_modelstring—filter ตาม ECU family (เช่น K2TG-T21)
limitint25จำนวน (max 100)
cursorstring—opaque cursor

Example

curl "https://api.smongrot.com/v1/tune-presets?ecu_model=K2TG-T21" \
  -H "Authorization: Bearer sk_live_..."
{
  "data": [
    {
      "id": "a0000001-0000-0000-0000-00000000a001",
      "ecu_model": "K2TG-T21",
      "name": "ประหยัด",
      "icon": "🌱",
      "description_th": "ลดน้ำมันรอบกลาง 3-5% นุ่มกว่า เดินทางไกล",
      "deltas": [
        { "table_label": "Fuel Map (รอบกลาง)", "delta": -4.0, "unit": "%" },
        { "table_label": "Fuel Map (รอบสูง)", "delta": -2.5, "unit": "%" },
        { "table_label": "Ignition (รอบกลาง)", "delta": 1.5, "unit": "°" }
      ],
      "validated_on": 24,
      "created_at": "2026-06-01T00:00:00Z"
    }
  ],
  "count": 1,
  "next_cursor": null
}

Get single preset

GET /v1/tune-presets/:id

Example

curl "https://api.smongrot.com/v1/tune-presets/a0000001-0000-0000-0000-00000000a001" \
  -H "Authorization: Bearer sk_live_..."

Returns the same object as list.

Response fields

FieldTypeหมายถึง
iduuidPreset ID
ecu_modelstringECU family (เช่น K2TG-T21) — join กับ ecu_models.ecu_code
namestringชื่อ preset (Thai)
iconstringEmoji
description_thstringคำอธิบายภาษาไทย
deltasarrayArray of delta objects (ดูข้างล่าง)
validated_onintจำนวนคันที่ทดสอบแล้ว
created_attimestampISO 8601 UTC

Delta object

interface Delta {
  table_label: string;    // "Fuel Map (รอบกลาง)"
  delta: number;          // -4.0
  unit: "%" | "°";        // percentage หรือ degree
}

Fuel Map deltas = % ปรับ (positive = เพิ่มน้ำมัน, negative = ลด)

Ignition Timing deltas = ° (positive = จุดระเบิดเร็วขึ้น, negative = ช้าลง)

เอา delta ไปทำอะไร

Deltas = relative adjustment จาก stock values ไม่ใช่ absolute values ให้:

  1. Fetch stock map ของ ECU นั้น (จาก XDF/BIN — ไม่รวมใน API v1)
  2. Apply delta ต่อ region ตามชื่อ table_label
  3. Flash กลับ ECU

⚠️ อย่า apply preset ตรงกับรถที่ ECU ไม่ตรง — delta ที่ safe สำหรับ Wave 125i อาจไม่ safe กับ Click 125i

Errors

  • 404 not_found — preset id ไม่มี หรือ is_official=false
  • 401 unauthorized
  • 429 rate_limit_exceeded

ทำไมไม่มี full fuel/ignition map?

API v1 = delta bundles ที่ safe และ share ได้ ไม่มี raw XDF/BIN เพื่อ:

  • ป้องกันไม่ให้ dev ที่ไม่มี license แจก tune ที่ทำเสียเครื่อง
  • เก็บ author IP ไว้ (mechanic เป็นเจ้าของ full tune)

v2 จะมี write endpoint ให้ partner shop upload full tune ผ่าน moderation pipeline