28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/obd/command.rb', line 28
def self.pids
{
pids_supported_1: lambda {|x| x.to_s(2).split('').each_with_index.map{|b,i| pids.keys[i] if b == '1'}},
monitor_status_since_clear: lambda {|x| x.to_s},
freeze_dtc: lambda {|x| x.to_s},
fuel_system_status: lambda {|x| x.to_s},
calculated_engine_load: lambda {|x| "%0.2f" % (x * 100.0 / 255.0) + '%'},
engine_coolent_temperature: lambda {|x| "%0.2f" % (x * 1.8 - 104) + '*F'},
short_term_fuel_trim_bank_1: lambda {|x| "%0.2f" % (x * 0.78125 - 100) + '%'},
long_term_fuel_trim_bank_1: lambda {|x| "%0.2f" % (x * 0.78125 - 100) + '%'},
short_term_fuel_trim_bank_2: lambda {|x| "%0.2f" % (x * 0.78125 - 100) + '%'},
long_term_fuel_trim_bank_2: lambda {|x| "%0.2f" % (x * 0.78125 - 100) + '%'},
fuel_pressure: lambda {|x| "%0.2f" % (x * 3 * 0.145) + 'psi'},
intake_manifold_absolute_pressure: lambda {|x| "%0.2f" % (x * 0.145) + 'psi'},
engine_rpm: lambda {|x| "%0.2f" % (x / 4.0) + 'rpm'},
vehicle_speed: lambda {|x| "%0.2f" % (x * 0.621371192) + 'mph'},
timing_advance: lambda {|x| "%0.2f" % (x / 2.0 - 64) + '*'},
intake_air_temperature: lambda {|x| "%0.2f" % (x * 1.8 - 104) + '*F'},
maf_air_flow_rate: lambda {|x| "%0.2f" % (x / 100.0) + 'grams/sec'},
throttle_position: lambda {|x| "%0.2f" % (x * 100 / 255.0) + '%'},
commanded_secondary_air_status: lambda {|x| x}, oxygen_sensors_present: lambda {|x| x}, bank_1_sensor_1_oxygen_sensor_voltage: lambda {|x| x},
bank_1_sensor_2_oxygen_sensor_voltage: lambda {|x| x},
bank_1_sensor_3_oxygen_sensor_voltage: lambda {|x| x},
bank_1_sensor_4_oxygen_sensor_voltage: lambda {|x| x},
bank_2_sensor_1_oxygen_sensor_voltage: lambda {|x| x},
bank_2_sensor_2_oxygen_sensor_voltage: lambda {|x| x},
bank_2_sensor_3_oxygen_sensor_voltage: lambda {|x| x},
bank_2_sensor_4_oxygen_sensor_voltage: lambda {|x| x},
obd_standards_vehicle_conforms_to: lambda {|x| x}, oxygen_sensors_present_2: lambda {|x| x}, aux_input_status: lambda {|x| (x == 1).inspect}, run_time_since_engine_start: lambda {|x| x}, pids_supported_2: lambda {|x| x.to_s(2).split('').each_with_index.map{|b,i| pids.keys[i+33] if b == '1'}}, distance_traveled_with_mil_on: lambda {|x| x.to_s + 'km'}
}
end
|