diff options
author | norly <ny-git@enpas.org> | 2019-02-18 00:34:10 +0100 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2019-02-18 00:49:16 +0100 |
commit | f0002fd16d426878024ee5dfea9f57560c4cda37 (patch) | |
tree | 9734f9d7ba01fa95460e3c05aa5f9479eb7e5582 /module | |
parent | a44b237ce7e95d27389eb208186d18ebd37febb5 (diff) |
Shut down ELM327's 'protocol' before reconfiguring CAN
According to ELM327's manual, AT PC should be sent before issuing AT PB.
Diffstat (limited to 'module')
-rw-r--r-- | module/elmcan.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/module/elmcan.c b/module/elmcan.c index d5c289c..ffdb60e 100644 --- a/module/elmcan.c +++ b/module/elmcan.c @@ -66,6 +66,7 @@ enum ELM_TODO { ELM_TODO_CANID_11BIT, ELM_TODO_CANID_29BIT_LOW, ELM_TODO_CANID_29BIT_HIGH, + ELM_TODO_CAN_CONFIG_PART2, ELM_TODO_CAN_CONFIG, ELM_TODO_RESPONSES, ELM_TODO_SILENT_MONITOR, @@ -595,6 +596,10 @@ static void elm327_handle_prompt(struct elmcan *elm) !(elm->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)); } else if (test_and_clear_bit(ELM_TODO_CAN_CONFIG, &elm->cmds_todo)) { + sprintf(local_txbuf, "ATPC\r"); + set_bit(ELM_TODO_CAN_CONFIG_PART2, &elm->cmds_todo); + + } else if (test_and_clear_bit(ELM_TODO_CAN_CONFIG_PART2, &elm->cmds_todo)) { sprintf(local_txbuf, "ATPB%04X\r", elm->can_config); |