MCPcopy Create free account
hub / github.com/PowerBroker2/ELMduino / isPidSupported

Method isPidSupported

src/ELMduino.cpp:3242–3276  ·  view source on GitHub ↗

bool ELM327::isPidSupported(uint8_t pid) Description: ------------ * Checks if a particular PID is supported by the connected ECU. * This is a convenience method that selects the correct supportedPIDS_xx_xx() query and parses the bit-encoded result, returning a simple Boolean value indicating PID support from the ECU. Inputs: ------- * uint8_t pid - the PID to check for

Source from the content-addressed store, hash-verified

3240 * bool - Whether or not the queried PID is supported by the ECU.
3241*/
3242bool ELM327::isPidSupported(uint8_t pid)
3243{
3244 uint8_t pidInterval = (pid / PID_INTERVAL_OFFSET) * PID_INTERVAL_OFFSET;
3245
3246 switch (pidInterval)
3247 {
3248 case SUPPORTED_PIDS_1_20:
3249 supportedPIDs_1_20();
3250 break;
3251
3252 case SUPPORTED_PIDS_21_40:
3253 supportedPIDs_21_40();
3254 pid = (pid - SUPPORTED_PIDS_21_40);
3255 break;
3256
3257 case SUPPORTED_PIDS_41_60:
3258 supportedPIDs_41_60();
3259 pid = (pid - SUPPORTED_PIDS_41_60);
3260 break;
3261
3262 case SUPPORTED_PIDS_61_80:
3263 supportedPIDs_61_80();
3264 pid = (pid - SUPPORTED_PIDS_61_80);
3265 break;
3266
3267 default:
3268 break;
3269 }
3270
3271 if (nb_rx_state == ELM_SUCCESS)
3272 {
3273 return ((response >> (32 - pid)) & 0x1);
3274 }
3275 return false;
3276}
3277
3278double ELM327::calculator_0C() {
3279 return (double)((response_A << 8) | response_B)/4;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected