Initial Commit
This commit is contained in:
@@ -0,0 +1,482 @@
|
||||
namespace TuneBoss.Core.Models;
|
||||
|
||||
/// <summary>
|
||||
/// All ECU configuration parameters outside the 2D/1D tuning tables.
|
||||
///
|
||||
/// Five memory regions, each read via APP_MEMRD_MISC. Addresses from
|
||||
/// GenerationConfig; regions beyond Core gated on EcuInfo.FwVersion >= 150.
|
||||
///
|
||||
/// Region Address field Size FW gate
|
||||
/// ──────────── ───────────────────────── ─────── ────────
|
||||
/// Core miscValStartAddress 136 B always
|
||||
/// LaunchFuel extraPaddingStartAddress 12 B FW >= 150
|
||||
/// LaunchFuel2 extraPaddingStartAddress2 12 B FW >= 150
|
||||
/// AuxOut extraPaddingStartAddress3 12 B FW >= 150
|
||||
/// Extended extraPaddingStartAddress4 var B FW >= 150
|
||||
/// (FW2_SubVersion & 0x80) == 0 → 0x73 (116 B, up to Ex(115))
|
||||
/// (FW2_SubVersion & 0x80) != 0 → 0x97 (152 B, full set)
|
||||
///
|
||||
/// Extended label map is authoritative — derived from:
|
||||
/// READ: UpdateMiscValuesExtraPadding4New() in Form1_Utils.cs
|
||||
/// WRITE: getMiscValByteArrayExtraPadding4New() in Form1_TableHandling.cs
|
||||
/// LABELS: Designer.cs parsed per inner tab of tabControl14 (Spark/TC/ISM/
|
||||
/// AIS/O2Heater/O2Autotune/MCU Tacho/VVA) inside tabPage93.
|
||||
/// Each inner tab parsed independently to avoid cross-column pollution.
|
||||
/// </summary>
|
||||
public sealed class MiscValues
|
||||
{
|
||||
// ── Raw memory regions ───────────────────────────────────────────────────
|
||||
public byte[] Core { get; init; } = new byte[136];
|
||||
public byte[] LaunchFuel { get; init; } = Array.Empty<byte>();
|
||||
public byte[] LaunchFuel2 { get; init; } = Array.Empty<byte>();
|
||||
public byte[] AuxOut { get; init; } = Array.Empty<byte>();
|
||||
public byte[] Extended { get; init; } = Array.Empty<byte>();
|
||||
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// CORE — 136 bytes (tabControl4, tabPage3 through tabPage2)
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
|
||||
// ── Crank [0–11] ─────────────────────────────────────────────────────────
|
||||
public byte Crank_Teeth => Core[0];
|
||||
public byte Crank_Missing_Teeth => Core[1];
|
||||
public byte Crank_Detect_Edge => Core[2];
|
||||
public byte CrankTooth_Positive_Period_Pct => Core[3];
|
||||
public byte CrankTooth_Negative_Period_Pct => Core[4];
|
||||
public byte Crank_Timeout_Pct => Core[5];
|
||||
public byte Crank_CamSync_Detect_Method => Core[6];
|
||||
public byte Crank_CamSync_Detect_Cycle => Core[7];
|
||||
// [8] reserved
|
||||
public byte Crank_CamSync_MAP_Detect_Cycle => Core[9];
|
||||
public byte Crank_CamSync_Rotation_Tooth => Core[10];
|
||||
public byte Crank_CamSync_Num_Fast_Rotations => Core[11];
|
||||
|
||||
// ── RPM [12–22] ──────────────────────────────────────────────────────────
|
||||
public byte RPM_Limit_div100 => Core[12];
|
||||
public byte RPM_Limit_Recovery_div100 => Core[13];
|
||||
public byte RPM_Limit_Failsafe_div100 => Core[14];
|
||||
public byte RPM_Limit_Failsafe_Recovery_div100 => Core[15];
|
||||
public byte RPM_Detect_Min_div100 => Core[16];
|
||||
public byte RPM_Detect_Min_Recovery_div100 => Core[17];
|
||||
public byte RPM_Stall_div100 => Core[18];
|
||||
public byte RPM_Stall_Recovery_div100 => Core[19];
|
||||
public byte RPM_Decel_Threshold_PerSec_div100 => Core[20];
|
||||
public byte RPM_Accel_Threshold_PerSec_div100 => Core[21];
|
||||
public byte RPM_Meter_Divider => Core[22];
|
||||
public int RPM_Limit => RPM_Limit_div100 * 100;
|
||||
|
||||
// ── Fuel [23–32] ─────────────────────────────────────────────────────────
|
||||
public byte Fuel_Settings => Core[23];
|
||||
public byte Fuel_Max_PW_Mult => Core[24];
|
||||
// [25] reserved
|
||||
public byte Fuel_Cut_Min_LOAD => Core[26];
|
||||
public byte Fuel_Cut_Min_TPS_pct => Core[27];
|
||||
public byte Fuel_Cut_Min_RPM_div100 => Core[28];
|
||||
public byte Fuel_Cut_Disable_LOAD => Core[29];
|
||||
public byte Fuel_Cut_Min_Etemp_degC => Core[30];
|
||||
// [31] reserved
|
||||
public byte VBAT_Trim_deciV => Core[32];
|
||||
|
||||
// ── O2 Sensor / Autotune [33–47] ─────────────────────────────────────────
|
||||
// [33] reserved
|
||||
public byte O2_Sensor_Sample_Rate_ms => Core[34];
|
||||
public byte O2_Sensor_Delay_ms_div5 => Core[35];
|
||||
public byte O2_Fuel_Max_Add_Pct => Core[36];
|
||||
public byte O2_Fuel_Max_Sub_Pct => Core[37];
|
||||
public byte O2_Autotune_Max_RPM_div100 => Core[38];
|
||||
public byte O2_Autotune_Min_RPM_div100 => Core[39];
|
||||
public byte O2_Autotune_Max_Load => Core[40];
|
||||
public byte O2_Autotune_Min_Load => Core[41];
|
||||
public byte O2_Autotune_StepUp_Pct => Core[42];
|
||||
public byte O2_Autotune_Average_Weight => Core[43];
|
||||
public byte O2_Autotune_AFR_x10_Diff => Core[44];
|
||||
public byte O2_Autotune_Start_Delay_s => Core[45];
|
||||
public byte O2_Autotune_Min_ETemp => Core[46];
|
||||
public byte O2_Autotune_Max_ETemp => Core[47];
|
||||
|
||||
// ── TPS [48–55] ──────────────────────────────────────────────────────────
|
||||
public byte TPS_Accel_Threshold_PctPer100ms => Core[48];
|
||||
public byte TPS_Decel_Threshold_PctPer100ms => Core[49];
|
||||
public byte TPS_Threshold_10ms_sample_gap => Core[50];
|
||||
public byte TPS_Accel_Fuel_Adjust_Hold_Time_10ms => Core[51];
|
||||
public byte TPS_Accel_Fuel_Adjust_Decay_Time_10ms => Core[52];
|
||||
public byte TPS_Accel_Spark_Adjust_Hold_Time_10ms => Core[53];
|
||||
public byte TPS_Accel_Spark_Adjust_Decay_Time_10ms => Core[54];
|
||||
public byte TPS_Steady_State_Delay_Time_10ms => Core[55];
|
||||
|
||||
// ── MAP [56–66] ──────────────────────────────────────────────────────────
|
||||
public byte MAP_Settings => Core[56];
|
||||
public byte MAP_Lo_Hyst_Mult => Core[57];
|
||||
public byte MAP_Ref_Temp_DegC => Core[58];
|
||||
public byte MAP_Intake_Tooth_End => Core[59];
|
||||
public byte MAP_Intake_Num_Teeth => Core[60];
|
||||
public byte MAP_Baro_Tooth_End => Core[61];
|
||||
public byte MAP_Baro_Num_Teeth => Core[62];
|
||||
public byte MAP_Baro_RPM_div100_Limit => Core[63];
|
||||
public byte MAP_Baro_TPS_Limit => Core[64];
|
||||
public byte MAP_Baro_Static_Delay_10ms => Core[65];
|
||||
public byte MAP_Settings2 => Core[66];
|
||||
|
||||
// ── Radiator / Overheat [67–71] ──────────────────────────────────────────
|
||||
public byte RadFan_On_Temp_DegC => Core[67];
|
||||
public byte RadFan_Off_Temp_DegC => Core[68];
|
||||
public byte Etemp_Overheat_On_Temp_DegC => Core[69];
|
||||
public byte Etemp_Overheat_Off_Temp_DegC => Core[70];
|
||||
public byte Etemp_Sensor_Error_Temp => Core[71];
|
||||
|
||||
// ── Bluetooth / MC33814 [72–77] ──────────────────────────────────────────
|
||||
public byte Bluetooth_PowerOn_Timeout_s => Core[72];
|
||||
public byte MC33814_Init_Delay_10ms => Core[73];
|
||||
public byte MC33814_Tacho_Control => Core[74];
|
||||
public byte MC33814_VRS_Misc_Params => Core[75];
|
||||
public byte MC33814_Cfg_VRS_Manual_Control => Core[76];
|
||||
public byte MC33814_Ctrl_VRS_Conditioner => Core[77];
|
||||
|
||||
// ── Fuel Pump / Solenoid [78–83] ─────────────────────────────────────────
|
||||
public byte Fuel_Pump_Timeout_100ms => Core[78];
|
||||
public byte Idle_Solenoid_Off_Tooth => Core[79];
|
||||
public byte Idle_Solenoid_Reset_RPM_div100 => Core[80];
|
||||
public byte Idle_Solenoid_Step_Down => Core[81];
|
||||
public byte Idle_Solenoid_PID_Kp => Core[82];
|
||||
public byte Idle_Solenoid_Min_Open_Angle_deg => Core[83];
|
||||
|
||||
// ── ShiftBoss [84–93] ────────────────────────────────────────────────────
|
||||
public byte ShiftBoss_Enable => Core[84]; // byte 84 = enable flags (see MiscBitSpecRegistry); real retard deg = ShiftBoss_Spark_Retard_deg & 0x7F
|
||||
public byte ShiftBoss_Fuel_Cut_ms => Core[85];
|
||||
public byte ShiftBoss_Spark_Cut_ms => Core[86];
|
||||
public byte ShiftBoss_Spark_Retard_ms => Core[87];
|
||||
public byte ShiftBoss_Spark_Retard_deg => Core[88];
|
||||
public byte ShiftBoss_Interval_Time_10ms => Core[89];
|
||||
public byte ShiftBoss_Min_RPM_div100 => Core[90];
|
||||
public byte ShiftBoss_Input_Active_High => Core[91];
|
||||
public byte ShiftBoss_Input_Debounce_ms => Core[92];
|
||||
public byte ShiftBoss_Autotrigger_RPM_div100 => Core[93];
|
||||
|
||||
// ── Load selection [94–100] ──────────────────────────────────────────────
|
||||
public byte Load_Primary_Select => Core[94];
|
||||
public byte Load_Fuel_PulseWidth1_Select => Core[95];
|
||||
public byte Load_Spark_Angle1_Select => Core[96];
|
||||
public byte Load_AFR_Target1_Select => Core[97];
|
||||
public byte Load_Fuel_Angle2D_Select => Core[98];
|
||||
public byte Load_Fuel_PulseWidth_Adjust1_Select => Core[99];
|
||||
public byte Load_Spark_Angle_Adjust1_Select => Core[100];
|
||||
|
||||
// ── Extended config [101–135] ─────────────────────────────────────────────
|
||||
public byte VBAT_Min_deciV => Core[101];
|
||||
public byte VBAT_Max_deciV => Core[102];
|
||||
public byte O2_Sensor_Present => Core[103];
|
||||
public byte VDS_Present => Core[104];
|
||||
public byte TPS_Accel_Taper_Start_RPM_div100 => Core[105];
|
||||
public byte TPS_Accel_Taper_End_RPM_div100 => Core[106];
|
||||
public byte Error_Check_Startup_Delay => Core[107];
|
||||
public byte ErrorLog_Recording_Delay => Core[108];
|
||||
public byte ShiftLight_On_RPM_div100 => Core[109];
|
||||
public byte ShiftLight_Off_RPM_div100 => Core[110];
|
||||
public byte ShiftLight_Output_Select => Core[111];
|
||||
public byte MC33814_Lamp_Config => Core[112];
|
||||
public byte MC33814_O2H_Config => Core[113];
|
||||
public byte VBAT_Longterm_Min_DeciV => Core[114];
|
||||
public byte ErrorLog_MC33814_Mask_Lo => Core[115];
|
||||
public byte ErrorLog_MC33814_Mask_Hi => Core[116];
|
||||
public byte ErrorLog_MC33814_EngineOff_Enable => Core[117];
|
||||
public byte ErrorLog_MC33814_OL_Hysteresis => Core[118];
|
||||
public byte ErrorLog_MC33814_Killswitch_Mask => Core[119];
|
||||
// [120] reserved
|
||||
public byte TPS_Accel_Fuel_TempComp => Core[121];
|
||||
public byte TPS_Accel_Threshold_Fast_PctPer100ms => Core[122];
|
||||
public byte TPS_Decel_Fuel_Adjust_Pct => Core[123];
|
||||
public byte TPS_Accel_Modifier_Cyclecount => Core[124];
|
||||
public byte TPS_Accel_Threshold_SuperFast_PctPer100ms => Core[125];
|
||||
// [120, 126–131] distinct settings/log bytes — named via MiscFieldRegistry, bound raw in the VM
|
||||
public byte Start_Fuel_Enrichment_Decay_100ms => Core[132];
|
||||
public byte TPS_Accel_Recursive_Accel => Core[133];
|
||||
public byte Idle_Solenoid_Reset_Timeout_100ms => Core[134];
|
||||
public byte Speed_Adjust_Percent => Core[135];
|
||||
|
||||
public int ShiftLight_On_RPM => ShiftLight_On_RPM_div100 * 100;
|
||||
public int ShiftLight_Off_RPM => ShiftLight_Off_RPM_div100 * 100;
|
||||
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// LAUNCHFUEL — 12 bytes (spark/fuel reference angles + init)
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
public byte? RPM_Table_2Samplepoint_div100 => Lf(0);
|
||||
public byte? Fuel_Init_Cycles => Lf(1);
|
||||
public byte? Idle_Solenoid_Settings => Lf(2);
|
||||
public byte? Spark_Ref_Angle_Lo => Lf(3);
|
||||
public byte? Spark_Ref_Angle_Hi => Lf(4);
|
||||
public byte? Fuel_Ref_Angle_Lo => Lf(5);
|
||||
public byte? Fuel_Ref_Angle_Hi => Lf(6);
|
||||
public byte? Fuel_Base_PW_ms_x10 => Lf(7);
|
||||
public byte? Spark2_Ref_Angle_Lo => Lf(8);
|
||||
public byte? Spark2_Ref_Angle_Hi => Lf(9);
|
||||
public byte? Fuel2_Ref_Angle_Lo => Lf(10);
|
||||
public byte? Fuel2_Ref_Angle_Hi => Lf(11);
|
||||
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// LAUNCHFUEL2 — 12 bytes (launch control + rad fan)
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
public byte? LF2_TBD_Unused => Lf2(0);
|
||||
public byte? LaunchBoss_Enable => Lf2(1);
|
||||
public byte? LaunchBoss_Settings => Lf2(2);
|
||||
public byte? LaunchBoss_RPM_Limit_Start_div100 => Lf2(3);
|
||||
public byte? LaunchBoss_RPM_Limit_End_div100 => Lf2(4);
|
||||
public byte? LaunchBoss_RPM_Persec_Up_Rate_div100 => Lf2(5);
|
||||
public byte? LaunchBoss_RPM_Up_Speed_Start_kph => Lf2(6);
|
||||
public byte? LaunchBoss_Speed_End_kph => Lf2(7);
|
||||
public byte? LaunchBoss_Spark_Retard_deg => Lf2(8);
|
||||
public byte? LF2_RadFan_Settings => Lf2(9);
|
||||
public byte? LF2_RadFan_PWM_Width_100ms => Lf2(10);
|
||||
public byte? Analog_Safe_Mode_Trigger => Lf2(11);
|
||||
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// AUXOUT — 12 bytes
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
public byte? AuxOut_Control => Ao(0);
|
||||
public byte? AuxOut_Control2 => Ao(1);
|
||||
public byte? RadFan_On_Temp_NOS_RPM => Ao(2);
|
||||
public byte? RadFan_Off_Temp_NOS_TPS => Ao(3);
|
||||
public byte? NOS_Speed => Ao(4);
|
||||
public byte? AuxOut_Ref_Value2_Off => Ao(5);
|
||||
public byte? AuxOut_Delay1_10ms => Ao(6);
|
||||
public byte? AuxOut_Delay2_10ms => Ao(7);
|
||||
public byte? Idle_Threshold_TPS => Ao(8);
|
||||
public byte? Idle_Threshold_RPM_div100 => Ao(9);
|
||||
public byte? Spark_Dwell_Max_100us => Ao(10);
|
||||
public byte? Spark_Dwell_Min_100us => Ao(11);
|
||||
public int? AuxOut_Mode_Index => AuxOut_Control is byte b && b <= 3 ? (int?)b : null;
|
||||
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// EXTENDED — variable size
|
||||
//
|
||||
// Buffer index → textbox → label, sourced from:
|
||||
// READ: UpdateMiscValuesExtraPadding4New() (Form1_Utils.cs)
|
||||
// WRITE: getMiscValByteArrayExtraPadding4New() (Form1_TableHandling.cs)
|
||||
// LABELS: Designer.cs per-inner-tab parsing of tabControl14 inside tabPage93
|
||||
//
|
||||
// Y15 [0–41] — always present when Extended is non-empty
|
||||
// R25 [42–115] — EcuVariant >= TwoCylinder
|
||||
// R15 [116–151]— EcuVariant == TwoCylinderR15
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
|
||||
// ── Y15: Spark tab [0–17] ────────────────────────────────────────────────
|
||||
public byte? Spark_Dwell_Reduction_10us => Ex(0); // textBox261
|
||||
public byte? Spark_Dwell_Min_Deg => Ex(1); // textBox262
|
||||
public byte? Spark_Dwell_Max_Deg_div4 => Ex(2); // textBox263
|
||||
public byte? Spark_Dwell_Reserved1 => Ex(3); // textBox264
|
||||
public byte? Crank_MissingTooth2_Pos_Period_Mult => Ex(4); // textBox265
|
||||
public byte? Crank_MissingTooth2_Neg_Period_Mult => Ex(5); // textBox266
|
||||
public byte? Crank_MissingTooth_Pos_Period_Mult => Ex(6); // textBox267
|
||||
public byte? Crank_MissingTooth_Neg_Period_Mult => Ex(7); // textBox268
|
||||
public byte? VRS_Threshold_Lo_RPM_div100 => Ex(8); // textBox269
|
||||
public byte? VRS_Threshold_Hi_RPM_div100 => Ex(9); // textBox270
|
||||
public byte? Spark_Cut_Retard1_RPM_Gap_div100 => Ex(10); // textBox271
|
||||
public byte? Spark_Cut_Retard2_RPM_Gap_div100 => Ex(11); // textBox272
|
||||
public byte? Spark_Cut_Retard1 => Ex(12); // textBox273
|
||||
public byte? Spark_Cut_Retard2 => Ex(13); // textBox274
|
||||
public byte? CrankTooth_Pos_Period_Mult_Run => Ex(14); // textBox275
|
||||
public byte? CrankTooth_Neg_Period_Mult_Run => Ex(15); // textBox276
|
||||
public byte? Gear_Ratio_Hysteresis_Count => Ex(16); // textBox277
|
||||
public byte? Gear_Ratio_min_RPM_div100 => Ex(17); // textBox278
|
||||
|
||||
// ── Y15: TC tab [18–41] ──────────────────────────────────────────────────
|
||||
public byte? TC_Settings1 => Ex(18); // textBox279
|
||||
public byte? TC_Settings2 => Ex(19); // textBox280
|
||||
public byte? TC_Rpm_Min_div100 => Ex(20); // textBox281
|
||||
public byte? TC_Rpm_Max_div100 => Ex(21); // textBox282
|
||||
public byte? TC_TPS_Min => Ex(22); // textBox283
|
||||
public byte? TC_TPS_Max => Ex(23); // textBox284
|
||||
public byte? TC_Speed_Min => Ex(24); // textBox285
|
||||
public byte? TC_Speed_Max => Ex(25); // textBox286
|
||||
public byte? TC_Consecutive_Error_Trigger => Ex(26); // textBox287
|
||||
public byte? TC_Retard_Off_Ramp_deg_per100ms => Ex(27); // textBox288
|
||||
public byte? TC_Table_Input_Selection => Ex(28); // textBox289
|
||||
public byte? TC_Sample_Rate_ms => Ex(29); // textBox290
|
||||
public byte? TC_Speed_Tooth_Skip => Ex(30); // textBox291
|
||||
public byte? TC_Tooth_Average_Count => Ex(31); // textBox292
|
||||
public byte? TC_Tooth_Compare_Count => Ex(32); // textBox293
|
||||
public byte? TC_Gear_Max => Ex(33); // textBox294
|
||||
public byte? TC_Button_Modes => Ex(34); // textBox295
|
||||
public byte? TC_Button_Sensitivity_Modifier => Ex(35); // textBox296
|
||||
public byte? TC_Button_Delay_100ms => Ex(36); // textBox297
|
||||
public byte? TC_Tooth_Undriven_Count => Ex(37); // textBox298
|
||||
public byte? TC_Reserved6 => Ex(38); // textBox299
|
||||
public byte? Offthrottle_Threshold_TPS => Ex(39); // textBox300
|
||||
public byte? Idle_Rumble_Min_Rpm_div100 => Ex(40); // textBox301
|
||||
public byte? Speed_Settings1 => Ex(41); // textBox302
|
||||
|
||||
// ── R25: ISM tab [42–75] ─────────────────────────────────────────────────
|
||||
public byte? ISM_Settings1 => Ex(42); // textBox303
|
||||
public byte? ISM_Startup_Delay_10ms => Ex(43); // textBox304 ✓
|
||||
public byte? ISM_Max_Steps_Lo => Ex(44); // textBox305
|
||||
public byte? ISM_Max_Steps_Hi => Ex(45); // textBox306
|
||||
public byte? ISM_CR0_Init => Ex(46); // textBox307
|
||||
public byte? ISM_CR1_Init => Ex(47); // textBox308
|
||||
public byte? ISM_CR2_Init => Ex(48); // textBox309
|
||||
public byte? ISM_Test_Step_Lo => Ex(49); // textBox310 ✓
|
||||
public byte? ISM_Test_Step_Hi => Ex(50); // textBox311
|
||||
public byte? ISM_Off_Delay_10ms => Ex(51); // textBox312
|
||||
public byte? ISM_Max_Open_Steps_Per_Cycle => Ex(52); // textBox313
|
||||
public byte? ISM_Max_Close_Steps_Per_Cycle => Ex(53); // textBox314
|
||||
public byte? ISM_CR0_Run => Ex(54); // textBox315
|
||||
public byte? ISM_CR0_Hold => Ex(55); // textBox316
|
||||
public byte? ISM_Calibrate_Overshoot_Steps => Ex(56); // textBox317
|
||||
public byte? ISM_PID_Delay_5ms => Ex(57); // textBox318
|
||||
public byte? ISM_PID_Kp_lo => Ex(58); // textBox319
|
||||
public byte? ISM_PID_Kp_hi => Ex(59); // textBox320
|
||||
public byte? ISM_PID_Ki_lo => Ex(60); // textBox321
|
||||
public byte? ISM_PID_Ki_hi => Ex(61); // textBox322
|
||||
public byte? ISM_PID_Kd_lo => Ex(62); // textBox323
|
||||
public byte? ISM_PID_Kd_hi => Ex(63); // textBox324
|
||||
public byte? ISM_PID_Error_Threshold => Ex(64); // textBox325
|
||||
public byte? ISM_PID_Config => Ex(65); // textBox326
|
||||
public byte? ISM_Start_Boost_Step_raw => Ex(66); // textBox327
|
||||
public byte? ISM_Stall_Boost_Step_raw => Ex(67); // textBox328
|
||||
public byte? ISM_Start_Boost_Step_Delay_100ms => Ex(68); // textBox329
|
||||
public byte? ISM_Stall_Boost_Step_Delay_100ms => Ex(69); // textBox330
|
||||
public byte? ISM_Stall_Boost_RPM_div100 => Ex(70); // textBox331
|
||||
public byte? ISM_Boost_Step_Mult => Ex(71); // textBox332
|
||||
public byte? ISM_PID_Gain_Mult => Ex(72); // textBox333
|
||||
public byte? ISM_PID_Gain_Div_ShiftRight => Ex(73); // textBox334
|
||||
public byte? ISM_PID_RPM_Rampdown_Rate => Ex(74); // textBox335
|
||||
public byte? ISM_Rsvd22 => Ex(75); // textBox336
|
||||
|
||||
// ── R25: AIS tab [76–83] ─────────────────────────────────────────────────
|
||||
public byte? AIS_Settings1 => Ex(76); // textBox337
|
||||
public byte? AIS_Settings2 => Ex(77); // textBox338
|
||||
public byte? AIS_RPM_Threshold1 => Ex(78); // textBox339
|
||||
public byte? AIS_TPS_Threshold1 => Ex(79); // textBox340
|
||||
public byte? AIS_RPM_Threshold2 => Ex(80); // textBox341
|
||||
public byte? AIS_TPS_Threshold2 => Ex(81); // textBox342
|
||||
public byte? AIS_RPM_Threshold3 => Ex(82); // textBox343
|
||||
public byte? AIS_TPS_Threshold3 => Ex(83); // textBox344
|
||||
|
||||
// ── R25: O2Heater tab [84–99] ────────────────────────────────────────────
|
||||
public byte? AIS_Delay1_10ms => Ex(84); // textBox345
|
||||
public byte? AIS_Settings10 => Ex(85); // textBox346
|
||||
public byte? ETEMP_Sensor_Sample_Rate_ms => Ex(86); // textBox347
|
||||
public byte? IAT_Sensor_Sample_Rate_ms => Ex(87); // textBox348
|
||||
public byte? O2Heater_Settings1 => Ex(88); // textBox349
|
||||
public byte? O2Heater_Settings2 => Ex(89); // textBox350
|
||||
public byte? O2Heater_Delay1_10ms => Ex(90); // textBox351
|
||||
public byte? O2Heater_Settings4 => Ex(91); // textBox352
|
||||
public byte? O2Heater_Settings5 => Ex(92); // textBox353
|
||||
public byte? O2Heater_Settings6 => Ex(93); // textBox354
|
||||
public byte? ShiftBoss_Spark_RampDown_ms => Ex(94); // textBox355
|
||||
public byte? ShiftBoss_Spark_RampUp_ms => Ex(95); // textBox356
|
||||
public byte? VBAT_UVReset_DeciV => Ex(96); // textBox357
|
||||
public byte? O2Heater_Settings10 => Ex(97); // textBox358
|
||||
public byte? LaunchBoss_Settings3 => Ex(98); // textBox359
|
||||
public byte? LaunchBoss_RPM_Limit_Fixed_div100 => Ex(99); // textBox360
|
||||
|
||||
// ── R25: O2Autotune tab [100–107] ────────────────────────────────────────
|
||||
public byte? O2_Autotune_Settings2 => Ex(100); // textBox361
|
||||
public byte? O2_Autotune_Cylinder_Correct => Ex(101); // textBox362
|
||||
public byte? O2_Autotune_Cylinder_Write => Ex(102); // textBox363
|
||||
public byte? O2_Autotune_Settings5 => Ex(103); // textBox364
|
||||
public byte? VRS_Settings1 => Ex(104); // textBox365
|
||||
public byte? MC33814_VRS_MaxVolt_Val => Ex(105); // textBox366
|
||||
public byte? MC33814_Relay1_Config => Ex(106); // textBox367
|
||||
public byte? MC33814_Relay2_Config => Ex(107); // textBox368
|
||||
|
||||
// ── R25: MCU Tacho tab [108–115] ─────────────────────────────────────────
|
||||
public byte? MCU_Tacho_Settings1 => Ex(108); // textBox369
|
||||
public byte? MCU_Tacho_Divider => Ex(109); // textBox370
|
||||
public byte? MCU_Tacho_Settings3 => Ex(110); // textBox371
|
||||
public byte? MCU_Tacho_Settings4 => Ex(111); // textBox372
|
||||
public byte? Meter_Speed_Mult => Ex(112); // textBox373
|
||||
public byte? Meter_Speed_Div => Ex(113); // textBox374
|
||||
public byte? Meter_Speed_Test => Ex(114); // textBox375
|
||||
public byte? Meter_FC_Mult => Ex(115); // textBox376
|
||||
|
||||
// ── R15: VVA tab [116–151] ───────────────────────────────────────────────
|
||||
public byte? VVA_Settings1 => Ex(116); // textBox377
|
||||
public byte? VVA_Settings2 => Ex(117); // textBox378
|
||||
public byte? VVA_Settings3 => Ex(118); // textBox379
|
||||
public byte? VVA_Settings4 => Ex(119); // textBox380
|
||||
public byte? VVA_Etemp_HiVal => Ex(120); // textBox381
|
||||
public byte? VVA_Etemp_LoVal => Ex(121); // textBox382
|
||||
public byte? VVA_EngineOn_Delay1_100ms => Ex(122); // textBox383
|
||||
public byte? VVA_EngineOn_Delay2_10ms => Ex(123); // textBox384
|
||||
public byte? VVA_On_RPM_div100 => Ex(124); // textBox385
|
||||
public byte? VVA_Off_RPM_div100 => Ex(125); // textBox386
|
||||
public byte? VVA_On_TPS_pct => Ex(126); // textBox387
|
||||
public byte? VVA_Off_TPS_pct => Ex(127); // textBox388
|
||||
public byte? VVA_On_Stage1_PWM_Pct => Ex(128); // textBox389
|
||||
public byte? VVA_On_Stage1_Delay_10ms => Ex(129); // textBox390
|
||||
public byte? VVA_On_Stage2_PWM_Pct => Ex(130); // textBox391
|
||||
public byte? VVA_On_Stage2_Delay_10ms => Ex(131); // textBox392
|
||||
public byte? VVA_On_Stage3_PWM_Pct => Ex(132); // textBox393
|
||||
public byte? VVA_On_Stage3_Delay_10ms => Ex(133); // textBox394
|
||||
public byte? VVA_On_Stage4_PWM_Pct => Ex(134); // textBox395
|
||||
public byte? VVA_On_Stage4_Delay_10ms => Ex(135); // textBox396
|
||||
public byte? VVA_On_TableSwap_Delay_ms_lo => Ex(136); // textBox397
|
||||
public byte? VVA_On_TableSwap_Delay_ms_hi => Ex(137); // textBox398
|
||||
public byte? VVA_Off_TableSwap_Delay_ms_lo => Ex(138); // textBox399
|
||||
public byte? VVA_Off_TableSwap_Delay_ms_hi => Ex(139); // textBox400
|
||||
public byte? VVA_On_Tooth => Ex(140); // textBox401
|
||||
public byte? VVA_Off_Tooth => Ex(141); // textBox402
|
||||
public byte? VVA_HiSide_Toggle_Gap_Rpm_div100 => Ex(142); // textBox403
|
||||
public byte? VVA_ErrorCheck_Delay_10ms => Ex(143); // textBox404
|
||||
public byte? VVA_Rsvd9 => Ex(144); // textBox405
|
||||
public byte? VVA_Rsvd10 => Ex(145); // textBox406
|
||||
public byte? VVA_Rsvd11 => Ex(146); // textBox407
|
||||
public byte? VVA_Rsvd12 => Ex(147); // textBox408
|
||||
public byte? MAP_Error_Value_Fixed => Ex(148); // textBox409
|
||||
public byte? TPS_Error_Value_Fixed => Ex(149); // textBox410
|
||||
public byte? Digital_Input_Mask => Ex(150); // textBox411
|
||||
public byte? Mode_Switch_Settings => Ex(151); // textBox412
|
||||
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// FACTORY
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
public static MiscValues FromPayloads(
|
||||
byte[] corePayload,
|
||||
byte[]? launchFuelPayload = null,
|
||||
byte[]? launchFuel2Payload = null,
|
||||
byte[]? auxOutPayload = null,
|
||||
byte[]? extendedPayload = null)
|
||||
{
|
||||
static byte[] Slice(byte[]? payload, int size)
|
||||
{
|
||||
if (payload == null || payload.Length < 4 + size) return Array.Empty<byte>();
|
||||
var buf = new byte[size];
|
||||
Buffer.BlockCopy(payload, 4, buf, 0, size);
|
||||
return buf;
|
||||
}
|
||||
int extSize = extendedPayload != null ? Math.Max(0, extendedPayload.Length - 4) : 0;
|
||||
return new MiscValues
|
||||
{
|
||||
Core = Slice(corePayload, 136),
|
||||
LaunchFuel = Slice(launchFuelPayload, 12),
|
||||
LaunchFuel2 = Slice(launchFuel2Payload, 12),
|
||||
AuxOut = Slice(auxOutPayload, 12),
|
||||
Extended = extendedPayload != null && extSize > 0
|
||||
? Slice(extendedPayload, extSize)
|
||||
: Array.Empty<byte>(),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extended region byte count to request. Per the legacy firmware, this is gated by
|
||||
/// bit 7 of FW2_SubVersion, NOT by bike model:
|
||||
/// (FW2_SubVersion & 0x80) != 0 → full extended set (0x97 = 152 bytes)
|
||||
/// otherwise → up to Ex(115) (0x73 = 116 bytes)
|
||||
/// </summary>
|
||||
public static byte ExtendedLengthFor(byte fw2SubVersion)
|
||||
=> (fw2SubVersion & 0x80) != 0 ? (byte)0x97 : (byte)0x73;
|
||||
|
||||
private byte? Lf(int i) => i < LaunchFuel.Length ? LaunchFuel[i] : null;
|
||||
private byte? Lf2(int i) => i < LaunchFuel2.Length ? LaunchFuel2[i] : null;
|
||||
private byte? Ao(int i) => i < AuxOut.Length ? AuxOut[i] : null;
|
||||
private byte? Ex(int i) => i < Extended.Length ? Extended[i] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bike cylinder classification — determines Extended region size.
|
||||
/// Derived from EcuInfo via TwoCylinderRegistry.
|
||||
/// </summary>
|
||||
public enum EcuVariant
|
||||
{
|
||||
SingleCylinder, // Y15, NVX etc. — Extended = 0x29
|
||||
TwoCylinder, // R25, R3, MT25 — Extended = 0x73
|
||||
TwoCylinderR15, // R15M, CBR250RR — Extended = 0x97
|
||||
}
|
||||
Reference in New Issue
Block a user